Also called the Barnsley Fern, it is a fractal pattern generated by iterating over four sets of transformations chosen based on a specific probability factor.
The formula for a single transformation looks like this:
There are 4
such transformations and each of the transformations are specifically tasked with creating a portion of the fern.
function | a | b | c | d | e | f | p | PART |
---|---|---|---|---|---|---|---|---|
ƒ1 | 0. | 0. | 0. | 0.16 | 0. | 0. | 0.01 | Stem |
ƒ2 | 0.85 | 0.04 | −0.04 | 0.85 | 0. | 1.60 | 0.85 | Successively smaller leaflets |
ƒ3 | 0.20 | −0.26 | 0.23 | 0.22 | 0. | 1.60 | 0.07 | Largest left-hand leaflet |
ƒ4 | −0.15 | 0.28 | 0.26 | 0.24 | 0. | 0.44 | 0.07 | Largest right-hand leaflet |
Here p
is the probability factor
and it determines the probability of choosing that function from the list of 4 functions.
Each iteration chooses 1 of 4 functions based on it's probability factor (in the first iteration, (0, 0)
is used as the initial input). The co-ordinates obtained are traced in the output and is used as input for the next iteration. More the number of iterations, the more defined the fern looks as the number of points plotted increases.
By slightly changing the function parameters, we can create different variations of fern.