Project 1.B: Mandelbrot Set

This is the second installment of your Mandelbrot project. Do not wait until the last minute to work on the project deliverables. You may suffer in many ways if you do. 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 Mandelbrot1 class with a main method that draws the image.

Deliverable 1.B: Navigate the multi-colored Mandelbrot Set

  1. Extending from Project 1.A. Start a new class, Mandelbrot2, that extends your Mandelbrot1 class. You may make minor modifications to your Mandlebrot1 class, such as changing the access of fields and methods.

  2. Determine rate of divergence. Alter your inMandelbrotHuh function to return an int instead of a boolean. [Students in Spring 2011 may have done this already. If not, do so at this point.] 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.

  3. Colorizing the picture. Instead of a two-color image, you should now draw the set with a range of colors. [Again, Spring 2011 students may already have done this.] You should color pixels of your canvas according to rate of divergence for the corresponding point in the complex plane; 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.

  4. Navigating into and out of the image. Your program should allow the user to zoom into the image by left-clicking the mouse on a point. Upon a left-click, the program should re-draw (re-render) a region that is half the size in the complex plane (but still rendered on the same WIDTH by HEIGHT canvas). This new region should be 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 that was clicked.

  5. Finalized packaging. For the code you submit, use default values: max iterations of 1000 and a window size of 900x600. However, you should support optional command-line arguments for alternate max-iterations and window size width. If one argument is provided, interpret that as the desired max-iterations. If two arguments are provided, interpret the second as the desired max-iterations (maintain 3:2 aspect ratio).

Submission Instructions:

Important: Include your whether or not you modified it for this assignment! Do not forget to use the javadoc constructs for your documentation and include the html file produced by the javadoc tool in your final submission. Make sure that you create a folder named with your Westmont email name followed by "P1B". For example, someone with email address "cjones" would create a folder called "cjonesP1B". Make sure that inside that folder you have: java source files and html documentation files resulting from javadoc. Finally, either tar or zip the folder so that when we extract it, the folder "<emailname>P1B" will be created. Submit the packaged file for project 1.B on Eureka.