Gnofract 4D: For when 2D fractals just aren't weird enough | ||
---|---|---|
<<< Previous | Next >>> |
![]() | Warning: Dubious mathematics ahead |
---|---|
I'm not a mathematician. You may find this discussion insultingly oversimplified or just plain wrong. |
The Mandelbrot is defined as the set of all complex numbers which, when you repeatedly square them and add them again, never become infinite. In pseudocode, the procedure is:
z = 0 while( magnitude(z) < 4.0 ) z = z^2 + c |
Here, c is determined by the position on screen. This gives rise to the familiar Mandelbrot set:
So what happens if z is initially set to a complex value other than zero? Well, you get a rather odd-looking, deformed M-set. This initial value, which we'll call z0, is called the intial perturbation, and sets which have a non-zero z0 are known as perturbed sets:
The Julia set is actually drawn by the same procedure as the Mandelbrot set. But instead of changing the value of c for each pixel, we keep c constant and change z0. There is a different Julia set for each value of c; here's the one for c=0.
Boring, isn't it? That's because we're just squaring the value at each iteration without adding anything to it. So any value which starts with a magnitude less than 1 will shrink forever (and hence is a member of the set). All other values will grow forever, and so we've just discovered a rather inefficient way of drawing perfect circles. If we use a different value of c we get something more interesting:
Here we come to the heart of the matter. I said above that both the Julia and Mandelbrot sets are drawn with the same function.
julibrot(z0,c) z = z0 iterations = 0 while( magnitude(z) < 4.0 and iterations < max_iterations ) z = z^2 + c iterations = iterations + 1 |
However, we can draw any 2D slice we like, not just those which are parallel to the Julibrot axes. To do this we'll need to describe our scene by four things. First, the (x,y,z,w) coordinates of the center of the screen. Second, a vector for the x-axis of the screen. This tells us how to change the parameters to the Julibrot function as we proceed across the screen. Third, a vector for the y-axis. Fourth and finally, the size of the image. For the Mandelbrot set, our "default" view, the screen is centered at [0,0,0,0], the x-vector is [1,0,0,0] and the y-vector is [0,1,0,0]. The initial size is 4, because the whole Mandelbrot set fits inside the 2x2 square. We can zoom into the set by changing x and y and the zoom factor.
If we want to draw other slices, we need to rotate our view through four dimensions. In 3D, we can rotate in 3 directions: around the x, y, and z axes. In 4D, we rotate around a plane rather than a line, and we can rotate in 6 directions: around the xy, xz, xw, yz, yw and zw planes. For example, if we rotate through 90 degrees in the xz and yw directions, our screen vectors become [0,0,1,0] and [0,0,0,1]: in other words, the Julia set. If we rotate only part of the way, we get a "hybrid" between the two sets, which looks decidedly odd:
There are other kinds of fractal which are commonly described as "four-dimensional" - hypercomplex and quaternion-based fractals. Gnofract 4D doesn't currently support these fractals, so they're only mentioned here to clarify the difference. (If you want to generate hypercomplex fractals I recommend you try Quat.) Hypercomplex numbers have four components (one real and three imaginary) where complex numbers have two. Since the hypercomplex mandelbrot has two hypercomplex parameters, in Gnofract 4D terms it's actually an eight-dimensional object.
<<< Previous | Home | Next >>> |
Gnofract 4D | Fractal Types |