Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- \documentclass[landscape]{article}
- \usepackage{wasysym}
- \usepackage{tikz}
- \usepackage{tikz-3dplot}
- \usepackage{pgfplots}
- % Workaround for making use of externalization possible
- % -> remove hardcoded pdflatex and replace by lualatex
- \usepgfplotslibrary{external}
- \tikzset{external/system call={lualatex \tikzexternalcheckshellescape%
- -halt-on-error -interaction=batchmode -jobname "\image" "\texsource"}}
- % Redefine rotation sequence for tikz3d-plot to z-y-x
- \newcommand{\tdseteulerxyz}{
- \renewcommand{\tdplotcalctransformrotmain}{%
- %perform some trig for the Euler transformation
- \tdplotsinandcos{\sinalpha}{\cosalpha}{\tdplotalpha}
- \tdplotsinandcos{\sinbeta}{\cosbeta}{\tdplotbeta}
- \tdplotsinandcos{\singamma}{\cosgamma}{\tdplotgamma}
- %
- \tdplotmult{\sasb}{\sinalpha}{\sinbeta}
- \tdplotmult{\sasg}{\sinalpha}{\singamma}
- \tdplotmult{\sasbsg}{\sasb}{\singamma}
- %
- \tdplotmult{\sacb}{\sinalpha}{\cosbeta}
- \tdplotmult{\sacg}{\sinalpha}{\cosgamma}
- \tdplotmult{\sasbcg}{\sasb}{\cosgamma}
- %
- \tdplotmult{\casb}{\cosalpha}{\sinbeta}
- \tdplotmult{\cacb}{\cosalpha}{\cosbeta}
- \tdplotmult{\cacg}{\cosalpha}{\cosgamma}
- \tdplotmult{\casg}{\cosalpha}{\singamma}
- %
- \tdplotmult{\cbsg}{\cosbeta}{\singamma}
- \tdplotmult{\cbcg}{\cosbeta}{\cosgamma}
- %
- \tdplotmult{\casbsg}{\casb}{\singamma}
- \tdplotmult{\casbcg}{\casb}{\cosgamma}
- %
- %determine rotation matrix elements for Euler transformation
- \pgfmathsetmacro{\raaeul}{\cacb}
- \pgfmathsetmacro{\rabeul}{\casbsg - \sacg}
- \pgfmathsetmacro{\raceul}{\sasg + \casbcg}
- \pgfmathsetmacro{\rbaeul}{\sacb}
- \pgfmathsetmacro{\rbbeul}{\sasbsg + \cacg}
- \pgfmathsetmacro{\rbceul}{\sasbcg - \casg}
- \pgfmathsetmacro{\rcaeul}{-\sinbeta}
- \pgfmathsetmacro{\rcbeul}{\cbsg}
- \pgfmathsetmacro{\rcceul}{\cbcg}
- }
- }
- \tdseteulerxyz
- \usepackage{siunitx}
- %%%%%%%%% Z
- \begin{document}
- % Set the plot display orientation
- % Syntax: \tdplotsetdisplay{\theta_d}{\phi_d}
- \tdplotsetmaincoords{60}{140}
- \pgfmathsetmacro{\zRot}{10}
- \pgfmathsetmacro{\yRot}{10}
- \pgfmathsetmacro{\xRot}{10}
- % Start tikz picture, and use the tdplot_main_coords style to implement the display
- % coordinate transformation provided by 3dplot.
- \begin{tikzpicture}[scale=2,tdplot_main_coords]
- % Set origin of main (body) coordinate system
- \coordinate (O) at (0,0,0);
- % Draw main coordinate system
- \draw[red, ,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z_{\mathcal{I}}$,
- \textcolor{blue}{$z'$}};
- % Intermediate frame 1
- \tdplotsetrotatedcoords{\zRot}{0}{0}
- \draw[thick,tdplot_rotated_coords,->, blue] (0,0,0) -- (1,0,0) node[anchor=north east]{$x'$};
- \draw[thick,tdplot_rotated_coords,->, blue] (0,0,0) -- (0,1,0) node[anchor=west]{$y'$};
- \draw[thick,tdplot_rotated_coords,->, blue] (0,0,0) -- (0,0,1) node[anchor=west]{};
- \end{tikzpicture}
- %%%%%%%%%%%%%%%%% Z-Y
- \begin{tikzpicture}[scale=2,tdplot_main_coords,font=\small]
- thick,
- % Set origin of main (body) coordinate system
- \coordinate (O) at (0,0,0);
- % Draw main coordinate system
- \draw[red, ,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z_{\mathcal{I}}$};
- % Intermediate frame 1
- \tdplotsetrotatedcoords{\zRot}{0}{0}
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (1,0,0) node[anchor=north east]{$x'$};
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (0,1,0) node[anchor=west]{};
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (0,0,1) node[anchor=west]{$z'$};
- % Intermediate frame 2
- \tdplotsetrotatedcoords{\zRot}{\yRot}{0}
- \draw[thick,tdplot_rotated_coords,->, green] (0,0,0) -- (1,0,0)
- node[anchor=north ]{$x''$};
- \draw[thick,tdplot_rotated_coords,->, green] (0,0,0) -- (0,1,0)
- node[anchor=west]{$y''$, \textcolor{blue}{$y'$}};
- \draw[thick,tdplot_rotated_coords,->, green] (0,0,0) -- (0,0,1)
- node[anchor=east]{$z''$};
- \end{tikzpicture}
- %%%%%%%%%%%%% Z-Y-X
- \begin{tikzpicture}[scale=2.5,tdplot_main_coords]
- % Set origin of main (body) coordinate system
- \coordinate (O) at (0,0,0);
- % Draw main coordinate system
- \draw[red, ,->] (0,0,0) -- (1,0,0) node[anchor=north east]{$x_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,1,0) node[anchor=north west]{$y_{\mathcal{I}}$};
- \draw[red, ,->] (0,0,0) -- (0,0,1) node[anchor=south]{$z_{\mathcal{I}}$};
- % Intermediate frame 1
- \tdplotsetrotatedcoords{\zRot}{0}{0}
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (1,0,0) node[anchor=north east]{$x'$};
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (0,1,0) node[anchor=west]{$y'$};
- \draw[tdplot_rotated_coords,->, blue] (0,0,0) -- (0,0,1) node[anchor=west]{$z'$};
- % Intermediate frame 2
- \tdplotsetrotatedcoords{\zRot}{\yRot}{0}
- \draw[,tdplot_rotated_coords,->, green] (0,0,0) -- (1,0,0) node[anchor=
- north]{};
- \draw[,tdplot_rotated_coords,->, green] (0,0,0) -- (0,1,0)
- node[anchor=west]{$y''$};
- \draw[,tdplot_rotated_coords,->, green] (0,0,0) -- (0,0,1)
- node[anchor=south]{$z''$};
- % Rotate to final frame
- \tdplotsetrotatedcoords{\zRot}{\yRot}{\xRot}
- \draw[thick,tdplot_rotated_coords,->, cyan] (0,0,0) -- (1,0,0)
- node[anchor=west]{$x_{\mathcal{B}}$, \textcolor{green}{$x''$}};
- \draw[thick,tdplot_rotated_coords,->, cyan] (0,0,0) -- (0,1,0) node[anchor=west]{$y_{\mathcal{B}}$};
- \draw[thick,tdplot_rotated_coords,->, cyan] (0,0,0) -- (0,0,1) node[anchor=south]{$z_{\mathcal{B}}$};
- \end{tikzpicture}
- \end{document}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement