|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object vmm.core.Decoration vmm.planecurve.parametric.NormalBundleDecoration
public class NormalBundleDecoration
A decoration that computes normal lines to points on a ParametricPlaneCurve and that can also show osculating circles, the evolute of the curve, and one or two parallel curves. (The points are those that are in the point array that defines the curve.) Either unit normals or normals whose length is given by the radius of curvature can be shown, and they can be shown at any number of points, including zero; this allows a partial normal bundle to be shown, so that the bundle can be built up gradually on the screen by adding one vector at a time. The decoration can also show several features that are computed based on the normal bundle: the evolute of the curve, an osculating circle at one point, and parallel curves.
Field Summary |
---|
Fields inherited from class vmm.core.Decoration |
---|
decorationNeedsRedraw |
Constructor Summary | |
---|---|
NormalBundleDecoration()
Creates a normal bundle with no associated curve. |
|
NormalBundleDecoration(PlaneCurveParametric curve)
Create a decoration that can be used on a specified curve. |
Method Summary | |
---|---|
void |
computeDrawData(View view,
boolean exhibitNeedsRedraw,
Transform previousLimits,
Transform newLimits)
Computes the normal vectors that are needed for drawing the array. |
void |
doDraw(java.awt.Graphics2D g,
View view,
Transform limits)
This method is called by the render method of the Exhbit class to draw the Decoration. |
PlaneCurveParametric |
getCurve()
Returns the curve pn which the decoration is shown. |
java.awt.Color |
getEvoluteColor()
Returns the color used for drawing the evolute. |
java.awt.Color |
getNormalsColor()
Retruns the color used for drawing normal vectors. |
java.awt.Color |
getOsculatingCircleColor()
Retruns the color used for drawing the osculating circle. |
int |
getOsculatingCircleIndex()
Tells the index of the point where an osculatting circle is drawn. |
java.awt.Color |
getParallelCurveColor()
Returns the color used for drawing the (first) parallel curve. |
java.awt.Color |
getParallelCurveColor2()
Returns the color used for drawing the second parallel curve. |
double |
getParallelCurveOffset()
Tells the distance between the curve and any parallel curves that are drawn. |
int |
getPointCount()
Gets the number of points on which normals appear. |
boolean |
getShowEvolute()
Tells whether the evolute is curve is drawn. |
boolean |
getShowTwoParallelCurves()
Tells whether two parallel curves are drawn, or just one. |
java.awt.geom.Line2D[] |
getUnitNormals()
Gets an array containing unit normals for all points on the curve. |
boolean |
getUseUnitNormals()
Tells whether unit normals are drawn, or normals of length equal to the radius of the osculatting circle. |
void |
setCurve(PlaneCurveParametric c)
Set the curve on which this decoration is shown. |
void |
setEvoluteColor(java.awt.Color color)
Set the color used for the evolute; the default is a medium dark green. |
void |
setNormalsColor(java.awt.Color color)
Set the color used for the normal lines; the default is red. |
void |
setOsculatingCircleColor(java.awt.Color color)
Set the color used for the osculating circle; the default is blue. |
void |
setOsculatingCircleIndex(int i)
Set the index of the point on the curve where an osculating circle is to be shown. |
void |
setOsculatingCircleIndex(int i,
boolean showEvoluteSoFar)
Set the index of the point on the curve where an osculating circle is to be shown. |
void |
setParallelCurveColor(java.awt.Color color)
Set the color used for the parallel curve; the default is a dark-ish cyan. |
void |
setParallelCurveColor2(java.awt.Color color)
Set the color used for the second parallel curve, if there is one; the default is a light red. |
void |
setParallelCurveOffset(double offset)
If the parallelCurveOffset is set to Double.NaN, then no parallel curve is drawn; this is the default. |
void |
setPointCount(int pointCt)
Sets the number of points on the curve at which normals appear. |
void |
setShowEvolute(boolean show)
If set to true, then the evolute curve will be drawn. |
void |
setShowTwoParallelCurves(boolean show)
If set to true, two parallel curves are drawn whenever the parallelCurveOffset property is set to a real number. |
void |
setUseUnitNormals(boolean useUnitNormals)
Set whether unit normals are drawn. |
Methods inherited from class vmm.core.Decoration |
---|
addChangeListener, addExtraXML, fireDecorationChangeEvent, forceRedraw, getLayer, readExtraXML, removeChangeListener, setLayer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public NormalBundleDecoration()
setCurve(PlaneCurveParametric)
. This constructor
exists mostly because it is required when the decoration is saved to an XML file.
public NormalBundleDecoration(PlaneCurveParametric curve)
curve
- The curve object to which the decoration applies. (A null value is OK but is unusual.)Method Detail |
---|
public PlaneCurveParametric getCurve()
public void setCurve(PlaneCurveParametric c)
computeDrawData
is called.)
public void setPointCount(int pointCt)
1+curve.getTResolution()
), it is not considered an
error, and all normals are drawn. Thus, setting the number of points
to a very large value will ensure that all normals are drawn.
public int getPointCount()
setPointCount(int)
public boolean getShowEvolute()
setShowEvolute(boolean)
public void setShowEvolute(boolean show)
public double getParallelCurveOffset()
setParallelCurveOffset(double)
public void setParallelCurveOffset(double offset)
setShowTwoParallelCurves(boolean)
public java.awt.Color getNormalsColor()
setNormalsColor(Color)
public void setNormalsColor(java.awt.Color color)
color
- The color to be used. If this is null, the default (red) is used.public java.awt.Color getEvoluteColor()
setEvoluteColor(Color)
public void setEvoluteColor(java.awt.Color color)
color
- The color to be used. If this is null, the default is used.public java.awt.Color getOsculatingCircleColor()
setOsculatingCircleColor(Color)
public void setOsculatingCircleColor(java.awt.Color color)
color
- The color to be used. If this is null, the default (blue) is used.public java.awt.Color getParallelCurveColor()
setParallelCurveColor(Color)
public void setParallelCurveColor(java.awt.Color color)
color
- The color to be used. If this is null, the default is used.public java.awt.Color getParallelCurveColor2()
setParallelCurveColor2(Color)
public void setParallelCurveColor2(java.awt.Color color)
color
- The color to be used. If this is null, the default is used.setShowTwoParallelCurves(boolean)
public boolean getShowTwoParallelCurves()
setShowTwoParallelCurves(boolean)
public void setShowTwoParallelCurves(boolean show)
setParallelCurveOffset(double)
public boolean getUseUnitNormals()
setUseUnitNormals(boolean)
public int getOsculatingCircleIndex()
setOsculatingCircleIndex(int)
public void setOsculatingCircleIndex(int i)
public void setOsculatingCircleIndex(int i, boolean showEvoluteSoFar)
public void setUseUnitNormals(boolean useUnitNormals)
public java.awt.geom.Line2D[] getUnitNormals()
public void computeDrawData(View view, boolean exhibitNeedsRedraw, Transform previousLimits, Transform newLimits)
computeDrawData
in class Decoration
view
- The View that is drawing the Exhibit; this object contains other
information that might be of use, such as the Display where the Exhibit is drawn
and the the Exhibit that is being drawn.exhibitNeedsRedraw
- This parameter is set to "true" when the Exhibit changes.
If it is true, then presumably the appearance of the Exhibit has
changed, so any cached data for this decoration should probably be recomputed.previousLimits
- The Transform object that was used the last time the Exhibit was
drawn. This can be null if the Exhibit is being drawn for the first time.newLimits
- The Transform object that is being used for this drawing of the Exhibit.
Transform objects contain data about the window in the xy-plane where the Exhibit is
being drawn and about the pixel coordinates on the drawing area.
The two Transform objects are provided just in case any cached data depends on the xy-window
or on the pixel coordinates.Exhibit.render(Graphics2D, View, Transform, ArrayList)
,
Decoration.doDraw(Graphics2D, View, Transform)
public void doDraw(java.awt.Graphics2D g, View view, Transform limits)
Decoration
render
method of the Exhbit class to draw the Decoration.
The computeDrawData
method is called by render
before it calls this method, so any cached
data should be valid by the time this method is called. (Note that subclasses of View and
Exhibit are not necessarily required to follow this pattern.)
The method in this class does nothing. Subclasses will ordinarily override this method to draw the Decoration.
doDraw
in class Decoration
g
- The graphics context where the Exhibit and its decorations are being drawn.view
- The View that is drawing the Exhibit; this object contains other
information that might be of use, such as the Display, if any, associated with
the View, and the the actual Exhibit that is being drawn.limits
- Contains information about the rectangular area in the
xy-plane that is being drawn and about the rectangle of pixels in the graphics
context where it is drawn. Note that at least for the top-level View class,
transform.getX() and transform.getY() can be assumed to be zero.Exhibit.render(Graphics2D, View, Transform, ArrayList)
,
Decoration.computeDrawData(View, boolean, Transform, Transform)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |