Orbit Trap Fractals

Construct your own fractal by tweaking a complicated, complex function. Like sand art but for grown ups. Thanks to Dr. Sisson for introducing and explaining the concept.

More projects on Monogon.net

I first learned of Orbit Trap Fractals from Dr. Paul Sisson, where he used them as a context to teach Mathematica. You can find his nice write up of them here. I have since found them to be a very helpful Hello World! alternative for getting a handle on general purpose shader programming.

Additionally they serve a wonderful purpose of demystifying the complex plane for students new to the concept, where the terminology begs to be dismissed. "Imaginary"? "Complex"? Never has there been a greater disparity between denotation and connotation. A student faced with the utility of the complex plane in the face of pretty much anything rotational will quickly disabuse themselves of the bias, but that requires a lot more mental overhead, often occurring many semesters after first exposure.

Fractals better serve that purpose, and Orbit Trap Fractals do a better job at this than the Mandelbrot / Julia varieties. With simple tools at hand, exploration is natural, and familiarity soon follows.

So what's going on? Every pixel represents a (x,y) coordinate which can be though of as a complex number z = x + yi. Unlike boring Real coordinates, comple coordinates can do more than add and subtract with each other. They can multiply, divide, etc., and these operations can be taught to the gpu. A function, f, is conjured up that when applied to one of these complex coordinate pixels returns a new one. The color of every pixel is determined by how many applications of the function f it takes to land in the red ring of radius 1 and width .1 by default.

The journeys of individual pixel coordinates can be analyzed above by sweeping the mouse cursor over the fractal. A train of white lines display each leap of applying f.

At extreme levels of zoom, floating point errors start to show themselves. Looks like sidewalk chalk. Likewise for certain values of f parameters, the inability of floating point numbers to represent otherwise pleasently round decimal values can be seen in the display of f(z). These uglies could be hidden more easily than the visual discrepancies, but that would be hiding the error, not fixing.