vmm3d.planecurve.parametric
Class TangentAndNormalDecoration
- java.lang.Object
-
- vmm3d.core.Decoration
-
- vmm3d.planecurve.parametric.TangentAndNormalDecoration
-
public class TangentAndNormalDecoration extends Decoration
A decoration that appears as a red tangent line and a blue normal line on a parametric plane curve at a specified value of t. The length of the lines is 40 pixels. If the functions that define the curve or their derivatives are undefined at t, or if the length of the tangent vector is zero, then nothing is drawn.
-
-
Constructor Summary
Constructors Constructor and Description TangentAndNormalDecoration()Creates a TangentAndNormalDecoration with no associated curve.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddoDraw(org.freehep.graphics2d.VectorGraphics g, View view, Transform limits)Draw the decoration.PlaneCurveParametricgetCurve()Returns the curve to which this decoration applies.doublegetT()Returns the t-value of the point (x(t),y(t)) where the decoration is drawn on the curve.voidsetCurve(PlaneCurveParametric c)Sets the curve to which this decoration applies.voidsetIndex(int tIndex)Set the t-value to be at one of the points that are used for drawing the curve.voidsetT(double t)Change the value of t where the decoration appears.-
Methods inherited from class vmm3d.core.Decoration
addChangeListener, addExtraXML, computeDrawData, forceRedraw, getLayer, readExtraXML, removeChangeListener, setLayer
-
-
-
-
Constructor Detail
-
TangentAndNormalDecoration
public TangentAndNormalDecoration()
Creates a TangentAndNormalDecoration with no associated curve. A curve can be set later withsetCurve(PlaneCurveParametric), or it will be set implicitly when the decoration is drawn.
-
-
Method Detail
-
getCurve
public PlaneCurveParametric getCurve()
Returns the curve to which this decoration applies.
-
setCurve
public void setCurve(PlaneCurveParametric c)
Sets the curve to which this decoration applies.
-
setT
public void setT(double t)
Change the value of t where the decoration appears. This should be withing the range of t-values shown on the curve, although this is not checked.
-
getT
public double getT()
Returns the t-value of the point (x(t),y(t)) where the decoration is drawn on the curve. A value of Double.NaN means that the decoration is not drawn; this is the value when the decoration is first constructed.
-
setIndex
public void setIndex(int tIndex)
Set the t-value to be at one of the points that are used for drawing the curve. If the curve is null when this is called, it has no effect.- Parameters:
tIndex- An index into the array of t-values that the curve uses to generate the curve. The index should be in the legal range; if not, nothing is drawn. The range is from 0 to getCurve().getPointCount().
-
doDraw
public void doDraw(org.freehep.graphics2d.VectorGraphics g, View view, Transform limits)Draw the decoration. If the curve is null when this is called, then curve will be set to the exhibit displayed in the View, which should be of type PlaneCurveParameteric, if this decoration is being used correctly.- Overrides:
doDrawin classDecoration- Parameters:
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.- See Also:
Exhibit#render(Graphics2D, View, Transform, ArrayList),Decoration.computeDrawData(View, boolean, Transform, Transform)
-
-
DMelt 3.0 © DataMelt by jWork.ORG