How to create the IFS Fern
Written by Paul Bourke
January 1988
See also
Version by Jay Link
designed for SVGALIB
and Object pascal version by Omar Awile.
One of the very common and attractive forms generated by Iterated
Function Systems (IFS) is the fern leaf shown on the right.
The following will describe how to generate this form and allow
the reader to experiment with other IFS generators.
Iterated function systems are described by repeatedly computing
terms in two series, one series describes the x coordinate and the
other series the y coordinate. The equations describe translation,
scaling, rotation, and shearing of points in a plane with the
restriction that the transformations are "affine".
The general form of the series are as follows
x_{n+1} = a x_{n} + b y_{n} + e
y_{n+1} = c x_{n} + d y_{n} + f
A point is drawn at each pair (x_{i},y_{i}) for
i greater than some number, typically 10 to 100.
The magic is in finding the values of (a,b,c,d,e,f) that give the
desired form. In many application it is necessary to have a number
of sets of (a,b,c,d,e,f). As the series is being generated a particular
set is chosen at random for each term. Such IFS systems are often known
as Random Iterated Function Systems.


The fern can be constructed using the table of value on the right.
It turns out that if the different sets of (a,b,c,d,e,f) are chosen
with appropriate probabilities then the fern will "emerge" much faster
and evenly than if the sets are chosen with equal chance. The last
row in the table gives the optimal probabilities.
The fern above resulted from 100 thousand (10^{5}) iterations,
that is, 100 thousand points are drawn (of course when drawn on the bitmap
many will overlap)

 
set1 
set2 
set3 
set4 
a 
0.0 
0.2 
0.15 
0.75 
b 
0.0 
0.26 
0.28 
0.04 
c 
0.0 
0.23 
0.26 
0.04 
d 
0.16 
0.22 
0.24 
0.85 
e 
0.0 
0.0 
0.0 
0.0 
f 
0.0 
1.6 
0.44 
1.6 
p 
0.1 
0.08 
0.08 
0.74 

The image is self similar at all scales, one can zoom in as far as
one wishes and the fronds will continue to resolve themselves. For
example, the following image is a zoom in by 50. Note however that
it takes an ever increasing number of iterations to resolve the image
as the zoom factor increases, this image took 100 million
(10^{8}) iterations.
Some straightforward C source is given here
(source.c) which generates the
figure shown above. Note, you will have to supply your own image
drawing tools.
A slightly different set of codes gives the result on the right.
set 1 set 2 set 3 set 4
a 0.0 0.2 0.15 0.85
b 0.0 0.26 0.28 0.04
c 0.0 0.23 0.26 0.04
d 0.16 0.22 0.24 0.85
e 0.0 0.0 0.0 0.0
f 0.0 1.6 0.44 1.6
probability 0.01 0.07 0.07 0.85


Angular fern by Roger Bagula
Basic source code 
C source code
References
Demko, S., Hodges, L., and Naylor B
Construction of Fractal Objects with Iterated Function Systems
Computer Graphics 19, 3, July 1985, Pages 271278
Barnsley, M.
Fractals Everywhere
Academic press, 1988
Barnsley, F., and Sloan, A.D.
A Better Way to Compress Images
Byte Magazine, January 1988, Pages 215222
Oppenheimer, P.E.
Real Time Design and Animation of Fractal Plants and Trees
Computer Graphics, 20, 4, 1986
Reghbati, H.K.
An Overview of Data Compression Techniques
Computer, 14, 4, 1981, Pages 7176
