|Three transformations (shown in black, red, green), shown by their action on the unit square (grey), produce the Sierpinkski triangle|
x := rnd repeat choose transform w_i with probability p_i x := w_i(x) plot xThe resulting plot converges to the relevant fractal.
Different sets of transformations give different fractals.
|Here, the black and green transformations are as before, but the red transformation includes a rotation|
|A pentagonal fractal produced by five transformations|
The transformations don’t all have to have the same scale factors:
|A “snowflake” produced from four transformations, one with a smaller "shrinkage" than the others|
This is where the probabilities in the algorithm come into play. When all the transformations have the same scale factor, we can choose transformations with a uniform random distribution. When different scale factors are used together, a good heuristic is to choose transformations with probabilities weighted by the area of the relevant transformed square (given by the determinant of the transformation matrix).
The transformations don’t actually have to be squares: we can have different scalings in different directions, and shears, giving more complicated looking fractals:
|A “coral tree”|
|From pentagon to coral, and back.|