2

I was recently interested on drawing this pendulum using TikZ, but I had some difficulties, here's what I want to get :

enter image description here

Here's my attempt and its result :

       \begin{tikzpicture}

\draw[dashed, ->,smooth] (0,-3)--(0,4.5) node[right] {$z$}; \draw[thick] (0,3)--(2,-2.5); \node[right] at (1,0.25) {$d$}; \filldraw[black] (2,-2.5)circle(0.025); \draw[->] (2,-2.5)--(2,-3.5)node[left] {$\vec{P}$}; \node[right] at (2,-2.5) {$G$}; \filldraw[black] (0,3)circle(0.025); \draw[smooth, ->] (0,3)--(-0.17,3.8) node[left] {$\vec{R}$}; \coordinate(o) at (2,-2.5); \coordinate(b) at (0, -3); \coordinate(a) at (0, 3); \pic [draw=black!15!black,text=black,angle radius=13mm,"$\theta$",angle eccentricity=1.3]{angle = b--a--o}; \draw[dashed] (2,-2.5)--(2,3)--(0,3); \coordinate(c) at (2,3); \pic [draw=black!15!black,text=black,angle radius=13mm,"$\theta$",angle eccentricity=1.3]{angle = c--o--a}; \node[above] at (2,3) {$M$}; \node[left] at (0,3) {$O$}; \node[left] at (0,2.6){$(\Delta)$}; \pic [dashed ,draw=black!15!black ,angle radius=58.5mm,angle eccentricity=1.3]{angle = b--a--o}; \node[left] at (0,-2.8) {$G_0=O$}; \filldraw[black] (0,-2.85)circle(0.025); \end{tikzpicture}

enter image description here

Can anyone help me how to draw the body which is something like this :

enter image description here

  • something similar https://tex.stackexchange.com/questions/594075/how-to-draw-this-magnetic-deflection?rq=1 – js bibra Aug 02 '21 at 14:28
  • This looks good so far. What difficulties are you having? As far as drawing faster, it'd be possible to combine some commands to end up with fewer lines of code, but you're not really going to be able to beat one command per item in your output image. – Teepeemm Aug 02 '21 at 15:26
  • @Teepeemm the body I couldn't draw it – Eduardo.ni Aug 02 '21 at 21:07
  • https://texample.net/tikz/examples/physical-pendulum/ – Ignasi Aug 03 '21 at 08:49

1 Answers1

2

You can draw the body using a smooth curve (see this question).

For instance, adding following lines to your tikzpicture:

\draw[dashed, red] (-1,3.3) -- (1,3) -- (1.5,2.5) -- (2.5,2) -- (3,-1) -- (2.5,-3) -- (1.5,-2.5) -- (0.5,0) -- cycle;
\draw plot [smooth cycle, tension=.4] coordinates {(-1,3.3) (1,3) (1.5,2.5) (2.5,2) (3,-1) (2.5,-3) (1.5,-2.5) (0.5,0)};

gives this:

enter image description here

(red line to help the construction)

Karlo
  • 3,257