14

As always I was redrawing a picture with TikZ. Here is the original:

Screenshot

Note the “sharpy area“ which is circled in red. I don't know how to achieve this, since I just know how to draw smooth areas. Here is my MWE:

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,backgrounds,calc,intersections,patterns}
\begin{document}
    \begin{tikzpicture}[>=stealth,every node/.style={font=\sf\em\tiny}]
        \coordinate (a) at ($(-2.5,.1)+(-1.4,-.7)$);
        \coordinate (b) at ($(2.3,-.35)+(.8,-1.2)$);
        \coordinate (c) at ($(-.2,.3)!.6!(.4,-5.3)$);
        \coordinate (n) at ($(-.2,.3)!.6!(.4,-5.3)$);
        \coordinate (m) at ($(-2.5,.1)!.65!(a)$);
        \coordinate (p) at ($(2.3,-.35)!.65!(b)$);
            \coordinate (c1) at ($(-1,-.5)!.6!(-1.1,-1.4)$);
            \coordinate (c2) at ($(.3,-.45)!.6!(.5,-1.75)$);
            \coordinate (c3) at ($(1.3,-.5)!.6!(1.75,-1.7)$);
            \coordinate (c4) at ($(2.3,-.35)!.6!(3.1,-1.55)$);
                \draw[dashed] ($(-2.5,.1)!.65!(a)$) -- (c) -- ($(2.3,-.35)!.65!(b)$);
                \draw ($(-2.5,.1)!.65!(a)$) -- ($(n)!1.1!(m)$) node[midway,above] {0};
                \draw ($(2.3,-.35)!.65!(b)$) -- ($(n)!1.1!(p)$) node[midway,above] {5};
            \draw (0,0) circle(3 and .9);
                \draw[very thick,->] (-2.5,.1) --+ (-1.4,-.7) node[below right] {$P_1$};
                \draw[very thick,->] (-1,-.5) --+ (-.1,-.9) node[below right] {$P_2$};
                \draw[very thick,->] (.3,-.45) --+ (.2,-1.3) node[below right] {$P_3$};
                \draw[very thick,->] (1.3,-.5) --+ (.45,-1.2) node[below right] {$P_4$};
                \draw[very thick,->] (2.3,-.35) --+ (.8,-1.2) node[right] {$P_5$};
            \draw[fill=white,radius=.1] (-2.5,.1) circle;
            \draw[fill=white,radius=.1] (-1,-.5) circle;
            \draw[fill=white,radius=.1] (.3,-.45) circle;
            \draw[fill=white,radius=.1] (1.3,-.5) circle;
            \begin{pgfonlayer}{background}
                \path[name path=line1] (c3) -- ($(c3)!6.4!(1.3,-.5)$);
                \path[name path=line2] (c4) -- ($(c4)!6.2!(2.3,-.35)$);
                    \path[name intersections={of=line1 and line2, by=nn}];
                        \draw (c3) -- (nn) -- (c4);
                    \fill[pattern=north west lines] (c3) -- ($(2.3,-.35)!.65!(b)$) -- (nn) -- cycle;
            \end{pgfonlayer}
            \draw[fill=white,radius=.1] (2.3,-.35) circle;
                \draw[ultra thick,dashed,->] (-.2,.3) --+ (.6,-5.6) node[above right=3] {\large R$_{1-5}$};
            \draw[very thick,fill=white,radius=.15] (n) circle node[left=7,yshift=-.1cm] {\large $I\!I$};
                \draw ($(-2.5,.1)!.65!(a)$) -- (c1) node[midway,above] {1} -- (c2) node[midway,above=-2] {2} -- (c3) node[midway,above] {3} -- ($(2.3,-.35)!.65!(b)$) node[midway,above,fill=white,inner sep=1.5pt,yshift=.03cm] {4};
                \draw[fill=white,radius=.1] (c1) circle;
                \begin{pgfonlayer}{background}
                    \draw (c1) --+ (-1.4,-.4) node[left] {\large $I$};
                \end{pgfonlayer}
            \draw[fill=white,radius=.1] (nn) circle;
    \end{tikzpicture}
\end{document}

And here is the output:

Screenshot_2

(I left the node “Lageplan u. Seileck“ because it isn't important for the picture.)

current_user
  • 5,235
  • 1
    Probably a duplicate of Wavy line, but “randomised“ but no time to check. See if the decoration applied in the accepted answer there can be applied your case. – Chris H Aug 03 '18 at 10:47
  • Yes, i checked that but it can't be applied (it's getting too sharpy) … – current_user Aug 03 '18 at 10:52
  • 1
    I'd expect you to need to fiddle with thte parameters in random steps,segment length=2pt,amplitude=1pt},rounded corners=1pt, for example a lower ratio of amplitude to segment length – Chris H Aug 03 '18 at 10:55
  • Yes, I've tried it, but that's not still what I want … – current_user Aug 03 '18 at 10:59
  • Ahh, the rigid body potato strikes again. – joojaa Aug 03 '18 at 21:05
  • @joojaa: What do you exactly mean … ? – current_user Aug 03 '18 at 21:45
  • 1
    Every description of rigid bodies has this representation of a arbitrary body. And because its arbitrary offcourse people choose a shape that signifies arbitrary. A blob, but as my friend pointed out yeah but if its arbitrary your expect somebody to use a drawing of a cylinder or a cone for example. But oh no all material choose to use a ovalish squiggle... that incidentally looks like a potato. Hence potatoes are the go to guys for arbitrary shapes in physics. – joojaa Aug 03 '18 at 22:08
  • @joojaa: That's the reason why I have decided for the “potato“ … ;) – current_user Aug 03 '18 at 22:24

1 Answers1

17

You can replace

\draw (0,0) circle(3 and .9);

by

\draw[variable=\t,domain=0:360,smooth,samples=60] plot ({cos(\t)*3+0.05*rand},{sin(\t)*0.9+0.05*rand}) -- cycle;

You can always play around with the rand magnitude a bit. Additionally, changing the number of samples with samples=<num> can also change the look for the better. I found that an amplitude of 0.05 works well with samples=60.

Edit
As mentioned by @marmot in the comments, the smooth cycle option ensures that the closing of the cycle is also smooth, and the tension can also be reduced. The latest version is produced with:

\draw[variable=\t,domain=0:360,smooth cycle,samples=50,tension=0.4] plot ({cos(\t)*3+0.05*rand},{sin(\t)*0.9+0.05*rand});

Result:

enter image description here

Max
  • 9,733
  • 3
  • 28
  • 35