edu.rit.smp.fractal
Class MandelbrotSetGray

java.lang.Object
  extended by edu.rit.smp.fractal.MandelbrotSetGray

public class MandelbrotSetGray
extends Object

Class MandelbrotSetGray is a sequential program that calculates the Mandelbrot Set and creates a grayscale image of it.

Usage: java edu.rit.smp.fractal.MandelbrotSetGray width height xcenter ycenter resolution maxiter grayL grayU gamma filename
width = Image width (pixels)
height = Image height (pixels)
xcenter = X coordinate of center point
ycenter = Y coordinate of center point
resolution = Pixels per unit
maxiter = Maximum number of iterations
gmin = Used to calculate pixel gray levels
gmax = Used to calculate pixel gray levels
gslope = Used to calculate pixel gray levels
filename = PJG image file name

The program considers a rectangular region of the complex plane centered at (xcenter,ycenter) of width pixels by height pixels, where the distance between adjacent pixels is 1/resolution. The program takes each pixel's location as a complex number c and performs the following iteration:

z0 = 0
zi+1 = zi2 + c

until zi's magnitude becomes greater than or equal to 2, or i reaches a limit of maxiter. The complex numbers c where i reaches a limit of maxiter are considered to be in the Mandelbrot Set. (Actually, a number is in the Mandelbrot Set only if the iteration would continue forever without zi becoming infinite; the foregoing is just an approximation.) The program creates an image with the pixels corresponding to the complex numbers c and the pixels' gray values corresponding to the value of i achieved by the iteration. Points in the Mandelbrot set are black, and the other points are shades of gray given by the formula min(gmin+gslope*i/maxiter,gmax), where 0 is white and 1 is black. The image is stored in a Parallel Java Graphics (PJG) file specified on the command line.

The computation is performed sequentially in a single processor. The program measures the computation's running time, including the time to write the image file. This establishes a benchmark for measuring the computation's running time on a parallel processor.


Method Summary
static void main(String[] args)
          Mandelbrot Set main program.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(String[] args)
                 throws Exception
Mandelbrot Set main program.

Throws:
Exception


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.