xmltool.gui
Class QCurve

java.lang.Object
  |
  +--java.awt.geom.QuadCurve2D
        |
        +--java.awt.geom.QuadCurve2D.Double
              |
              +--xmltool.gui.QCurve

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

Inner classes inherited from class java.awt.geom.QuadCurve2D
java.awt.geom.QuadCurve2D.Double, java.awt.geom.QuadCurve2D.Float
 
Field Summary
 boolean straight
          Flag indicating whether curve is actaully a straight line.
 
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.
 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.
 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).
 void setFirst(java.awt.geom.Point2D.Float delta)
          Reset first point in curve.
 void setLast(java.awt.geom.Point2D.Float delta)
          Reset last point in curve.
 
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, 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.
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

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

setLast

public void setLast(java.awt.geom.Point2D.Float delta)
Reset last point in curve.
Parameters:
delta - translation vector

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