Barnsley Fern

The Barnsley fern is a fractal designed to look like black spleenwort. The fractal is named for Michael Barnsley.

Starting with an initial coordinate position (on the canvas), the Barnsley fern is generated by probabilistically applying one of several matrix transformations to the current position and making a mark at the current position.

The construction rules are as follows:

Start with an initial position of (0, 0).

To generate the stem, with probability 0.01, use:

f(x, y) =
0.00 0.00
0.00 0.16
x
y
+
0.00
0.00

To generate successively small leaflets, with probability 0.85, use:

f(x, y) =
0.85 0.04
-0.04 0.85
x
y
+
0.00
1.60

To generate the largest left-hand leaflet, with probability 0.07, use:

f(x, y) =
0.20 -0.26
0.23 0.22
x
y
+
0.00
1.60

To generate the largest right-hand leaflet, with probability 0.07, use:

f(x, y) =
-0.15 0.28
0.26 0.24
x
y
+
0.00
0.44

Check out the Wikipedia article for more.