scenic.path
Class QuadraticBezierSegment

java.lang.Object
  extended by scenic.path.CurvedSegment
      extended by scenic.path.QuadraticBezierSegment
All Implemented Interfaces:
Segment

public class QuadraticBezierSegment
extends CurvedSegment

This class defines a quadratic Bezier curve. This class does not define the start point of the curve. The start point is the end point of the previous segment.


Constructor Summary
QuadraticBezierSegment(double x1, double y1, double x2, double y2)
          Creates a quadratic bezier segment with the given parameters.
 
Method Summary
 java.awt.geom.Point2D.Double calcPoint(double t, java.awt.geom.Point2D.Double position)
          Calculates the position of the segment at the given t value.
 void getBounds(java.awt.geom.AffineTransform transform, java.awt.Rectangle r, java.awt.geom.Point2D.Double position)
          Gets the bounds of this segment using the given transform.
 double getX1()
          Gets the x coordinate of second control point.
 double getX2()
          Gets the x coordinate of third control point.
 double getY1()
          Gets the y coordinate of second control point.
 double getY2()
          Gets the y coordinate of third control point.
 
Methods inherited from class scenic.path.CurvedSegment
walk
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

QuadraticBezierSegment

public QuadraticBezierSegment(double x1,
                              double y1,
                              double x2,
                              double y2)
Creates a quadratic bezier segment with the given parameters. The first control point is not defined here, it is defined by the end point of the previous segment.

Parameters:
x1 - x coordinate of second control point.
y1 - y coordinate of second control point.
x2 - x coordinate of third control point.
y2 - y coordinate of third control point.
Method Detail

getX1

public double getX1()
Gets the x coordinate of second control point.


getY1

public double getY1()
Gets the y coordinate of second control point.


getX2

public double getX2()
Gets the x coordinate of third control point.


getY2

public double getY2()
Gets the y coordinate of third control point.


calcPoint

public java.awt.geom.Point2D.Double calcPoint(double t,
                                              java.awt.geom.Point2D.Double position)
Description copied from class: CurvedSegment
Calculates the position of the segment at the given t value.

Specified by:
calcPoint in class CurvedSegment
Parameters:
t - the t value (must be in the range [0, 1]).
position - the previous position.
Returns:
the position.

getBounds

public void getBounds(java.awt.geom.AffineTransform transform,
                      java.awt.Rectangle r,
                      java.awt.geom.Point2D.Double position)
Description copied from interface: Segment
Gets the bounds of this segment using the given transform.

Parameters:
transform - the transform
r - the bounds.
position - the start position.