CS30 -- Introduction to Computer Science II
Fall, 2006
Project 2: Mandelbrot Set
Deliverable 2

(updated 11/25/2006)


This is the second installment of your second project.  My intent is that this second project is much more modest than the MazeWar project.  Although it may be less fun as well, there are several interesting facets of the project that may make it interesting for you.  Do not wait until the last minute to work on the project deliverables.  You will suffer in many ways if you do.  The second deliverable is due Thursday Dec. 7 at 8:00am.  This is an individual project.  As always, I encourage you to talk to your peers or to me and to ask questions.  But the code you submit must be your own code.

In this deliverable, we will complete a simple interface to zoom into and out of the picture and we will map the values onto multiple colors.  These represent modifications to your code from deliverable one.  You should still have a primary Mandelbrot class with a main method that starts the drawing at the default level.

Deliverable 2.2  Navigate the multi-colored Mandelbrot Set

Determine rate of divergence.  Alter your inMandelbrotHuh function to return an int instead of a boolean.  The returned int should indicate the number of iterations computed before the value diverged.  This number will be used to determine the color for a given pixel.

Performance enhancement.  Use the java TreeSet class to store the values computed during iterations.  If the same value ever repeats, then the point is guaranteed to be in the Mandelbrot set as it will never diverge.  The TreeSet promises log(n) access so it will be interesting to see how much (if any) time this saves.

Colorizing the picture.  Instead of a two-color image, you should now draw the set with a range of colors.  You should map regions of the complex plane onto colors according to rate of divergence.  That is if a point diverges after four iterations it would get colored in one color and if after forty iterations then some other color.  You should think about how best to map the numbers onto colors.  Review the java.awt.Color class for some ideas.

Navigating through the image.  Your program should allow the user to zoom into the image by left-clicking the mouse on a point.  The program should then re-draw (re-render) a region half the size centered on the point where the mouse was clicked.  Similarly, if the user right-clicks on a point, zoom out with a region twice as large and centered on the point clicked.

Finalized packaging.  For the code you submit, use a max iterations of 1000 and a window size of 900x600. 

Submission Instructions:
On your machine where you are doing your homework, create a folder called <your email name> followed by "P2.2".  For example, someone with email address "cjones" would create a folder called "cjonesP2.2".  Inside that folder, place whatever Java files are necessary for your Programming Projects in the same folder.  Finally, either tar or zip the folder so that when extracted, the folder "<emailname>P2.2" will be created.  Finally, submit via Eureka.