7

I'm willing to create a similar graph as this one: enter image description here

I've tried the first figure rotation, and the result was pretty cool:

enter image description here

Here's its code:

\documentclass[tikz,border=10mm]{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{tikz-3dplot}
\pgfplotsset{compat=1.18}
\usetikzlibrary{arrows.meta, shapes.geometric, positioning, perspective, patterns.meta, decorations.pathreplacing, decorations.pathmorphing, patterns, snakes, arrows, shapes, decorations.text, angles, quotes,calc, 3d, decorations.markings, math, circuits.ee.IEC}
\usepackage{circuitikz}
\begin{document}
\definecolor{jack}{HTML}{380036}
\definecolor{back}{HTML}{0CBABA}
\tdplotsetmaincoords{75}{130}
\begin{tikzpicture}[>=stealth, tdplot_main_coords, scale=2]

\draw[->, thick, back] (0,0,0)--(2,0,0) node[above] {$\vec{x}$}; \draw[->, thick, back] (0,0,0)--(0,2,0) node[above] {$\vec{y}$}; \draw[->, thick, back] (0,0,0)--(0,0,2) node[above] {$\vec{z}$}; \tdplotsetrotatedcoords{40}{0}{0} \tdplotdrawarc[tdplot_rotated_coords,circle, dashed, fill=back!30, opacity=0.3]{(0,0,0)}{2}{0}{360}{}{} \draw[tdplot_rotated_coords, thick, jack, ->] (0,0,0)--(2,0,0) node[anchor=north east]{$\vec{u}$}; \draw[tdplot_rotated_coords, thick, jack, ->] (0,0,0)--(0,2,0) node[anchor=west]{$\vec{v}$}; \tdplotdrawarc[tdplot_rotated_coords,jack]{(0,0,0)}{0.7}{-40}{0}{anchor=north east}{$\psi$} \tdplotdrawarc[tdplot_rotated_coords,jack]{(0,0,0)}{0.7}{90-40}{90}{anchor=west}{$\psi$}
\tdplotdrawarc[->,color=jack!75,thick]{(0,0,1.75)}{0.2}{0}{310}{anchor=south west,color=jack!75}{Précession $\psi$} \end{tikzpicture} \end{document}

The problem is when I try the second rotation around the new axis 'u' which is by definition obtained when we set: \tdplotsetrotatedcoords{40}{0}{40} because the first argument of this command is the rotation around z axis the second around y axis and the third around x axis, when I try so nothing changes, so is there any method to represent this rotation (note that I've not read completely the documentation).

Any ideas? thanks in advance!

  • You can see here https://tex.stackexchange.com/questions/118069/how-to-draw-an-euler-angle-rotation-sequence-with-tikz?rq=1 – Thuy Nguyen Nov 15 '22 at 15:46

2 Answers2

7

I'm using 3d and perspective TikZ libraries for this. I'm also creating three styles:

  • axis, to change the axis style if you need. The great part of the drawing are axis, so with this we avoid to change them one by one.
  • my view, simply to change the view at the same time in all images.
  • nutation, to change the axis accordingly to the 'nutation' angle.

With this we only need a couple of scopes, one for each image and one more for the central one (the 'nutation' part).

This is my code:

\usetikzlibrary{3d,perspective}

\tikzset { axis/.style={thick,-latex}, my view/.style={3d view={65}{20}}, nutation/.style={rotate around x=\nut} } \colorlet{my cyan}{cyan!50} \colorlet{my magenta}{magenta!50!pink}

\begin{document} \begin{tikzpicture}[line cap=round] \def\pre{-30} % précession \def\nut{40} % nutation \def\rop{30} % rotation propre % left \begin{scope}[shift={(-7,0)},my view] \draw[fill=my cyan] (0,0) circle (2); \draw[axis] (0,0,0) -- (4,0,0) node[below] {$\vec x_1$}; \draw[axis] (0,0,0) -- (0,4,0) node[right] {$\vec y_1$}; \draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_f=\vec z_1$}; \draw[axis] (0,0,0) -- (\pre:4) node[below] {$\vec x_f$}; \draw[axis] (0,0,0) -- (90+\pre:4) node[below] {$\vec y_f$}; \foreach\i in {0,90} \draw[-latex] (\i+\pre:2.5) arc (\i+\pre:\i:2.5) node at (\i+0.5\pre:3) {$\psi$}; \draw[canvas is xy plane at z=2,->] (90:0.5) arc (90:360:0.5) node[pos=0,right] {Précession $\psi$}; \end{scope} % center \begin{scope}[my view] \draw[fill=my magenta,nutation] (2,0) arc (0:-180:2) -- cycle; \draw[fill=my cyan] (0,0) circle (2); \draw[axis] (0,0,0) -- (0,4,0) node[right] {$\vec y_1$}; \begin{scope}[nutation] \draw[fill=my magenta] (2,0) arc (0:180:2) -- cycle; \draw[axis] (0,0,0) -- (0,4,0) node[above] {$\vec y_2$}; \draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_2$}; \end{scope} \foreach\i in {0,90} \draw[my view,canvas is yz plane at x=0,-latex] (\i:2.5) arc (\i:\i+\nut:2.5) node at (\i+0.5\nut:3) {$\theta$}; \draw[axis] (0,0,0) -- (4,0,0) node[below] {$\vec x_1=\vec x_2$}; \draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_1$}; \draw[canvas is yz plane at x=2,->] (-90:0.5) arc (-90:170:0.5) node[pos=0.3,right] {Nutation $\theta$}; \end{scope} % right \begin{scope}[shift={(7,0)},my view,nutation] \draw[fill=my magenta] (0,0) circle (2); \draw[axis] (0,0,0) -- (4,0,0) node[right] {$\vec x_2$}; \draw[axis] (0,0,0) -- (0,4,0) node[above] {$\vec y_2$}; \draw[axis] (0,0,0) -- (0,0,4) node[above] {$\vec z_2=\vec z_3$}; \draw[axis] (0,0,0) -- (\rop:4) node[right] {$\vec x_3$}; \draw[axis] (0,0,0) -- (90+\rop:4) node[above] {$\vec y_3$}; \foreach\i in {0,90} \draw[-latex] (\i:2.5) arc (\i:\i+\rop:2.5) node at (\i+0.5*\rop:3) {$\varphi$}; \draw[canvas is xy plane at z=2,->] (-90:0.5) arc (-90:160:0.5) node[yshift=-4mm,pos=0,text width=2cm] {Rotation propre $\varphi$}; \end{scope} \end{tikzpicture} \end{document}

And the output: enter image description here

Update 1: The second figure:

\documentclass[tikz,border=2.718mm]{standalone}

\begin{document} \begin{tikzpicture}[line cap=round] % axis \foreach\i in {1,2,3} { \begin{scope}[shift={(6\i,0)}] \foreach\j in {0,1} { \draw[thick,latex-latex,rotate=20\j] (0,4) coordinate (Y\i\j) |- (4,0) coordinate (X\i\j); \draw[->] (90\j:3) arc (90\j:90*\j+20:3) coordinate[midway] (A\i\j); } \draw[fill=white] (0,0) circle (0.2); \fill (0,0) coordinate (O\i) circle (0.1); \coordinate (P\i) at (2,3); \end{scope} } % left \node[yshift=-5mm] at (O1) {\strut$\vec z_f=\vec z_1$}; \node[right] at (X10) {\strut$\vec x_f$}; \node[above] at (Y10) {\strut$\vec y_f$}; \node[right] at (X11) {\strut$\vec x_1$}; \node[above] at (Y11) {\strut$\vec y_1$}; \node[right] at (A10) {\strut$\psi$}; \node[above] at (A11) {\strut$\psi$}; \node at (P1) {\strut Précession}; % center \node[yshift=-5mm] at (O2) {\strut$\vec x_1=\vec x_2$}; \node[right] at (X20) {\strut$\vec y_1$}; \node[above] at (Y20) {\strut$\vec z_1$}; \node[right] at (X21) {\strut$\vec y_2$}; \node[above] at (Y21) {\strut$\vec z_2$}; \node[right] at (A20) {\strut$\theta$}; \node[above] at (A21) {\strut$\theta$}; \node at (P2) {\strut Nutation}; % right \node[yshift=-5mm] at (O3) {\strut$\vec z_2=\vec z_1$}; \node[right] at (X30) {\strut$\vec x_2$}; \node[above] at (Y30) {\strut$\vec y_2$}; \node[right] at (X31) {\strut$\vec x_3$}; \node[above] at (Y31) {\strut$\vec y_3$}; \node[right] at (A30) {\strut$\varphi$}; \node[above] at (A31) {\strut$\varphi$}; \node at (P3) {\strut Rotation propre}; \end{tikzpicture} \end{document}

Update 2: a second version for the second figure, using a \pic (almost the same output):

\tikzset
{%
   pics/axis/.style n args={7}{
   % #1 = x axis label (without subscript): x,y,z
   % #2 = y axis label (without subscript): x,y,z
   % #3 = z axis label (without subscript): x,y,z
   % #4 = original axis label  (subscript)
   % #5 = rotated  axis label  (subscript)
   % #6 = angle
   % #7 = figure label
     code={%
       \draw[thick,latex-latex]           (0,4) node[above] {\strut$\vec#2_#4$} |- (4,0) node[right] {\strut$\vec#1_#4$};
       \draw[thick,latex-latex,rotate=20] (0,4) node[above] {\strut$\vec#2_#5$} |- (4,0) node[right] {\strut$\vec#1_#5$};
       \foreach\j in {0,1}
         \draw[->] (90*\j:3) arc (90*\j:90*\j+20:3) node at (90*\j+10:3.25) {$#6$};
       \draw[fill=white] (0,0) circle (0.2);
       \fill (0,0) circle (0.1);
       \node at (0,-0.5) {\strut$\vec#3_#4=\vec#3_#5$};
       \node at (2,3)    {\strut#7};
    }}
}

\begin{document} \begin{tikzpicture}[line cap=round] \pic at (0,0) {axis={x}{y}{z}{f}{1}{\psi}{Precéssion}}; \pic at (6,0) {axis={y}{z}{x}{1}{2}{\theta}{Nutation}}; \pic at (12,0) {axis={x}{y}{z}{2}{3}{\varphi}{Rotation propre}}; \end{tikzpicture} \end{document}

enter image description here

Juan Castaño
  • 28,426
2

An approach using "brute force" lacks elegance and agility in construction, but allows you to get what you want.

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\def\radius{2}
\def\rA{0.3}
\def\addAx{1}
\def\nutation{45}
\def\precession{-30}

\begin{scope}[shift={(-3.2\radius,0)}] \begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5] \draw[fill=cyan!50] (0,0) circle (\radius); \draw[thick, -latex] (0,0,0) -- (0,\radius+\addAx,0) node[above] {$\vec{y_1}$}; \draw[thick, -latex] (0,0) ++(90:\radius+0.4) arc (90:90+\precession:\radius+0.4); \path (0,0) ++(90:\radius+0.4) arc (90:90+0.5\precession:\radius+0.4) node[right]{$\psi$}; \draw[thick, -latex] (0,0,0) -- (90+\precession:\radius+\addAx) node[right] {$\vec{y_f}$}; \draw[thick, -latex] (0,0,0) -- (0,0,\radius+\addAx) node[above] {$\vec{z_1}$}; \begin{scope}[shift={(0,0,0.9\radius)}] \draw[-latex] (0,0) ++(-150:\rA) arc(-150:150:\rA); \path (0,0) ++(-150:\rA) arc(-150:90:\rA) node[right]{Precession $\psi$}; \end{scope} \draw[thick, -latex] (0,0,0) -- (\radius+\addAx,0,0) node[below right] {$\vec{x_1}$}; \begin{scope}[rotate around z = \precession] \draw[thick, -latex] (0,0,0) -- (\radius+\addAx,0,0) node[below right] {$\vec{x_f}$}; \end{scope} \draw[thick,latex-] (0,0) ++(\radius+0.4,0,0) arc (0:\precession:\radius+0.4); \path (0,0) ++(\radius+0.4,0,0) arc (0:0.5\precession:\radius+0.4) node[below] {$\psi$}; \end{scope} \end{scope}

\begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5] \begin{scope}[rotate around x = \nutation] \draw[fill=magenta!50] (0,0,0) -- (-\radius,0,0 ) arc (180:360:\radius); \end{scope} \draw[fill=cyan!50] (0,0) circle (\radius); \draw[thick, -latex] (0,0,0) -- (0,\radius+0.4,0) node[above] {$\vec{y_1}$}; \begin{scope}[rotate around x = \nutation] \draw[fill=magenta!50] (0,0,0) -- (\radius,0,0 ) arc (0:180:\radius); \end{scope} \draw[thick, -latex] (0,0,0) -- (0,0,\radius+0.4) node[above] {$\vec{z_1}$}; \draw[thick, -latex] (0,0,0) -- (\radius+2.5,0,0) node[below right] {$\vec{x_1} = \vec{x_2}$}; \begin{scope}[shift={(\radius+1,0,0)}] \begin{scope}[rotate around y=90] \draw[-latex] (0,0) ++(-90:\rA) arc(-90:180:\rA) -- ++(0,-0.075,0); \node[right] at (0,\rA,0) {Nutation $\theta$}; \end{scope} \end{scope} \begin{scope}[rotate around y=90] \draw[thick,-latex] (0,0,0) ++(90:\radius+0.1) arc (90:90+\nutation:\radius+0.1); \path (0,0,0) ++(90:\radius+0.1) arc (90:90+0.5\nutation:\radius+0.1) node[right] {$\theta$}; \draw[thick,-latex] (0,0,0) ++(180:\radius-0.2) arc (180:180+\nutation:\radius-0.2); \path (0,0,0) ++(180:\radius-0.2) arc (180:180+0.5\nutation:\radius-0.2) node[above] {$\theta$}; \draw[thick,-latex] (0,0) -- (180+\nutation:\radius+0.4) node[above] {$\vec{z_2}$}; \draw[thick,-latex] (0,0) -- (90+\nutation:\radius+0.4) node[above] {$\vec{y_2}$}; \end{scope} \end{scope}

\begin{scope}[shift={(3.2\radius,0)}] \begin{scope}[rotate around y =-50, rotate around x = -90,rotate around y = 5] \begin{scope}[rotate around x = \nutation] \draw[fill=magenta!50] (0,0) circle (\radius); \draw[thick, -latex] (0,0,0) -- (0,\radius+1,0) node[above] {$\vec{y_2}$}; \draw[thick, -latex] (0,0) ++(90:\radius+0.4) arc (90:90-\precession:\radius+0.4); \path (0,0) ++(90:\radius+0.4) arc (90:90-0.5\precession:\radius+0.4) node[above]{$\varphi$}; \draw[thick, -latex] (0,0,0) -- (90-\precession:\radius+1) node[left] {$\vec{y_f}$}; \draw[thick, -latex] (0,0,0) -- (0,0,\radius+0.4) node[above] {$\vec{z_2}=\vec{z_1}$}; \begin{scope}[shift={(0,0,0.9\radius)}] \draw[-latex] (0,0) ++(-150:\rA) arc(-150:150:\rA); \path (0,0) ++(-90:\rA) node[align=left,below]{Rotation\propre $\phi$}; \end{scope} \draw[thick, -latex] (0,0,0) -- (\radius+1,0,0) node[below right] {$\vec{x_2}$}; \begin{scope}[rotate around z = -\precession] \draw[thick, -latex] (0,0,0) -- (\radius+1,0,0) node[below right] {$\vec{x_f}$}; \end{scope} \draw[thick,-latex] (0,0) ++(\radius+0.4,0,0) arc (0:-\precession:\radius+0.4); \path (0,0) ++(\radius+0.4,0,0) arc (0:-0.5\precession:\radius+0.4) node[right] {$\varphi$}; \end{scope} \end{scope} \end{scope} \end{tikzpicture} \end{document}

enter image description here

NCrown
  • 353