0

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:

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127
moradov
  • 427

1 Answers1

2

This may suit your need

enter image description here

\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}
CroCo
  • 5,902
  • Thank you very much! It was just exactly what I needed. Also thank you for the explanation – moradov Jul 26 '17 at 09:54
  • @user2367775, you're welcome. If this solves your problem, please accepts an answer by clicking on the check mark on the left. – CroCo Jul 26 '17 at 11:03