2

I've tried to do a random, smooth ellipse in TikZ with decorations and I came up with something similar like this, but the endpoints don't match:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}[decoration={random steps,segment length=12.5mm,amplitude=6mm}]
        \draw[decorate,rounded corners=4mm] (0,0) ellipse (1.3cm and 2cm);
    \end{tikzpicture}
\end{document}

enter image description here

Repeating the construction several times suggests that the gap is a systematic error that doesn't come from the randomness:

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}[decoration={random steps,segment length=12.5mm,amplitude=6mm}]
        \foreach \i in {1,...,10} {\draw[decorate,rounded corners=4mm] (0,0) ellipse (1.3cm and 2cm);}
    \end{tikzpicture}
\end{document}

enter image description here

What's the problem? How can I fix it?

Turion
  • 4,622

1 Answers1

3

You have to choose dimensions for segment length, amplitude and rounded corners carefully.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\begin{document}
    \begin{tikzpicture}[decoration={random steps,segment length=3pt,amplitude=2pt}]
        \draw[decorate,rounded corners=1pt] (0,0) ellipse (1.3cm and 2cm);
    \end{tikzpicture}
    \begin{tikzpicture}[decoration={random steps,segment length=3pt,amplitude=1pt}]
        \draw[decorate,rounded corners=1pt] (5,0) ellipse (1.3cm and 2cm);
    \end{tikzpicture}
\end{document}

enter image description here

  • How do you know which parameters to choose? Do you suspect some kind of relation between them? (Like one being a multiple of the other) – Turion Feb 06 '15 at 15:55
  • @Turion I did just trial and error! –  Feb 06 '15 at 23:32