I had started working with the tikz-3dplot and the pgf packages for writing a course of classical mechanic. Can you help me to draw a pendulum on the x axis of a Cartisian coordinate system? I want to do something as in the figure below:
1 Answer
This may suit your need
\documentclass[border={10}]{standalone}
\usepackage{tikz}
\usepackage{tikz-3dplot}
\usetikzlibrary{decorations.pathmorphing}
\tdplotsetmaincoords{70}{125} % view angles
\tdplotsetrotatedcoords{0}{0}{0}
\begin{document}
\begin{tikzpicture}
[tdplot_main_coords,
axis/.style={->,thick,>=stealth}
]
\coordinate (O) at (0,0,0);
\draw[axis] (O) -- (4,0,0) node[anchor=north]{$x$};
\draw[axis] (O) -- (0,4,0) node[anchor=north]{$y$};
\draw[axis] (O) -- (0,0,4) node[anchor=west]{$z$};
\draw[green,thick] (O) -- (0,1,0) -- (1,1,0) -- (1,0,0) -- cycle;
\draw[green,thick] (O) -- (0,1,0) -- (0,1,1) -- (0,0,1) -- cycle;
\draw[green,thick] (O) -- (0,0,1) -- (1,0,1) -- (1,0,0) -- cycle;
\draw[gray, line width=3pt] (.5,0,0) -- (-.5,0,0);
\draw[gray,decoration={aspect=0.4, segment length=2mm, amplitude=1.3mm,coil},decorate] (O) -- (0,0,2.5);
\draw (2,0,0) arc (0:90:2);
\end{tikzpicture}
\end{document}
tikz-3dplot
.