Note: Hit the links for more thorough explanations -many come from Wikipedia; given the complex nature of the subject at hand, it's best to be already clued in in order to get the most out of this article.

Fractal

Considering possible screen-savers, I started looking into fractals -a nice topic. At http://cabin.users.geeky.net/Fractal.php I saw the Buddhabrot for the first time; it was an animation that seemed to color random pixels, but... After a while, the figure on the picture appeared! You see, it doesn't matter how you start painting the image: you'll always get a very similar end result.

"Ok", I thought;, "now I just have to adapt the code".For that, I've unavoidably had to get familiar with a few math concepts -after all, this drawing is a graphic representation of the Mandelbrot set. But before we go into more detail, a brief history review.

The Buddhabrot technique

Created by Melinda Green, and later baptized by Lori Gardi, this technique is a special render of the classic Mandelbrot. The reason for the name's because it resembles a meditating buddha, with its third eye and metaphysic energy trails.

All of this is very nice, but what gives place to the magic? What numbers belong to the Mandelbrot set?

Let's see the Mandelbrot function: Zn = Zn-12 + C.

Being Z0= 0, and C any complex number, the sequence of Zs is calculated. If Z does not tend to infinity, C belongs to the set.

Rendering the Mandelbrot:

We start off a complex plane in which the real axis ranges from -2 to 2, and so does the imaginary. We check a good number of Cs, evenly distributed across the plane.

Additionally, we've got a pixel matrix that maps onto the aforementioned complex plane. So then, if a C does not belong to the set, we light up the corresponding pixel.

In the end, an image is drawn with the pixel matrix -gray-scale or color, depending on how elaborate a product we're looking for.

Rendering the Buddhabrot:

Same as the Mandelbrot, only this time for every C outside the set we hit the pixels corresponding to the iterates -that is, the Zs.

Alright, that is the theory. If you want to see a more detailed explanation for my implementation, jump to the next page.