vmm.conformalmap
Class ConformalMap

java.lang.Object
  extended by vmm.core.Exhibit
      extended by vmm.core3D.Exhibit3D
          extended by vmm.conformalmap.ConformalMap
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
Direct Known Subclasses:
CubicPolynomial, Exponentialfct, HyperbolicIsometry, Inverse, NonConformal, Sine, Squaring, UserConformalMap, Weierstrass_p, ZedPlus1OverZed

public abstract class ConformalMap
extends Exhibit3D

This class represents a map from a region in the complex plane to the complex plane. (Note: For most of the subclasses of this map, the map is conformal, but that is not in fact true in every case.)

Note that a ConformalMap by default uses a mouse task that lets the user switch between a view of the domain and a view of the image by shift-right-clicking. Ordinarily, the image is shown. The domain is shown when the user shift-right-clicks until the mouse is released.


Nested Class Summary
static class ConformalMap.ConformalMapView
          A class that defines the default view for a ConformalMap.
 
Field Summary
protected  Complex[][] argumentGrid
          Stores all the points in the grid that covers the domain of the function.
static int CARTESIAN
          Code for using a cartesian grid on the domain of the function.
static int FRACTIONAL
          Code for the function (1-z)/(1+z) as one of the possible functions that can be precomposed or postcomposed with a map.
protected  ActionRadioGroup gridTypeSelect
           
static int IDENTITY
          Code for the identity function as one of the possible functions that can be precomposed or postcomposed with a map.
static int INVERSION
          Code for the function 1/z as one of the possible functions that can be precomposed or postcomposed with a map.
protected static int POINTS_PER_INTERVAL
          The actual resolutions in the u- and v- directions are obtained by multiplying the nominal resolutions give by the ures and vres parameters by this value.
protected  int pointsOnCircleFigure
          The number of points to be used for a ConformalMapFigure with a circle shape, when the user adds a circle to the exhibit.
protected  int pointsOnLineFigure
          The number of points to be used for a ConformalMapFigure that is a line, when the user adds a line to the exhibit.
protected  int pointsOnLineSegmentFigure
          The number of points to be used for a ConformalMapFigure that is a line segment, when the user adds a line to the exhibit.
static int POLAR
          Code for using a polar grid on the domain of the function.
static int POLARCONFORMAL
          Code for using a conformal polar grid on the domain of the function.
static int SQRROOT
          Code for the square root function as one of the possible functions that can be precomposed or postcomposed with a map.
protected  RealParamAnimateable umax
          Maximum u-value for the domain of the function.
protected  RealParamAnimateable umin
          Minimum u-value for the domain of the function.
protected  IntegerParam ures
          Number of grid lines in the grid in the u direction.
protected  Complex[][] valueGrid
          Stores the images of the points in the argumentGrid.
protected  RealParamAnimateable vmax
          Maximum v-value for the domain of the function.
protected  RealParamAnimateable vmin
          Minimum v-value for the domain of the function.
protected  IntegerParam vres
          Number of grid lines in the grid in the v direction.
 
Fields inherited from class vmm.core3D.Exhibit3D
defaultViewpoint, defaultViewUp, previousTransform3D
 
Fields inherited from class vmm.core.Exhibit
decorations, exhibitNeedsRedraw, isMorphing, morphingView, parameters, previousTransform
 
Constructor Summary
ConformalMap()
           
 
Method Summary
 void addExtraXML(org.w3c.dom.Document containingDocument, org.w3c.dom.Element exhibitElement)
          This method is called when an XML representation of this exhibit is being constructed by the SaveAndRestore class to give the exhibit a chance to write any extra infomation that is not saved by default.
protected  Complex composedFunction(Complex z)
          Computes the output value for a given input argument, taking into account the precomposed and postcomposed functions.
protected  void computeDrawData3D(View3D view, boolean exhibitNeedsRedraw, Transform3D previousTransform3D, Transform3D newTransform3D)
          Recopmputes cached data, if necessary, for a 3D rendering of this exhibit.
protected  void doDraw3D(java.awt.Graphics2D g, View3D view, Transform3D transform)
          Draws this Exhibit in a 3D view.
protected abstract  Complex function(Complex argument)
          The function that is to be graphed, to be supplied by any concrete subclass.
 ActionList getActionsForView(View view)
          This method returns a list of ActionItem that can be applied to a View that contains this Exhibit.
 Animation getCreateAnimation(View view)
          Returns an animation that shows the domain grid for a short time, then switches to the image.
 View getDefaultView()
          Overridden to return a view of type ConformalMapView, defined by a nested class in this class.
 double[] getDefaultWindow2D()
          Returns an array of four numbers representing the default 2D window.
 int getGridType()
          Gets the code number for the type of grid that is used on the domain of the function.
 int getPostCompFunction()
          Gets the code number for the function that is postcomposed with the basic map.
 int getPreCompFunction()
          Gets the code number for the function that is precomposed with the basic map.
protected  Complex gridMap(double u, double v)
          Finds the input grid point corresponding to (u,v).
 void readExtraXML(org.w3c.dom.Element exhibitInfo)
          This method is called when this exhibit is being reconstructed from an XML representation by the SaveAndRestore class.
protected  void resetGridType(int gridType)
          For use in a subclass where the gridType has to be modified without changing the values of umin, umax, vmin, vmax.
 void setDefaultWindow2D(double[] defaultWindow2D)
          Sets the default 2D window for this exhibit.
 void setDefaultWindow2D(double xmin, double xmax, double ymin, double ymax)
          Sets the default 2D window for this exhibit.
 void setGridType(int gridType)
          Sets the type of grid that is used on the domain of the map.
 void setPostCompFunction(int postCompFunction)
          Sets the function that is postcomposed with the basic map.
 void setPreCompFunction(int preCompFunction)
          Sets the function that is precomposed with the basic map.
 
Methods inherited from class vmm.core3D.Exhibit3D
computeDrawDataHook, doDrawHook, getDefaultTransform, getDefaultViewpoint, getDefaultViewUp, setDefaultViewpoint, setDefaultViewUp
 
Methods inherited from class vmm.core.Exhibit
addChangeListener, addDecoration, addParameter, addView, clearDecorations, computeDrawData, doDraw, fireExhibitChangeEvent, forceRedraw, getAdditionalAnimationsForView, getAlternativeViews, getBuildAnimation, getDecorations, getDefaultBackground, getDefaultForeground, getDefaultWindow, getFramesForMorphing, getMorphingAnimation, getName, getParameterByName, getParameters, getSettingsCommandsForView, getTitle, getUseFilmstripForMorphing, getViews, parameterChanged, removeChangeListener, removeDecoration, removeParameter, removeView, render, setDefaultBackground, setDefaultForeground, setDefaultWindow, setDefaultWindow, setFramesForMorphing, setName, setUseFilmstripForMorphing, stateChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IDENTITY

public static final int IDENTITY
Code for the identity function as one of the possible functions that can be precomposed or postcomposed with a map.

See Also:
Constant Field Values

INVERSION

public static final int INVERSION
Code for the function 1/z as one of the possible functions that can be precomposed or postcomposed with a map.

See Also:
Constant Field Values

FRACTIONAL

public static final int FRACTIONAL
Code for the function (1-z)/(1+z) as one of the possible functions that can be precomposed or postcomposed with a map.

See Also:
Constant Field Values

SQRROOT

public static final int SQRROOT
Code for the square root function as one of the possible functions that can be precomposed or postcomposed with a map.

See Also:
Constant Field Values

CARTESIAN

public static final int CARTESIAN
Code for using a cartesian grid on the domain of the function.

See Also:
Constant Field Values

POLAR

public static final int POLAR
Code for using a polar grid on the domain of the function.

See Also:
Constant Field Values

POLARCONFORMAL

public static final int POLARCONFORMAL
Code for using a conformal polar grid on the domain of the function.

See Also:
Constant Field Values

umin

protected RealParamAnimateable umin
Minimum u-value for the domain of the function.


umax

protected RealParamAnimateable umax
Maximum u-value for the domain of the function.


vmin

protected RealParamAnimateable vmin
Minimum v-value for the domain of the function.


vmax

protected RealParamAnimateable vmax
Maximum v-value for the domain of the function.


ures

protected IntegerParam ures
Number of grid lines in the grid in the u direction.


vres

protected IntegerParam vres
Number of grid lines in the grid in the v direction.


POINTS_PER_INTERVAL

protected static final int POINTS_PER_INTERVAL
The actual resolutions in the u- and v- directions are obtained by multiplying the nominal resolutions give by the ures and vres parameters by this value. That is, there are this many points between each pair of neighboring grid lines.

See Also:
Constant Field Values

pointsOnCircleFigure

protected int pointsOnCircleFigure
The number of points to be used for a ConformalMapFigure with a circle shape, when the user adds a circle to the exhibit. This is set here eqaul to the default from ConformalMapFigure, but can be reset in a subclass.


pointsOnLineFigure

protected int pointsOnLineFigure
The number of points to be used for a ConformalMapFigure that is a line, when the user adds a line to the exhibit. This is set here eqaul to the default from ConformalMapFigure, but can be reset in a subclass.


pointsOnLineSegmentFigure

protected int pointsOnLineSegmentFigure
The number of points to be used for a ConformalMapFigure that is a line segment, when the user adds a line to the exhibit. This is set here eqaul to the default from ConformalMapFigure, but can be reset in a subclass.


argumentGrid

protected Complex[][] argumentGrid
Stores all the points in the grid that covers the domain of the function. This is part of the basic drawing data. It is computed in the computeDrawData3D method and is used in the doDraw3D method.


valueGrid

protected Complex[][] valueGrid
Stores the images of the points in the argumentGrid. This is part of the basic drawing data. It is computed in the computeDrawData3D method and is used in the doDraw3D method.


gridTypeSelect

protected ActionRadioGroup gridTypeSelect
Constructor Detail

ConformalMap

public ConformalMap()
Method Detail

function

protected abstract Complex function(Complex argument)
The function that is to be graphed, to be supplied by any concrete subclass.


getPostCompFunction

public int getPostCompFunction()
Gets the code number for the function that is postcomposed with the basic map.

See Also:
setPostCompFunction(int)

setPostCompFunction

public void setPostCompFunction(int postCompFunction)
Sets the function that is postcomposed with the basic map. The value should be one of the constants IDENTITY, INVERSION, FRACTIONAL, or SQRROOT. The default is IDENTITY. (This property is managed by an ActionRadioGroup, although it could also be set directly.)


getPreCompFunction

public int getPreCompFunction()
Gets the code number for the function that is precomposed with the basic map.

See Also:
setPreCompFunction(int)

setPreCompFunction

public void setPreCompFunction(int preCompFunction)
Sets the function that is precomposed with the basic map. The value should be one of the constants IDENTITY, INVERSION, FRACTIONAL, or SQRROOT. The default is IDENTITY. (This property is managed by an ActionRadioGroup, although it could also be set directly.)


getGridType

public int getGridType()
Gets the code number for the type of grid that is used on the domain of the function.

See Also:
setGridType(int)

setGridType

public void setGridType(int gridType)
Sets the type of grid that is used on the domain of the map. The value should be one of the constants CARTESIAN, POLAR, or POLARCONFORMAL; other values are ignored. The default is CARTESIAN. (This property is managed by an ActionRadioGroup, although it could also be set directly.) This method changes the values of umin, umax, vmin, vmax, ures, and vres to match the new grid type. Separate values for each grid type are stored for these parameters. When this method is used to change the grid type, the values of the paramters are set to the values saved for that grid type.


resetGridType

protected void resetGridType(int gridType)
For use in a subclass where the gridType has to be modified without changing the values of umin, umax, vmin, vmax. The sets the value of the gridType property variable without making any other changes. It does change the setting of gridTypeSelect to match the new grid type. (This was introduced specifically for use in UserConformalMap.


composedFunction

protected Complex composedFunction(Complex z)
Computes the output value for a given input argument, taking into account the precomposed and postcomposed functions. This is the function that is actually displayed.


getDefaultWindow2D

public double[] getDefaultWindow2D()
Returns an array of four numbers representing the default 2D window.

See Also:
setDefaultWindow2D(double[])

setDefaultWindow2D

public void setDefaultWindow2D(double[] defaultWindow2D)
Sets the default 2D window for this exhibit. This is the window that is used when the view is in 2D mode, that is, when the domain is displayed or when the image is displayed in the complex plane. It is not used when the image is displayed on the Riemann Sphere.

Parameters:
defaultWindow2D - an array containing the default window, xmin, xmax, ymin, and ymax. If this parameter is null, nothing is done. If the array has fewer than four elements, an IllegalArgumentException is thrown.

setDefaultWindow2D

public void setDefaultWindow2D(double xmin,
                               double xmax,
                               double ymin,
                               double ymax)
Sets the default 2D window for this exhibit. This is the window that is used when the view is in 2D mode, that is, when the domain is displayed or when the image is displayed in the complex plane. It is not used when the image is displayed on the Riemann Sphere. This convenience method just calls setDefaultWindow2D(double[]).


gridMap

protected Complex gridMap(double u,
                          double v)
Finds the input grid point corresponding to (u,v). For a Cartesian grid, this is just (u,v) itself. For a polar grid, it is (u*cos(v),u*sin(v)). For a polar conformal grid, it is (exp(u)*cos(v),exp(u)*sin(v)) which is the same as exp(u+iv).


computeDrawData3D

protected void computeDrawData3D(View3D view,
                                 boolean exhibitNeedsRedraw,
                                 Transform3D previousTransform3D,
                                 Transform3D newTransform3D)
Description copied from class: Exhibit3D
Recopmputes cached data, if necessary, for a 3D rendering of this exhibit. The method in the Exhibit3D class does nothing. Subclasses should override this method as appropriate. Note that this method is called only if the Exhibit is being rendered in a View3D. Exhibits that have both two and three dimensional renderings can also override Exhibit.computeDrawData(View, boolean, Transform, Transform) to say what should be drawn in a 2D view.

Overrides:
computeDrawData3D in class Exhibit3D
Parameters:
view - the 3D View where the Exhibit is about to be drawn.
exhibitNeedsRedraw - if true, then something about the Exhibit has changed that probably requires recomputation of cached data. For example, this is set to true when one of the Parameters of the Exhibit has changed since the previous redraw.
previousTransform3D - the Transform3D that was used the last time this exhibit was drawn. This can be null, if this is the first time that the Exhibit is being drawn (in 3D).
newTransform3D - the transform that will be used to draw the Exhibit during the current drawing operation. This parameter and the previousTransform3D parameter are provided so that the Exhbit can detect those rare cases where cached data exists that depends on the transform. Most Exhibits will just ignore the transform parameters.

doDraw3D

protected void doDraw3D(java.awt.Graphics2D g,
                        View3D view,
                        Transform3D transform)
Description copied from class: Exhibit3D
Draws this Exhibit in a 3D view. The method in the Exhibit3D class does nothing. Subclasses should override this method to do the actual drawing. When this method is called, Exhibit3D.computeDrawData3D(View3D, boolean, Transform3D, Transform3D) has already been called, so that any cached data should be correct. Note that this method is called only if the Exhibit is being drawn in a View3D. Exhibits that have both two and three dimensional renderings should also override Exhibit.doDraw(Graphics2D, View, Transform).

When drawing a 3D exhibit, you are strongly advised to use the drawing routines supplied by the View3D and View3DLit classes. These routines will automatically produce the correct results in stereo views -- the same is not true about direct drawing to the graphics context.

Overrides:
doDraw3D in class Exhibit3D
Parameters:
g - the graphics context where the exhibit is being drawn.
view - The View3D in which the exhibit is being drawn. In general, it is advisable to use the view for all drawing operations.
transform - The transform that is being used to draw the exhibit.

getCreateAnimation

public Animation getCreateAnimation(View view)
Returns an animation that shows the domain grid for a short time, then switches to the image. (However, no create animation is shown in "stereograph" views, since it would involve changing the window size back and forth.)

Overrides:
getCreateAnimation in class Exhibit
Parameters:
view - A View that is displaying this Exhibit. The animation, if any, that is returned by this method will be installed in the View's display. If the view is null, than a creation animation that can run independently of a view could be returned.
Returns:
A creation animation for the given View of this Exhibit. The return value can be null to indicate that no creation animation is to be run.

getDefaultView

public View getDefaultView()
Overridden to return a view of type ConformalMapView, defined by a nested class in this class.

Overrides:
getDefaultView in class Exhibit3D

getActionsForView

public ActionList getActionsForView(View view)
Description copied from class: Exhibit
This method returns a list of ActionItem that can be applied to a View that contains this Exhibit. If the view parameter is null, it should return actions that are appropriate in any View. View is presumably one that is displaying this Exhibit.

The items in the returned list must implement the ActionItem interface and generally belong to one of the classes AbstractActionVMM, ToggleAction, ActionRadioGroup, or ActionList. Null items represent separators.

In this top-level Exhibit class, the return value is a list that contains one object of type AbstractActionVMM. The action represents the "Create" command, which is meant to run the "create animation" of the Exhibit.

In general, when overriding this method, subclasses should call "super.getActionsForView()" to obtain a list of actions from the superclass. It can then add additional actions or remove or disable actions that are in the list from the superclass.

Overrides:
getActionsForView in class Exhibit

addExtraXML

public void addExtraXML(org.w3c.dom.Document containingDocument,
                        org.w3c.dom.Element exhibitElement)
Description copied from class: Exhibit
This method is called when an XML representation of this exhibit is being constructed by the SaveAndRestore class to give the exhibit a chance to write any extra infomation that is not saved by default. Any Parameters associated with the exhibit are saved automatically. Note that Decorations associated with the exhibit are NOT saved automatically UNLESS the decoration class is marked with a VMMSave annotation. Property variables will also be saved automatically IF they are marked with VMMSave annotations.

The method in this top level class does nothing.

When a subclass overrides this method, it should ordinarily start by calling super.addExtraXML(containingDocument,exhibitElement) to make sure that information from the superclass is saved.

Overrides:
addExtraXML in class Exhibit
Parameters:
containingDocument - The overall XML document that contains the exhibit Element that is being created. This parameter is necessary because it is needed to create any nested subelements that are to be added to the exhibit element.
exhibitElement - The XML element that is being constructed. This element already exists; the purpose of this method to add any extra information that would be needed to reconstruct this exhibit object from the XML represenation.
See Also:
Exhibit.readExtraXML(Element)

readExtraXML

public void readExtraXML(org.w3c.dom.Element exhibitInfo)
                  throws java.io.IOException
Description copied from class: Exhibit
This method is called when this exhibit is being reconstructed from an XML representation by the SaveAndRestore class. The Exhibit object has already been created, and default information (parameters and decorations) have been retrieved. This method is responsible for retrieving any data that was written by Exhibit.addExtraXML(Document, Element), except that properties written with SaveAndRestore.addProperty(Object, String, Document, Element) are retrieved automatically, and decorations saved with SaveAndRestore.addDecorationElement(Document, Element, Decoration) are retrieved automatically. The method in this top-level Exhibit class does nothing.

In general, when a subclass overrides this method, it should be sure to call super.readExtraXML(exhibitInfo).

Overrides:
readExtraXML in class Exhibit
Parameters:
exhibitInfo - The <exhibit> element from the XML file that contains the information about this exhibit. Some methods from the SaveAndRestore class might be useful for getting the data.
Throws:
java.io.IOException - If an error is found, an exception of type IOException should be thrown. This will abort the whole processing of the XML file.
See Also:
Exhibit.addExtraXML(Document, Element)