To create something that looks like the shape of a lake, the following code transforms the border of a blue ellipse with smooth random steps. The idea is taken from another answer.

% The seed is only set explicitly to always generate the same picture.
% The problem occurs independent of seed.

  \fill[blue, draw=brown,
    decoration={random steps,segment length=1cm,amplitude=.5cm},
    rounded corners=.3cm
  ] (0, 0) ellipse (3 and 2);
  \draw[ultra thick, red] (3.1, 0) circle (.3);

enter image description here

As marked with a red circle, at the point where the ellipse begins (at 0 degrees) the random step is not correctly smoothed but adds an ungly corner. How can this be fixed?


You can use the options pre and post to control what's happening at the beginning and the end of the path you're decorating. More information in the Tikz/PGF manual, section 21.4.2, page 247.

I suggest this:

decoration={random steps,segment length=1cm,amplitude=.5cm,
            pre=lineto,pre length=.25cm,post=lineto,post length=.25cm}

A complete source file and the result follow.


    \fill[blue, draw=brown,
      decoration={random steps,segment length=1cm,amplitude=.5cm,#1},
      rounded corners=.3cm
    ] (0, 0) ellipse (3 and 2);
  \textbf{Seed #1} \\
    \rndellipse{#1} &
    \rndellipse[pre=lineto,pre length=.25cm,post=lineto,post length=.25cm]{#1}



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.