jsim.util
Class QCurve

java.lang.Object
  extended by java.awt.geom.QuadCurve2D
      extended by java.awt.geom.QuadCurve2D.Double
          extended by jsim.util.QCurve
All Implemented Interfaces:
java.awt.Shape, java.io.Serializable, java.lang.Cloneable

public class QCurve
extends java.awt.geom.QuadCurve2D.Double
implements java.io.Serializable

The QCurve class enhances the QuadCurve.Double class (from the java.awt.geom package) by allowing entities to move along such quadratic curves.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.geom.QuadCurve2D
java.awt.geom.QuadCurve2D.Double, java.awt.geom.QuadCurve2D.Float
 
Field Summary
 java.lang.String alpha
          Scale parameter (e.g., mean)
 java.lang.String beta
          Shape parameter (e.g., variance)
 java.lang.String distribution
          Probability distribution
 boolean straight
          Flag indicating whether curve is actaully a straight line.
 java.lang.String stream
          Random number stream
protected static java.util.logging.Logger trc
          Tracing Messages
 
Fields inherited from class java.awt.geom.QuadCurve2D.Double
ctrlx, ctrly, x1, x2, y1, y2
 
Constructor Summary
QCurve()
          Construct an empty quad curve.
QCurve(double x1, double y1, double x2, double y2)
          Construct a straight line (degenerate quad curve).
QCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
          Construct a quad curve.
 
Method Summary
 java.awt.geom.Point2D.Double getControl()
          Return the control point of the quad curve.
 int getEdgeIndex()
           
 java.awt.geom.Point2D.Double getFirst()
          Return the first/start point of the quad curve.
 java.awt.geom.Point2D.Double getLast()
          Return the last/end point of the quad curve.
 java.lang.String getOutCondition()
           
 int getOutCondType()
           
 Node getStartNode()
           
 boolean isSame(double x, double y, double xe, double ye, double step)
          Are (x, y) and (xe, ye) essentially the same?
 java.awt.geom.Point2D.Double next(java.awt.geom.Point2D.Double current, double step)
          Return the next point on the quad curve (step units beyond current).
 boolean onQCurve(java.awt.geom.Point2D.Double selected)
           
 void ReconstructQCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
          ReConstruct a quad curve.
 void setEdgeIndex(int edgeIndex)
           
 void setFirst(java.awt.geom.Point2D.Float delta)
          Reset first point in curve.
 void setFirstFixed(java.awt.geom.Point2D.Float newPoint)
          Reset first point in curve to a fixed positon
 void setLast(java.awt.geom.Point2D.Float delta)
          Reset last point in curve.
 void setLastFixed(java.awt.geom.Point2D.Float newPoint)
          Reset last point in curve to a fixed position
 void setOutCondition(java.lang.String outCondition)
           
 void setOutCondType(int outCondType)
           
 void setStartNode(Node startNode)
           
 
Methods inherited from class java.awt.geom.QuadCurve2D.Double
getBounds2D, getCtrlPt, getCtrlX, getCtrlY, getP1, getP2, getX1, getX2, getY1, getY2, setCurve
 
Methods inherited from class java.awt.geom.QuadCurve2D
clone, contains, contains, contains, contains, getBounds, getFlatness, getFlatness, getFlatness, getFlatnessSq, getFlatnessSq, getFlatnessSq, getPathIterator, getPathIterator, intersects, intersects, setCurve, setCurve, setCurve, setCurve, solveQuadratic, solveQuadratic, subdivide, subdivide, subdivide
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

straight

public final boolean straight
Flag indicating whether curve is actaully a straight line.


distribution

public java.lang.String distribution
Probability distribution


alpha

public java.lang.String alpha
Scale parameter (e.g., mean)


beta

public java.lang.String beta
Shape parameter (e.g., variance)


stream

public java.lang.String stream
Random number stream


trc

protected static java.util.logging.Logger trc
Tracing Messages

Constructor Detail

QCurve

public QCurve()
Construct an empty quad curve.


QCurve

public QCurve(double x1,
              double y1,
              double x2,
              double y2)
Construct a straight line (degenerate quad curve).

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
x2 - x coordinate of end point
y2 - y coordinate of end point

QCurve

public QCurve(double x1,
              double y1,
              double ctrlx,
              double ctrly,
              double x2,
              double y2)
Construct a quad curve.

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
ctrlx - x coordinate of control point
ctrly - y coordinate of control point
x2 - x coordinate of end point
y2 - y coordinate of end point
Method Detail

ReconstructQCurve

public void ReconstructQCurve(double x1,
                              double y1,
                              double ctrlx,
                              double ctrly,
                              double x2,
                              double y2)
ReConstruct a quad curve.

Parameters:
x1 - x coordinate of start point
y1 - y coordinate of start point
ctrlx - x coordinate of control point
ctrly - y coordinate of control point
x2 - x coordinate of end point
y2 - y coordinate of end point

getFirst

public java.awt.geom.Point2D.Double getFirst()
Return the first/start point of the quad curve.

Returns:
Point2D.Double the first point

getControl

public java.awt.geom.Point2D.Double getControl()
Return the control point of the quad curve.

Returns:
Point2D.Double the control point

getLast

public java.awt.geom.Point2D.Double getLast()
Return the last/end point of the quad curve.

Returns:
Point2D.Double the last point

setFirst

public void setFirst(java.awt.geom.Point2D.Float delta)
Reset first point in curve.

Parameters:
delta - translation vector

setFirstFixed

public void setFirstFixed(java.awt.geom.Point2D.Float newPoint)
Reset first point in curve to a fixed positon

Parameters:
newPoint - point

setLast

public void setLast(java.awt.geom.Point2D.Float delta)
Reset last point in curve.

Parameters:
delta - translation vector

setLastFixed

public void setLastFixed(java.awt.geom.Point2D.Float newPoint)
Reset last point in curve to a fixed position

Parameters:
newPoint - point

isSame

public boolean isSame(double x,
                      double y,
                      double xe,
                      double ye,
                      double step)
Are (x, y) and (xe, ye) essentially the same?

Returns:
boolean true if essentially the same point

next

public java.awt.geom.Point2D.Double next(java.awt.geom.Point2D.Double current,
                                         double step)
Return the next point on the quad curve (step units beyond current). Return null if past end point.

Parameters:
current - the current point
step - distance to next point
Returns:
Point2D.Double the next point

onQCurve

public boolean onQCurve(java.awt.geom.Point2D.Double selected)

getEdgeIndex

public int getEdgeIndex()

setEdgeIndex

public void setEdgeIndex(int edgeIndex)

getStartNode

public Node getStartNode()

setStartNode

public void setStartNode(Node startNode)

setOutCondition

public void setOutCondition(java.lang.String outCondition)

getOutCondition

public java.lang.String getOutCondition()

setOutCondType

public void setOutCondType(int outCondType)

getOutCondType

public int getOutCondType()