波浪线,但“随机”

波浪线,但“随机”

我想和Ti一起重绘这幅画Z:

在此处输入图片描述

但是我对圆圈线有问题。我知道如何绘制“正常”的波浪线,但这不是我想要实现的。这是我的 MWE:

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,patterns}
\begin{document}
    \begin{tikzpicture}[>=stealth]
        \draw (1.75,1) --+ (0,-1) node[below] {$I$};
        \draw (2*1.75,1.5) --+ (0,-1.5) node[below] {$I\!I$};
        \draw (3*1.75,2) --+ (0,-2) node[below] {$I\!I\!I$};
            \draw (3.1,-1) --+ (0,1);
                \draw[<->] (3.1,-.9) --+ (-3.1,0) node[midway,fill=white] {$x_1$};
            \draw[ultra thin] (0,-1.5) -- (0,2);
            \draw[ultra thin] (7,-1.5) -- (7,0);
                \begin{scope}
                    \fill[white] (0,0) rectangle (7,.5);
                        \clip[draw] (0,0) rectangle (7,.5);
                        \foreach \x in {0,.2,...,7}
                        {
                            \draw (\x,0) -- (\x,.5);
                        }
                \end{scope}
                    \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                        \draw[thick] (-.3,-.2) -- (.3,-.2);
                        \draw[fill=white] (0,0) circle(.07);
                    \fill[pattern=north east lines] (-.3,-.2) rectangle (.3,-.3);
                        \begin{scope}[shift={(7,0)}]
                            \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                                \draw (-.3,-.2) -- (.3,-.2);
                                \draw[fill=white] (0,0) circle(.07);
                            \draw[fill=white] (-.2,-.3) circle(.05);
                            \draw[fill=white] (0,-.3) circle(.05);
                            \draw[fill=white] (.2,-.3) circle(.05);
                                \draw[thick] (-.3,-.4) -- (.3,-.4);
                                \fill[pattern=north east lines] (-.3,-.4) rectangle (.3,-.5);
                        \end{scope}
             \draw[<->] (0,.9) -- (1.75,.9) node[midway,fill=white] {$\frac{l}{4}$};
             \draw[<->] (0,1.4) -- (2*1.75,1.4) node[midway,fill=white] {$\frac{l}{2}$};
             \draw[<->] (0,1.9) -- (3*1.75,1.9) node[midway,fill=white] {$\frac{3l}{4}$};
                 \draw[<->] (0,-1.4) -- (7,-1.4) node[midway,fill=white] {$l$};
    \end{tikzpicture}
\end{document}

输出如下:

在此处输入图片描述

答案1

您可以使用random steps带有decorations.pathmorphing圆角的Torbjørn T. 给出了很好的回答。

\documentclass[border=5pt,tikz]{standalone}
\usetikzlibrary{arrows,patterns,decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}[>=stealth]
        \draw (1.75,1) --+ (0,-1) node[below] {$I$};
        \draw (2*1.75,1.5) --+ (0,-1.5) node[below] {$I\!I$};
        \draw (3*1.75,2) --+ (0,-2) node[below] {$I\!I\!I$};
            \draw (3.1,-1) --+ (0,1);
                \draw[<->] (3.1,-.9) --+ (-3.1,0) node[midway,fill=white] {$x_1$};
            \draw[ultra thin] (0,-1.5) -- (0,2);
            \draw[ultra thin] (7,-1.5) -- (7,0);
                \begin{scope}
                    \fill[white] (0,0) rectangle (7,.5);
                        \clip[draw] (0,0) rectangle (7,.5);
                        \foreach \x in {0,.2,...,7}
                        {
                            \draw (\x,0) -- (\x,.5);
                        }
                \end{scope}
                    \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                        \draw[thick] (-.3,-.2) -- (.3,-.2);
                        \draw[fill=white] (0,0) circle(.07);
                    \fill[pattern=north east lines] (-.3,-.2) rectangle (.3,-.3);
                        \begin{scope}[shift={(7,0)}]
                            \draw (-.2,-.2) -- (0,0) -- (.2,-.2);
                                \draw (-.3,-.2) -- (.3,-.2);
                                \draw[fill=white] (0,0) circle(.07);
                            \draw[fill=white] (-.2,-.3) circle(.05);
                            \draw[fill=white] (0,-.3) circle(.05);
                            \draw[fill=white] (.2,-.3) circle(.05);
                                \draw[thick] (-.3,-.4) -- (.3,-.4);
                                \fill[pattern=north east lines] (-.3,-.4) rectangle (.3,-.5);
                        \end{scope}
             \draw[<->] (0,.9) -- (1.75,.9) node[midway,fill=white] {$\frac{l}{4}$};
             \draw[<->] (0,1.4) -- (2*1.75,1.4) node[midway,fill=white] {$\frac{l}{2}$};
             \draw[<->] (0,1.9) -- (3*1.75,1.9) node[midway,fill=white] {$\frac{3l}{4}$};
             \draw[<->] (0,-1.4) -- (7,-1.4) node[midway,fill=white] {$l$};
             \draw[decorate,decoration={random steps,segment
             length=2pt,amplitude=1pt},rounded corners=1pt]
              (3.1,0) -- (3.1,0.6);
    \end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容