Mandelbrot Set Java Applet


MandelApplet is a Java Applet that draws the Mandelbrot set, which is defined as follows:

The Mandelbrot set is the set of all complex numbers c for which the sequence of numbers zn+1 = zn2 + c with starting point z0 = 0 does not diverge to infinity.

This is approximated by iterating this rule a certain number of times. If z is still inside a circle of radius 2 around the origin, the corresponding c is considered to be inside the Mandelbrot set and its pixel is drawn black. Otherwise, the pixel is colored according to the number of iterations it took to leave the circle: black for 1 iteration, to blue, to red, to yellow, to white for the maximal number of iterations.

To start drawing, either enter some values for the center of the image and its width by hand, or click and drag on the big image or the small map down left, and click "Draw". To find the right maximum number of iterations, you have to experiment. If you set it too low, too much area that doesn't actually belong to the Mandelbrot set is painted black, hiding its fractal-shaped border. If you set it too high, rendering speed will be slower, and the color map will be shifted towards the dark end.

Antialiasing is done in a final pass by the following method: If a pixel differs at least treshold from one of its neighbors (where color difference is measured as the maximum of the differences in red, green, and blue, ranging from 0 to 255), take the average of resolution2 samples to color it.


The source: