Project 1.C: Mandelbrot Set

This is the final installment of your Mandelbrot project. Do not wait until the last minute to work on it. 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 pan the image and improve the efficiency of redering. These represent modifications to your code from deliverable two. You should work from your code for Mandelbrot2.


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

  2. Improve efficiency. Rather than compute the set membership for each pixel at the time you want to display the pixel, instead you could compute a value in an array that corresponds to the display window. This array could be useful when panning and when zooming out (and perhaps when zooming in as well). Add an array of ints that will store the effective set-membership for the currently displayed region of the complex plane. Modify your paint method to use this array to render a region of the Mandelbrot Set. You should only compute the portion of the complex plane that has not been previously computed.

  3. Pan the image. Modify your code so that by clicking and dragging, the user can reposition the existing image according to the drag motion. That is, when the mouse is pressed, the mouse location gets moved to the location of the mouse at the time it is released. The entire image (without zooming in or out) should be translated in a corresponding manner. Some of the image should not need to be recomputed; your code should only compute the set-membership for the newly-rendered pixels.

  4. Improve zooming into and out of the image. When zooming into a region of the image, there is no need to display a blank image while your program computes the set membership of the pixels. Note that we might think of zoom-in operation as converting a single pixel into four pixels. Thus, you could render your image using your existing data in 2x2 blocks of pixels and then gradually replace these values as you compute the membership of the finer-grained points. Likewise, when zooming out, you can temporarily use the set membership that you have already computed. Because four pixels will become a single pixel, you could choose to use tho max, the min, the average, or an arbitrary one of the four pixels as the basis for rendering the image while you are recomputing the actual image.

  5. Finalized packaging. Your program should support: zooming in (with left mouse click), zooming out (with right mouse click), and panning (with mouse drag). In each case of image adjustment, your program should render the image efficiently by taking advantage of currently-computed values. Be sure to document the choices you make for implementing efficiency. As before, your default values should reflect 256 max-iterations and a window size of 900x600.

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 “P1C”. For example, someone with email address “cjones” would create a folder called “cjonesP1C”. 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>P1C” will be created. Submit the packaged file for project 1.B on Eureka.