vmm.planecurve.parametric
Class TangentAndNormalDecoration

java.lang.Object
  extended by vmm.core.Decoration
      extended by vmm.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.


Field Summary
 
Fields inherited from class vmm.core.Decoration
decorationNeedsRedraw
 
Constructor Summary
TangentAndNormalDecoration()
          Creates a TangentAndNormalDecoration with no associated curve.
 
Method Summary
 void doDraw(java.awt.Graphics2D g, View view, Transform limits)
          Draw the decoration.
 PlaneCurveParametric getCurve()
          Returns the curve to which this decoration applies.
 double getT()
          Returns the t-value of the point (x(t),y(t)) where the decoration is drawn on the curve.
 void setCurve(PlaneCurveParametric c)
          Sets the curve to which this decoration applies.
 void setIndex(int tIndex)
          Set the t-value to be at one of the points that are used for drawing the curve.
 void setT(double t)
          Change the value of t where the decoration appears.
 
Methods inherited from class vmm.core.Decoration
addChangeListener, addExtraXML, computeDrawData, 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

TangentAndNormalDecoration

public TangentAndNormalDecoration()
Creates a TangentAndNormalDecoration with no associated curve. A curve can be set later with setCurve(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(java.awt.Graphics2D 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:
doDraw in class Decoration
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)