JCSP Mandelbrot
Author: Peter Welch

# The Mandelbrot Set

[LEFT-MOUSE-CLICK] on the drawing canvas to get a target box that moves with the mouse pointer. The size of this box can be altered by the [UP-ARROW] and [DOWN-ARROW] keys. Its colour can be changed (just black or white) by the Target choice box. The box can be erased by a [RIGHT-MOUSE-CLICK].

Having obtained a target box, move and resize it so that it is over an area of interest. [LEFT-MOUSE-CLICK] again (or press the [CARRIAGE-RETURN] key) to enlarge the area within the box to the full size of the applet canvas.

Whilst the new image is being computed, a progress bar scrolls down the canvas to give an indication of how fast things are going. The relative position of the bar in the canvas corresponds to the relative area of computation currently being performed within the box. This progress bar can be eliminated by selecting the None option in the Scrolling choice box. Other options are Up and Down, which cause the new image to be displayed as it is being computed - however, this usually slows everything down as the image rendering (usually) dominates the computation cost. The Silent option is the default, which yields the progress bar.

The Iterations choice box lets us set the maximum number of iterations for the Mandelbrot calculation. There are very interesting regions where this needs to be set to 32K - find them!

The images can be rendered with two colour maps - Step and Fade selectable from the Colours choice box. Some areas look better with one and some with the other.

Previous images are remembered and may be recovered by clicking the Backward button. Having gone back, we can go Forward again. Two clicks are needed for this: the first shows a target box over the area we have just come from (or are about to go to) and the second allows us to Confirm or Cancel the move.

The coordinates of the top-left point in the image are displayed in the Top and Left labels (above the canvas). The resolution between points is shown in the Scale label.

The Mandelbrot computation is performed by a classical worker process farm. Areas of the image are farmed out to idle workers a few lines at a time. On a (SMP) multiprocessor, real speedup will be obtained as all processors will be used (assuming our JVM runs with native threads). A running computation can be cancelled by clicking the Cancel button (that is only enabled during such a run).

Minor detail: the default size of the target box can be increased only to around 70% of the size of the applet canvas (and has the same aspect ratio). To target an image of the same resolution, but shifted slightly horizontally or vertically, a target box the same size as the canvas is required. This is allowed by using [SHIFT-LEFT-MOUSE-CLICK] to create the box (instead of LEFT-MOUSE-CLICK]).