I wrote this Mandelbrot generator as a demo tool for my former
employer's Java accelerator
technology. Feel free to do with it what you like; I make
no claims of ownership and will admit under duress to stealing
the calculation algorithms from someone else's program. I'm
making the source code
available in hopes that someone may learn something from it.
There are even a few comments to make life easier for the next
person than it was for me.
Running the program should be obvious. But in case it isn't, here
are a few hints:
-
To get the first image, click on the Home button or anywhere
on the canvas.
-
To zoom in on a portion of the image, hold down the mouse
button over the canvas. Move the rectangle to the region to
be calculated and release the button.
-
To zoom back out again, click on the Back button.
-
There are calculation routines using int,
long, float and
double arithmetic. They should produce the
same image, subject to precision limitations. To see the
differences, calculate an image. Then select a different
data type and click the Recalc button.
-
The coordinates of a particular picture are represented as
the X and Y position of the upper left pixel (reported as
the northwest corner) and the distance between pixels in
both X and Y dimensions (the delta value).
-
Many of the program's features can be modified using
<param> tags in the HTML file. Check
the comments in the source file for details.
-
The source contains code that adds a Save button and permits
saving generated images as JPEG files. You'll need to find
the save() method of the
JTCanvas class and uncomment all of its
code. You'll also need to grab a copy of a Java
JPEG
encoder. Compile the program and then
add a <param name="save"
value="whatever"> line to the HTML file.
(Replace "whatever" with the name of the generated file,
which will be followed by an automatically generated
sequence number.) You will also need a special policy file
to permit writing files. Mine is called Policy. (Clever, n'est-ce
pas?) Invoke the appletviewer with the extra argument
"-J-Djava.security.policy=Policy" to enable
writing of files.
-
If you're looking for an explanation of the Mandelbrot set
that even normal people can understand,
here's
one from the fine folks at Cygnus Software.
Take me home:
|
Comments to:
Hank Shiffman,
Mountain View, California.