JavaView© v3.95.000

vgp.tutor.fractal
Class PjFractalImage

java.lang.Object
  extended byjv.object.PsObject
      extended byjv.project.PjProject
          extended byvgp.tutor.fractal.PjFractalImage
All Implemented Interfaces:
java.lang.Cloneable, java.awt.event.ComponentListener, java.util.EventListener, PsTimeListenerIf, PsUpdateIf, PvPickListenerIf, java.io.Serializable

public class PjFractalImage
extends PjProject
implements java.awt.event.ComponentListener

Demo project for working with pixel images. Project displays a Julia set and a Mandelbrot set where the Julia set is determined by picking a module value in the Mandelbrot image. Picking in a Julia set will display several iterations of the picked point.

Zoom into images by marking a rectangle in display using mark-mode.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_LABEL_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, HAS_VECTOR_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_FOCUSSED, IS_PICKED, IS_SELECTED, IS_USED, NUM_TAGS
 
Constructor Summary
PjFractalImage()
           
 
Method Summary
 void componentHidden(java.awt.event.ComponentEvent comp)
          Invoked when component has been hidden.
 void componentMoved(java.awt.event.ComponentEvent comp)
          Invoked when component has been moved.
 void componentResized(java.awt.event.ComponentEvent comp)
          When component has been resized all images must be resized.
 void componentShown(java.awt.event.ComponentEvent comp)
          Invoked when component has been shown.
 void computeColors(int[] pixArr, int[] valArr, int len, int maxVal, int colType)
          Compute color array from an array of scalar integer values.
 void computeImageJulia(PvDisplayIf disp, double xMin, double yMin, double xMax, double yMax)
          Compute a Julia set in the given rectangle in the complex plane and updates the corresponding images.
 void computeImageMandelbrot(PvDisplayIf disp, double xMin, double yMin, double xMax, double yMax)
          Compute a Mandelbrot set in the given rectangle in the complex plane and updates the corresponding images.
 void computeJulia(int[] pixIter, int imageWidth, int imageHeight, int blockSize, double xMin, double yMin, double xMax, double yMax, int maxIter, PuComplex c)
          Compute a Julia set in the given rectangle in the complex plane.
 void computeMandelbrot(int[] pixIter, int imageWidth, int imageHeight, int blockSize, double xMin, double yMin, double xMax, double yMax, int maxIter)
          Compute a Mandelbrot set in the given rectangle in the complex plane.
 PvDisplayIf getDispJulia()
          Get display of Julia set.
 PvDisplayIf getDispMandelbrot()
          Get display of Mandelbrot set which is used to select the complex parameter value c which determines the Julia set.
 void init()
          Initialize and reset project, stops the running animation if any.
 void markVertices(PvPickEvent pickEvent)
          Method is called from display when user drags a rectangular array.
 void pickInitial(PvPickEvent pickEvent)
          Method is called from display when a user picks into the display in initial-pick mode.
 void start()
          Called when project is launched by viewer on applet start.
 boolean update(java.lang.Object event)
          Update the class whenever a child has changed.
 
Methods inherited from class jv.project.PjProject
addDisplay, addGeometry, addGeometry, dispose, dragDisplay, dragInitial, dragVertex, fitDisplays, getAnimation, getDisplay, getDisplays, getGeometry, getGeometry, getNumGeometries, getParameter, getViewer, hasAnimation, hasDisplay, isEnabledAutoFit, pickDisplay, pickVertex, removeDisplay, removeGeometries, removeGeometry, selectDisplay, selectGeometry, setAnimation, setBackColor, setBorderType, setDisplay, setEnabledAutoFit, setGeometry, setParameter, setTime, setViewer, stop, unmarkVertices
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, clearTag, clone, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, getSymbol, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, newInspector, newInspector, removeInspector, removeInspector, removeUpdateListener, setName, setParent, setSymbol, setTag, toString, updatePanels
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.anim.PsTimeListenerIf
getName
 
Methods inherited from interface jv.project.PvPickListenerIf
getName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, getName, setParent
 

Constructor Detail

PjFractalImage

public PjFractalImage()
Method Detail

init

public void init()
Description copied from class: PjProject
Initialize and reset project, stops the running animation if any. Does not reset any registered display nor geometry. They must be reset individually in each subclass.

Overrides:
init in class PjProject

start

public void start()
Called when project is launched by viewer on applet start.

Overrides:
start in class PjProject
See Also:
PvViewerIf.start(), PjProject.isEnabledAutoFit()

update

public boolean update(java.lang.Object event)
Update the class whenever a child has changed. Method is usually invoked from the children.

Specified by:
update in interface PsUpdateIf
Overrides:
update in class PsObject
See Also:
PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(PsUpdateIf)

componentShown

public void componentShown(java.awt.event.ComponentEvent comp)
Invoked when component has been shown.

Specified by:
componentShown in interface java.awt.event.ComponentListener

componentHidden

public void componentHidden(java.awt.event.ComponentEvent comp)
Invoked when component has been hidden.

Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent comp)
Invoked when component has been moved.

Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent comp)
When component has been resized all images must be resized.

Specified by:
componentResized in interface java.awt.event.ComponentListener

getDispJulia

public PvDisplayIf getDispJulia()
Get display of Julia set. The shown Julia set is determined by a complex value c to be picked in the Mandelbrot image. Picking inside the Julia set will show the iterated values of the picked point z under the map [z -> z^2+c].


getDispMandelbrot

public PvDisplayIf getDispMandelbrot()
Get display of Mandelbrot set which is used to select the complex parameter value c which determines the Julia set.


markVertices

public void markVertices(PvPickEvent pickEvent)
Method is called from display when user drags a rectangular array. The pixel rectangle is converted into a rectangle in the complex plane and used to zoom into the Julia or Mandelbrot set.

Specified by:
markVertices in interface PvPickListenerIf
Overrides:
markVertices in class PjProject
Parameters:
pickEvent - Everything in a PvPickEvent MarkBox gets marked.

pickInitial

public void pickInitial(PvPickEvent pickEvent)
Method is called from display when a user picks into the display in initial-pick mode. This method iterates the picked point using the Julia or Mandelbrot function and displays the iterated points.

Specified by:
pickInitial in interface PvPickListenerIf
Overrides:
pickInitial in class PjProject
Parameters:
pickEvent - Pick event issued by the display on left mouse pick.
See Also:
PvPickListenerIf

computeImageJulia

public void computeImageJulia(PvDisplayIf disp,
                              double xMin,
                              double yMin,
                              double xMax,
                              double yMax)
Compute a Julia set in the given rectangle in the complex plane and updates the corresponding images.

Parameters determine a rectangle in the complex plane in which the Julia set is computed.


computeImageMandelbrot

public void computeImageMandelbrot(PvDisplayIf disp,
                                   double xMin,
                                   double yMin,
                                   double xMax,
                                   double yMax)
Compute a Mandelbrot set in the given rectangle in the complex plane and updates the corresponding images.

Parameters determine a rectangle in the complex plane in which the Mandelbrot set is computed.


computeJulia

public void computeJulia(int[] pixIter,
                         int imageWidth,
                         int imageHeight,
                         int blockSize,
                         double xMin,
                         double yMin,
                         double xMax,
                         double yMax,
                         int maxIter,
                         PuComplex c)
Compute a Julia set in the given rectangle in the complex plane. Method returns a pixel array with given width and height. Adjusting the maximal number of iterations and blockSize allows to speed up the calculation at the cost of accuracy.

The algorithm determines for given complex parameter c if the iteration f(z)=z*z+c diverges to infinity which is assumed if |z|>4.

Parameters determine a rectangle in the complex plane in which the Julia set is computed.

Parameters:
pixIter - pixel image with RGB integers which will be computed.

computeMandelbrot

public void computeMandelbrot(int[] pixIter,
                              int imageWidth,
                              int imageHeight,
                              int blockSize,
                              double xMin,
                              double yMin,
                              double xMax,
                              double yMax,
                              int maxIter)
Compute a Mandelbrot set in the given rectangle in the complex plane. Method returns a pixel array with given width and height. Adjusting the maximal number of iterations and blockSize allows to speed up the calculation at the cost of accuracy.

The algorithm determines for each z0 if the iteration f(z)=z*z+z0 diverges to infinity which is assumed if |z|>4.

Parameters determine a rectangle in the complex plane in which the Mandelbrot set is computed.

Parameters:
pixIter - pixel image with RGB integers which will be computed.

computeColors

public void computeColors(int[] pixArr,
                          int[] valArr,
                          int len,
                          int maxVal,
                          int colType)
Compute color array from an array of scalar integer values. Transfer function depends on choosen color type.


JavaView© v3.95.000

The software JavaView© is copyright protected. All Rights Reserved.