Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

For some lecture notes I want to illustrate successive unit axis rotations using Euler angles. I am quite happy with what I came up with so far:

Euler angle unit axis rotations

However, I am failing at drawing the angles in between the successive roations. For example, I would like to have theta_1 between x_I and x' etc. Like so: Example of desired output

where the lines should (ideally...) be arcs, and be labelled.

I achieve the last one of the pictures above with the following code using the tikz-3dplot package.

\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}

The full code is pasted here, not to crowd this up too much:
http://pastebin.com/pYW6iyEP

Long story short: How can I draw arcs in between the individual coordinate systems?

share|improve this question
1  
In 2D, the \tkzMarkAngle from tkz-euclide would be the right way to go (see TikZ: Create right angle triangle with angle labels), but in don't know if with some small adjstment could work also in 3D case. –  Claudio Fiandrino Jun 7 '13 at 12:21
add comment

2 Answers

up vote 4 down vote accepted

You can solve your problem using \tdplotdrawarc[coordinates_frame,->,colo]{origin}{radius}{start angle}{end angle}{node info}{label}
Before using that you might have to rotate the theta-plane using \tdplotsetrotatedthetaplanecoords{angle}. I find it kind of unintuitive to use/ difficult to imagine how the angles should be. Therefore, it might really help to first draw a complete circle using \tdplotdrawarc[coordinates_frame,->,colo]{origin}{radius}{0}{360}{node info}{label} and adapting the angle in \tdplotsetrotatedthetaplanecoords{angel} until the circle is in the correct plane.

A solution to your third picture would be: \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'$};

\tdplotsetrotatedthetaplanecoords{90}
%draw theta arc and label
%\tdplotdrawarc[tdplot_rotated_coords,->,color=blue]{(0,0,0)}{0.5}{0}{350}{anchor=south west,color=gray}{$\alpha$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{80}{90}{anchor=south west,color=gray}{$\alpha$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{170}{180}{anchor=south west,color=gray,  yshift = -15 pt}{$\alpha$}

%% 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''$};
\tdplotsetrotatedthetaplanecoords{60}
%draw theta arc and label
%\tdplotdrawarc[tdplot_rotated_coords,->,color=green]{(0,0,0)}{0.5}{0}{350}{anchor=north,color=gray}{$\beta$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{80}{90}{anchor=north,color=gray}{$\beta$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{310}{320}{anchor=south west,color=gray}{$\beta$}
% 
% 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}}$};

\tdplotsetrotatedthetaplanecoords{30}
%draw theta arc and label
%\tdplotdrawarc[tdplot_rotated_coords,->,color=cyan]{(0,0,0)}{0.5}{0}{350}{anchor=north,color=gray}{$\gamma$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{215}{225}{anchor=north,color=gray, yshift = 15pt}{$\gamma$}
\tdplotdrawarc[tdplot_rotated_coords,->,color=gray]{(0,0,0)}{0.5}{328}{338}{anchor=south west,color=gray}{$\gamma$}

\end{tikzpicture}

solution to the third frame

share|improve this answer
    
Thanks a lot for the help Zwähnia! –  Ingo Jun 21 '13 at 15:18
add comment

I got stucked with the same problem and Zwähnia's solution is great and works perfectly in the case you works with Euler angle but couldn't help me with Tait-Bryan angle. There is kind of a bug and I couldn't track it down yet, so there is a workaround.

The problem I had comes from the fact you redefined the \tdplotcalctransformrotmain command (and so did I). This makes in some point tikz-3dplot go crazy. As you can see in the first graph, using tikz-3dplot implementation of the rotation, the circle are drawn in the z_B - x_B plane (the blue circle), y_B - z_B (the red circle) and x_B - y_B (the black circle) whereas in the Tait-Bryan case the red and the black circle are in the same plane Comparison of Euler and Tait-Bryan

The codes are similar though...

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{pgfplots}
% Workaround for making use of externalization possible
% -> remove hardcoded pdflatex and replace by lualatex
\usepgfplotslibrary{external}

% 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}
  }
}

% Set the plot display orientation
% Syntax: \tdplotsetdisplay{\theta_d}{\phi_d}
\tdplotsetmaincoords{60}{140}

\pgfmathsetmacro{\zRot}{10}
\pgfmathsetmacro{\yRot}{10}
\pgfmathsetmacro{\xRot}{10}
%%%%%%%%% Using standard euler angles implemented in default tikz-3dplot implementation
\begin{document}
%%%%%%%%%%%%% Z-Y-Z
\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}}$};

% 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}}$};
\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}}$};

%Draws circle representing the rotated planes. Each of these should be "pointed" by two arrows.
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=black]{(0,0,0)}{1}{0}{350}{anchor=south west,color=black}{$x-y$}
\tdplotsetrotatedthetaplanecoords{0}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=blue]{(0,0,0)}{1}{0}{350}{anchor=south west,color=blue}{$x-z$}
\tdplotsetrotatedthetaplanecoords{90}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=red]{(0,0,0)}{1}{0}{350}{anchor=south west,color=red}{$y-z$}
\end{tikzpicture}

%%%%%% Change the rotation matrix in order to use Tait-Bryan angles
\tdseteulerxyz
%%%%%%%%%%%%% 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}}$};

% 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}}$};
\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}}$};

%Draws circle representing the rotated planes. Each of these should be "pointed" by two arrows.
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=black]{(0,0,0)}{1}{0}{350}{anchor=south west,color=black}{$x-y$}
\tdplotsetrotatedthetaplanecoords{0}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=blue]{(0,0,0)}{1}{0}{350}{anchor=south west,color=blue}{$x-z$}
\tdplotsetrotatedthetaplanecoords{90}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=red]{(0,0,0)}{1}{0}{350}{anchor=south west,color=red}{$y-z$}
\end{tikzpicture}
\end{document}

I wanted to preserve the use of the angle macros \xRot, \yRot and \zRot which is not possible anymore if you set up the tdplotsetrotatedthetaplanecoords as does Zwähnia. A working Tait-Bryan representation

My solution consists in turning the coords backwards to find easily the good theta plane.

\documentclass{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{pgfplots}
% Workaround for making use of externalization possible
% -> remove hardcoded pdflatex and replace by lualatex
\usepgfplotslibrary{external}

% 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}
  }
}

% Set the plot display orientation
% Syntax: \tdplotsetdisplay{\theta_d}{\phi_d}
\tdplotsetmaincoords{60}{140}

\pgfmathsetmacro{\zRot}{10}
\pgfmathsetmacro{\yRot}{10}
\pgfmathsetmacro{\xRot}{10}
%%%%%%%%% Using standard euler angles implemented in default tikz-3dplot implementation
\begin{document}
%%%%%% Change the rotation matrix in order to use Tait-Bryan angles
\tdseteulerxyz
%%%%%%%%%%%%% 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}}$};

% 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}}$};
\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}}$};

%Draws circle representing the rotated planes. Each of these should be "pointed" by two arrows.
%\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=black]{(0,0,0)}{1}{0}{350}{anchor=south west,color=black}{$x-y$}
\tdplotsetrotatedthetaplanecoords{0}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=blue]{(0,0,0)}{1}{0}{350}{anchor=south west,color=blue}{$x-z$}
\tdplotsetrotatedthetaplanecoords{90}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=black]{(0,0,0)}{1}{0}{350}{anchor=south west,color=black}{$y-z$}

% Instead, rotates in the opposite direction
\tdplotsetrotatedcoords{\zRot+90}{\yRot}{\xRot}
%Draw the last circle in the right plane
\tdplotsetrotatedthetaplanecoords{0}
\tdplotdrawarc[dashed,tdplot_rotated_coords,->,color=red]{(0,0,0)}{1}{0}{350}{anchor=south west,color=red}{$x-z$}

\end{tikzpicture}
\end{document}

It's not really pretty but it has the advantage of staying with the use of the angle macros and allows to draw the sequence as I wanted it (I finish my last tikzpicture and I update my answer with it).

Hope this helps.

Cheers.

share|improve this answer
    
Could you explain how you constructed those circles or ellipses in 3D instead of a 2D plane? I have been looking for an answer to that here –  dustin Jul 16 '13 at 13:59
    
I used the dedicated package tikz-3dplot. Nevertheless I don't know how to draw 3D ellipses using this package, only 3d circles which appears as ellipses. –  Vser Jul 16 '13 at 14:33
    
Unfortunately my "solution" in the previous post isn't really working ; I didn't tested it carefully enough. As soon as I get a solution I'll update the answer. –  Vser Jul 16 '13 at 16:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.