Interactive IFS

I want to write a program that allows you to explore Iterated Function System (IFS) fractals interactively by moving points around with the mouse.

There's a few different ways to do this, depending on what set of transformations you use.

IFS fractals usually use affine transformations, which encompass translations, rotations, dilations and shears. This can be done with 3 points per transformation - if one considers the points as complex numbers we have the transformation f(x)=ax + b\overline{x} + c. However, rather than controlling a, b and c directly I think it would work better to move the images of some interesting points like 0, 1 and i (i.e. move c, a+b+c and (a-b)i+c). Then the geometric interpretation of the control points would be easy to understand - they would just be the corners of a transformed rectangle.

However, there are other possible transformations. We could reduce the number of control points to 2 and disallow non-orthogonal transformations, giving f(x)=ax + b and control points 0 and 1 mapping to a and a+b.

We could move to quadratics f(x) = ax^2 + bx + c and move c, a+b+c and c+ib-a, and with 4 points we can do cubics f(x) = ax^3 + bx^2+cx+d (in which case we would probably use control points f(0), f(1), f(i) and f(1+i)).

We can even go all the way to f(x) = ax^2 + b\overline{x}^2 + c|x|^2 + dx + e\overline{x} + g (6 control points) if we wanted to go really crazy - that might be a bit unwieldy though.

I'd also like to be able to associate a colour with each transformation so that the colour of a point in the final image depends on the sequence of transformations that led to that point. Perhaps C = \alpha C_{prev} + (1-\alpha)C_{transform} for some \alpha.

Leave a Reply