infpp.fractal
Class ThreadedDoublePrecisionFractalGenerator

java.lang.Object
  extended by infpp.fractal.DoublePrecisionFractalGenerator
      extended by infpp.fractal.ThreadedDoublePrecisionFractalGenerator
All Implemented Interfaces:
FractalGenerator
Direct Known Subclasses:
ThreadedDoublePrecisionJuliaGenerator, ThreadedDoublePrecisionMandelbrotGenerator

public abstract class ThreadedDoublePrecisionFractalGenerator
extends DoublePrecisionFractalGenerator

The Threaded DoublePrecisionFractalGenerator class provides an abstract class that serves as a common base for FractalGenerators using double precision floating point arithmetic and multiple threads to speed up the calculation.

Author:
both

Constructor Summary
protected ThreadedDoublePrecisionFractalGenerator()
          Constructs a new ThreadedDoublePrecisionFractalGenerator and initializes the buffers.
 
Method Summary
protected abstract  int calculateNumberOfIterationsAtComplex(Complex c)
          Performs the actual calculation of the number of required iterations to determine divergence of a certain sequence defined using the specified complex number.
 int getNumberOfIterationsAtPixel(int x, int y)
          Returns the number of required iterations to determine divergence of a certain sequence at the specified pixel converted to a complex number as it is stored in one of the buffers used by this ThreadedDoublePrecisionFractalGenerator.
 void setComplexOrigin(Complex complexOrigin)
          Sets the center of the visible part of the fractal to the specified point on the complex plane.
 void setRealDimension(double realDimension)
          Sets the minimum diameter of the visible part of the fractal to the specified diameter.
 void setScreenDimension(int width, int height)
          Sets the size of the area to be displayed in pixels.
protected  void startWorking()
          Begins the process of filling the buffers with data.
 
Methods inherited from class infpp.fractal.DoublePrecisionFractalGenerator
calculateComplexFromScreenCoordinates, getComplexOrigin, getRealDimension, getScreenHeight, getScreenWidth
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ThreadedDoublePrecisionFractalGenerator

protected ThreadedDoublePrecisionFractalGenerator()
Constructs a new ThreadedDoublePrecisionFractalGenerator and initializes the buffers.

Method Detail

setComplexOrigin

public void setComplexOrigin(Complex complexOrigin)
Description copied from interface: FractalGenerator
Sets the center of the visible part of the fractal to the specified point on the complex plane.

Specified by:
setComplexOrigin in interface FractalGenerator
Overrides:
setComplexOrigin in class DoublePrecisionFractalGenerator
Parameters:
complexOrigin - the point on the complex plane about which to center the visible part
See Also:
FractalGenerator.setComplexOrigin(Complex)

setRealDimension

public void setRealDimension(double realDimension)
Description copied from interface: FractalGenerator
Sets the minimum diameter of the visible part of the fractal to the specified diameter.

Specified by:
setRealDimension in interface FractalGenerator
Overrides:
setRealDimension in class DoublePrecisionFractalGenerator
Parameters:
realDimension - the specified diameter
See Also:
FractalGenerator.setRealDimension(double)

setScreenDimension

public void setScreenDimension(int width,
                               int height)
Description copied from interface: FractalGenerator
Sets the size of the area to be displayed in pixels.

Specified by:
setScreenDimension in interface FractalGenerator
Overrides:
setScreenDimension in class DoublePrecisionFractalGenerator
Parameters:
width - the width of the area to be displayed in pixels
height - the height of the area to be displayed in pixels
See Also:
FractalGenerator.setScreenDimension(int, int)

getNumberOfIterationsAtPixel

public int getNumberOfIterationsAtPixel(int x,
                                        int y)
Returns the number of required iterations to determine divergence of a certain sequence at the specified pixel converted to a complex number as it is stored in one of the buffers used by this ThreadedDoublePrecisionFractalGenerator.

Parameters:
x - the x coordinate of the specified pixel
y - the y coordinate of the specified pixel
Returns:
the number of required iterations
See Also:
FractalGenerator.getNumberOfIterationsAtPixel(int, int)

calculateNumberOfIterationsAtComplex

protected abstract int calculateNumberOfIterationsAtComplex(Complex c)
Performs the actual calculation of the number of required iterations to determine divergence of a certain sequence defined using the specified complex number. In particular, this calculation is not performed when calling getNumberOfIterationsAtPixel.

Parameters:
c - the specified complex number
Returns:
the number of required iterations
See Also:
FractalGenerator.getNumberOfIterationsAtPixel(int, int)

startWorking

protected void startWorking()
Begins the process of filling the buffers with data.