Barnsley Fern

The Barnsley fern is a fractal named after the British mathematician Michael Barnsley. It shows how an iterated function system (IFS) can create a fractal, and is an example of how mathematics can simulate certain self-similar forms found in nature.

The Barnsley Fern resembles an actual existing fern.

The algorithm works by applying 4 different transformations to the plotted points, each of which is used a certain percentage of the time. The first transformation, for instance, draws the stem, while subsequent transformations draw smaller copies of the stem and the bottom fronds in different orientations.

I can't say I understand the maths, but the result is stunning.

View code on Github