3

I want to make an animation, to show the rotation of this plate around the axis oz, I used this code

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}% deu angle $\theta_d$ atour de (x) et $\phi_d$ autour de (z)
\begin{tikzpicture}[tdplot_main_coords,scale=5]

  \pgfmathsetmacro{\r}{.5}
  \pgfmathsetmacro{\O}{45} % right ascension of ascending node [deg]
  \pgfmathsetmacro{\i}{45} % inclination [deg]
  \pgfmathsetmacro{\f}{45} % true anomaly [deg]

  \coordinate (O) at (0,0,0);

  \draw [thick,->] (O) -- (1.5,0,0) node[anchor=north east] {$x_0$};
  \draw [thick,->] (O) -- (0,1,0) node[anchor=north west] {$y_0$};
  \draw [thick,->] (O) -- (0,0,1.5) node[anchor=south] {$z_0$};
  \fill[black, tdplot_main_coords] (0,0,0) circle (0.5pt)node[medway, anchor=-30]{$O$};

  \tdplotsetthetaplanecoords{45}
  \draw [thick,tdplot_rotated_coords,color=violet,->] (O) -- (1.5,0,0) node[anchor=north east] {$z$};
  \draw [thick,tdplot_rotated_coords,color=violet,->] (O) -- (0,1.65,0) node[anchor=north west] {$x$};
  \draw [thick,tdplot_rotated_coords,thick,dashed, color=violet,->] (O) -- (0,0,1) node[anchor=south] {$y$};

  \draw [tdplot_rotated_coords, fill=yellow!20!gray] (O) -- (1,0,0)--(0,1,0)--cycle; 

  \tdplotdrawarc[thick, tdplot_main_coords, color=red, ->]{(0,0,0)}{\r}{0}{45}{anchor=105}{$\varphi$}
   \tdplotdrawarc[thick, tdplot_main_coords, color=red, ->]{(0,0,0)}{\r}{90}{135}{anchor=180}{$\varphi$}
\end{tikzpicture}
\end{document}

to produce the figure in 3D as shown in the image above, but I have not yet familiarized with the animate package to make latex animations. enter image description here could anyone help me to do this? Thanks in advance.

  • 2
    Does it help?: tex.stackexchange.com/questions/315839/… – Ignasi Feb 6 '18 at 17:11
  • in my case the frame (x_0, y_0, z_0) is fixed, I just want to rotate the x, y around the (x_0, y_0, z_0) frame by \varphi angle. – moradov Feb 6 '18 at 17:52
  • how can i fix the (x_0, y_0, z_0) frame – moradov Feb 7 '18 at 14:42
1

Just following Ignasi's link and making some minor adjustments yields

\documentclass[border=5pt]{standalone}
\usepackage{tikz,tikz-3dplot}
\usepackage{animate}

\begin{document}

\begin{animateinline}[loop, poster = first, controls]{24}
  \multiframe{36}{iAngle=0+10}{
   \tdplotsetmaincoords{70}{110}% deu angle $\theta_d$ atour de (x) et $\phi_d$ autour de (z)
\begin{tikzpicture}[tdplot_main_coords,scale=5]
\useasboundingbox[tdplot_screen_coords] (-2.3,-0.6) rectangle (2.3,2);
% adapted from https://tex.stackexchange.com/a/315853/121799
  \pgfmathsetmacro{\r}{.5}
  \pgfmathsetmacro{\O}{45} % right ascension of ascending node [deg]
  \pgfmathsetmacro{\i}{45} % inclination [deg]
  \pgfmathsetmacro{\f}{45} % true anomaly [deg]

  \coordinate (O) at (0,0,0);

  \draw [thick,->] (O) -- (1.5,0,0) node[anchor=north east] {$x_0$};
  \draw [thick,->] (O) -- (0,1,0) node[anchor=north west] {$y_0$};
  \draw [thick,->] (O) -- (0,0,1.5) node[anchor=south] {$z_0$};
  \fill[black, tdplot_main_coords] (0,0,0) circle (0.5pt)node[midway, anchor=-30]{$O$};

  \tdplotsetthetaplanecoords{\iAngle}
  \draw [thick,tdplot_rotated_coords,color=violet,->] (O) -- (1.5,0,0) node[anchor=north east] {$z$};
  \draw [thick,tdplot_rotated_coords,color=violet,->] (O) -- (0,1.65,0) node[anchor=north west] {$x$};
  \draw [thick,tdplot_rotated_coords,thick,dashed, color=violet,->] (O) -- (0,0,1) node[anchor=south] {$y$};

  \draw [tdplot_rotated_coords, fill=yellow!20!gray] (O) -- (1,0,0)--(0,1,0)--cycle; 
  \pgfmathtruncatemacro{\iBngle}{\iAngle+90}
  \tdplotdrawarc[thick, tdplot_main_coords, color=red,->]{(0,0,0)}{\r}{0}{\iAngle}{anchor=105}{$\varphi$}
   \tdplotdrawarc[thick, tdplot_main_coords, color=red, ->]{(0,0,0)}{\r}{90}{\iBngle}{anchor=180}{$\varphi$}
\end{tikzpicture}
  }
\end{animateinline}
\end{document}
|improve this answer|||||
  • thak you @marmot: the axes x_0 y_0, are fixed I just want to rotate the x, y axes that are connected to the plate – moradov Feb 6 '18 at 17:44
  • 1
    @moradov Changed. – user121799 Feb 6 '18 at 17:55
  • i don't know how to fix the (x_0, y_0, z_0) frame??, – moradov Feb 7 '18 at 14:45
  • @moradov Sorry, I don't understand your comment. – user121799 Feb 7 '18 at 14:47
  • i want to fix (x_0, y_0 and z_0) axis and make only rotation of the (x, y and z) coordinates around the z axis – moradov Feb 7 '18 at 15:01

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