I've been putting in some work on my new and interesting project. It's a fun little app developed in common lisp with Ltk (a lisp interface into tcl/tk) in slime. It allow you to design 2D IFS fractals by graphically manipulating the transforms that comprise them.
I really like the IFS algorithm because it's just sooo simple:
- Take a number of transformations (scale, rotate, translate). Three is enough to produce a nice standard fern-like fractal.
- Starting at the origin, apply the transforms in a random order (weighted by the size (determinant) of the transformation matrix)
- After about 100-200 iterations, start to draw the points.
- Finish when you feel the image is dense enough.
I'm no mathematician but the why goes like this:
- The transforms represent a fractal attractor - the transforms are a very concise description of a set of points in space.
- Each transform maps a part of the attractor onto itself - when you start on the attractor and apply one of the transforms the result will still be on the attractor.
- Applying a transform to a random point will make it closer to the attractor - I suppose this is why it's called an 'attractor' :) . This is why you discard the first few points, to make sure you're at least near the attractor when you start to draw the points.
- Weighting the picking of the transforms by determinant isn't actually necessary but it does improve the performance of the algorithm.