vmm.surface.implicit
Class SurfaceImplicit

java.lang.Object
  extended by vmm.core.Exhibit
      extended by vmm.core3D.Exhibit3D
          extended by vmm.surface.implicit.SurfaceImplicit
All Implemented Interfaces:
java.util.EventListener, javax.swing.event.ChangeListener, Decorateable, Parameterizable
Direct Known Subclasses:
BarthSextic, BoysSurface, CayleyCubic, ClebschCubic, CrossCap, CubeOktaeder, DecoCube, DupinCyclides, Genus2, Genus5, ImplicitCone, ImplicitEllipsoid, ImplicitHyperboloid1Sheet, ImplicitHyperboloid2Sheet, ImplicitParaboloid, Join2Tori, KummerQuartic, OrthoCircles, Pilz, Pretzel, SteinerRoman, Torus, UserSurfaceImplicit, WhitneyUmbrella

public abstract class SurfaceImplicit
extends Exhibit3D

Represents a surface in three-space defined as the level set of a real-valued function of x,y,z.


Nested Class Summary
 class SurfaceImplicit.ImplicitSurfaceView
           
 class SurfaceImplicit.Line3D
          A line in R^3: decribed by its direction (Vector3D direction;), a unit vector, and its intercept, (Vector3D intercept;), which is where the line intersects the plane through the origin normal to direction (this is also the point on the line that is nearest to the origin.
 
Field Summary
protected  RealParamAnimateable level
          The level of the heightFunction that define the surface.
protected  SurfaceImplicit.Line3D[] ListOfRandomLines
          This creates a fixed list of lines in R^3 that is random with respect to the kinematic measure on the subset of the space of all lines that meet the ball of radius searchRadius centered at the origin.
protected  Vector3D[] pointCloud
          A cloud of random points on the implicit surface.
protected  IntegerParam pointCloudCount
          The desired number of points in the cloud of random points that will show the implicit surface in Point Cloud Render Mode.
protected  IntegerParam randomLineCount
          The number of lines in the ListOfRandomLines used to form a point cloud by intersecting the implicit surface with these lines.
protected  RealParam rayTraceResolution
          Raytracing Resolution.
protected  double resolution
          This is the minimum spacing for testing along a line the sign of the height function prior to using regula falsi Default is 0.05, but certain surfaces (notably the Steiner Roman Surface) need a smaller value so as not to miss roots.
protected  RealParamAnimateable searchRadius
          Radius of the sphere centered at origin inside of which we search for points on the surface.
 
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
SurfaceImplicit()
           
 
Method Summary
protected  void computeDrawData3D(View3D view, boolean exhibitNeedsRedraw, Transform3D previousTransform3D, Transform3D newTransform3D)
          Recopmputes cached data, if necessary, for a 3D rendering of this exhibit.
 void cubicSolve(SurfaceImplicit.Line3D theLine, double[] theRoots)
           
protected  void doDraw3D(java.awt.Graphics2D g, View3D view, Transform3D transform)
          Draws this Exhibit in a 3D view.
 double FindNextRoot(SurfaceImplicit.Line3D theLine, double leftEnd, double rightEnd, double tolerance)
          This finds an approximate root of theFunction, on the interval [leftEnd,rightEnd] assuming that the sign of theFunction is not the same at both ends.
 View getDefaultView()
          Returns the default View of this Exhibit.
 BasicAnimator getMorphingAnimation(View view, int looping)
          This method is meant to produce a "morph" animation for this Exhibit, by animating any applicable animateable parameters.
protected  double heightAlongLine(double t, SurfaceImplicit.Line3D line)
          The heightFunction as a function of the signed distance t along line.
abstract  double heightFunction(double x, double y, double z)
          The implicit surface is defined as solutions of heightFuncton(x,y,z) = level .
 double heightFunction(Vector3D thePoint)
           
 void MakeListOfRandomLines()
           
 Vector3D normalToSurfaceAt(Vector3D P)
          Given a point P in R^3 and letting level = heightFunction(P), this gets the unit normal vector to the surface heightFunction = level at the point P by normalizing the gradient of the heightFunction at P.
 void quadraticSolve(SurfaceImplicit.Line3D theLine, double[] theRoots)
          This calculates the real roots (if any) of theEquation when it is a quadratic polynomial and stores them in theRoots
 void quarticSolve(SurfaceImplicit.Line3D theLine, double[] theRoots)
           
 void removeView(View view)
          Overridden to shut down the task manager that is used for parallelization, when there are no more views of the exhibit.
 double theFunction(double t, SurfaceImplicit.Line3D theLine)
          This is the function whose vanishing gives a parameter value t such that a point of the line with that parameter value lies on the implicit surface.
 
Methods inherited from class vmm.core3D.Exhibit3D
computeDrawDataHook, doDrawHook, getDefaultTransform, getDefaultViewpoint, getDefaultViewUp, setDefaultViewpoint, setDefaultViewUp
 
Methods inherited from class vmm.core.Exhibit
addChangeListener, addDecoration, addExtraXML, addParameter, addView, clearDecorations, computeDrawData, doDraw, fireExhibitChangeEvent, forceRedraw, getActionsForView, getAdditionalAnimationsForView, getAlternativeViews, getBuildAnimation, getCreateAnimation, getDecorations, getDefaultBackground, getDefaultForeground, getDefaultWindow, getFramesForMorphing, getName, getParameterByName, getParameters, getSettingsCommandsForView, getTitle, getUseFilmstripForMorphing, getViews, parameterChanged, readExtraXML, removeChangeListener, removeDecoration, removeParameter, 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

level

protected RealParamAnimateable level
The level of the heightFunction that define the surface. Default value is 0.0.


pointCloudCount

protected IntegerParam pointCloudCount
The desired number of points in the cloud of random points that will show the implicit surface in Point Cloud Render Mode. Should be less than MaxPointsInCloud. Default is 2000.


randomLineCount

protected IntegerParam randomLineCount
The number of lines in the ListOfRandomLines used to form a point cloud by intersecting the implicit surface with these lines. Default is 30000.


searchRadius

protected RealParamAnimateable searchRadius
Radius of the sphere centered at origin inside of which we search for points on the surface. Default value is 3.0.


rayTraceResolution

protected RealParam rayTraceResolution
Raytracing Resolution. Determines how finely the rays are divided to find points of intersection with surface. Default value is 0.05.


pointCloud

protected Vector3D[] pointCloud
A cloud of random points on the implicit surface. Constructed by intersecting lines from ListOfRandomLines with the surface


ListOfRandomLines

protected SurfaceImplicit.Line3D[] ListOfRandomLines
This creates a fixed list of lines in R^3 that is random with respect to the kinematic measure on the subset of the space of all lines that meet the ball of radius searchRadius centered at the origin.


resolution

protected double resolution
This is the minimum spacing for testing along a line the sign of the height function prior to using regula falsi Default is 0.05, but certain surfaces (notably the Steiner Roman Surface) need a smaller value so as not to miss roots.

Constructor Detail

SurfaceImplicit

public SurfaceImplicit()
Method Detail

heightFunction

public abstract double heightFunction(double x,
                                      double y,
                                      double z)
The implicit surface is defined as solutions of heightFuncton(x,y,z) = level .


heightFunction

public double heightFunction(Vector3D thePoint)

normalToSurfaceAt

public Vector3D normalToSurfaceAt(Vector3D P)
Given a point P in R^3 and letting level = heightFunction(P), this gets the unit normal vector to the surface heightFunction = level at the point P by normalizing the gradient of the heightFunction at P.


removeView

public void removeView(View view)
Overridden to shut down the task manager that is used for parallelization, when there are no more views of the exhibit.

Overrides:
removeView in class Exhibit
Parameters:
view - The view that is no longer displaying this exhibit.

MakeListOfRandomLines

public void MakeListOfRandomLines()

heightAlongLine

protected double heightAlongLine(double t,
                                 SurfaceImplicit.Line3D line)
The heightFunction as a function of the signed distance t along line.


theFunction

public double theFunction(double t,
                          SurfaceImplicit.Line3D theLine)
This is the function whose vanishing gives a parameter value t such that a point of the line with that parameter value lies on the implicit surface. That is, if theFunction(t, theLine) = 0, then theLine.parametricEquation(t) is a point of the surface


quadraticSolve

public void quadraticSolve(SurfaceImplicit.Line3D theLine,
                           double[] theRoots)
This calculates the real roots (if any) of theEquation when it is a quadratic polynomial and stores them in theRoots


cubicSolve

public void cubicSolve(SurfaceImplicit.Line3D theLine,
                       double[] theRoots)

quarticSolve

public void quarticSolve(SurfaceImplicit.Line3D theLine,
                         double[] theRoots)

FindNextRoot

public double FindNextRoot(SurfaceImplicit.Line3D theLine,
                           double leftEnd,
                           double rightEnd,
                           double tolerance)
This finds an approximate root of theFunction, on the interval [leftEnd,rightEnd] assuming that the sign of theFunction is not the same at both ends. It uses an optimized verison of RegulaFalsi due to Hermann Karcher.


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.

getDefaultView

public View getDefaultView()
Description copied from class: Exhibit3D
Returns the default View of this Exhibit. In the Exhibit3D class, the return value is a basic View3D.

Overrides:
getDefaultView in class Exhibit3D

getMorphingAnimation

public BasicAnimator getMorphingAnimation(View view,
                                          int looping)
Description copied from class: Exhibit
This method is meant to produce a "morph" animation for this Exhibit, by animating any applicable animateable parameters. The parameters can come from the Exhibit, from the View, and, in the case of a UserExhibit from the function parameters of the user exhibit. If there are no Animateable parameters, the return value is null. Otherwise, the return value is a BasicAnimator to which all of the Exhibit's Animateable parameters have been added. The number of frames in the animation returned by this method is the value of the "framesForMorphing" property. Subclasses might want to override this method to provide more complex morphing animations, but they should follow the same pattern. In particular, any parmeter values that are changed during the animation should be restored to their original values when the animation ends.

Overrides:
getMorphingAnimation in class Exhibit
Parameters:
view - The view that the animation will be shown in, if any. If the value is null, then the animation will not be associated with any particular view. In that case, the Morphing animation will animate the Exhibit in all Views in which it appears, since it operates by changing parameters of the exhibit. If the View is non-null, then only the specified View will receive changeEvents from the Exhibit while the morph is in progress.
looping - This must be one of the values BasicAnimator.ONCE, BasicAnimator.LOOP, or BasicAnimator.OSCILLATE. The value is passed, without any error checking, to the animation's setLooping method.
See Also:
TimerAnimation.setLooping(int), Exhibit.setFramesForMorphing(int)