Skip to content

Latest commit

 

History

History
37 lines (33 loc) · 2.72 KB

README.md

File metadata and controls

37 lines (33 loc) · 2.72 KB

The-Fern-Fractal

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.

How It Works

The formula for a single transformation looks like this:
7a6ccaaa702062c1c63c488c076d4e1d08f94302

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.


5bc8debe5073efbf8347bed92ab7c1b4fbd1bf67
5bc8debe5073efbf8347bed92ab7c1b4fbd1bf67
687f3f274b69c4e3597a470065d3669e137e7e36
40699077f271fd7f45d3e26c536b1d4b1a9c50dd



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.

image

References