| java.lang.Object java.awt.geom.QuadCurve2D
QuadCurve2D | abstract public class QuadCurve2D implements Shape,Cloneable(Code) | | The QuadCurve2D class defines a quadratic parametric curve
segment in
(x,y) coordinate space.
This class is only the abstract superclass for all objects that
store a 2D quadratic curve segment.
The actual storage representation of the coordinates is left to
the subclass.
version: 1.40, 05/05/07 author: Jim Graham since: 1.2 |
Constructor Summary | |
protected | QuadCurve2D() This is an abstract class that cannot be instantiated directly. |
Method Summary | |
public Object | clone() Creates a new object of the same class and with the same contents
as this object. | public boolean | contains(double x, double y) | public boolean | contains(Point2D p) | public boolean | contains(double x, double y, double w, double h) | public boolean | contains(Rectangle2D r) | public Rectangle | getBounds() | abstract public Point2D | getCtrlPt() Returns the control point. | abstract public double | getCtrlX() Returns the X coordinate of the control point in
double precision. | abstract public double | getCtrlY() Returns the Y coordinate of the control point in
double precision. | public static double | getFlatness(double x1, double y1, double ctrlx, double ctrly, double x2, double y2) Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the indicated control points.
Parameters: x1 - the X coordinate of the start point Parameters: y1 - the Y coordinate of the start point Parameters: ctrlx - the X coordinate of the control point Parameters: ctrly - the Y coordinate of the control point Parameters: x2 - the X coordinate of the end point Parameters: y2 - the Y coordinate of the end point the flatness of the quadratic curve defined by the specified coordinates. | public static double | getFlatness(double coords, int offset) Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the control points stored in the
indicated array at the indicated index. | public double | getFlatness() Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of this
QuadCurve2D . | public static double | getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, double y2) Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the indicated control points. | public static double | getFlatnessSq(double coords, int offset) Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the control points stored in the
indicated array at the indicated index. | public double | getFlatnessSq() Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of this
QuadCurve2D . | abstract public Point2D | getP1() Returns the start point. | abstract public Point2D | getP2() Returns the end point. | public PathIterator | getPathIterator(AffineTransform at) Returns an iteration object that defines the boundary of the
shape of this QuadCurve2D . | public PathIterator | getPathIterator(AffineTransform at, double flatness) Returns an iteration object that defines the boundary of the
flattened shape of this QuadCurve2D .
The iterator for this class is not multi-threaded safe,
which means that this QuadCurve2D class does not
guarantee that modifications to the geometry of this
QuadCurve2D object do not affect any iterations of
that geometry that are already in process. | abstract public double | getX1() Returns the X coordinate of the start point in
double in precision. | abstract public double | getX2() Returns the X coordinate of the end point in
double precision. | abstract public double | getY1() Returns the Y coordinate of the start point in
double precision. | abstract public double | getY2() Returns the Y coordinate of the end point in
double precision. | public boolean | intersects(double x, double y, double w, double h) | public boolean | intersects(Rectangle2D r) | abstract public void | setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2) Sets the location of the end points and control point of this curve
to the specified double coordinates. | public void | setCurve(double[] coords, int offset) Sets the location of the end points and control points of this
QuadCurve2D to the double coordinates at
the specified offset in the specified array. | public void | setCurve(Point2D p1, Point2D cp, Point2D p2) Sets the location of the end points and control point of this
QuadCurve2D to the specified Point2D
coordinates. | public void | setCurve(Point2D[] pts, int offset) Sets the location of the end points and control points of this
QuadCurve2D to the coordinates of the
Point2D objects at the specified offset in
the specified array. | public void | setCurve(QuadCurve2D c) Sets the location of the end points and control point of this
QuadCurve2D to the same as those in the specified
QuadCurve2D . | public static int | solveQuadratic(double eqn) Solves the quadratic whose coefficients are in the eqn
array and places the non-complex roots back into the same array,
returning the number of roots. | public static int | solveQuadratic(double eqn, double res) Solves the quadratic whose coefficients are in the eqn
array and places the non-complex roots into the res
array, returning the number of roots. | public void | subdivide(QuadCurve2D left, QuadCurve2D right) Subdivides this QuadCurve2D and stores the resulting
two subdivided curves into the left and
right curve parameters. | public static void | subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right) Subdivides the quadratic curve specified by the src
parameter and stores the resulting two subdivided curves into the
left and right curve parameters. | public static void | subdivide(double src, int srcoff, double left, int leftoff, double right, int rightoff) Subdivides the quadratic curve specified by the coordinates
stored in the src array at indices
srcoff through srcoff + 5
and stores the resulting two subdivided curves into the two
result arrays at the corresponding indices.
Either or both of the left and right
arrays can be null or a reference to the same array
and offset as the src array.
Note that the last point in the first subdivided curve is the
same as the first point in the second subdivided curve. |
QuadCurve2D | protected QuadCurve2D()(Code) | | This is an abstract class that cannot be instantiated directly.
Type-specific implementation subclasses are available for
instantiation and provide a number of formats for storing
the information necessary to satisfy the various accessor
methods below.
See Also: java.awt.geom.QuadCurve2D.Float See Also: java.awt.geom.QuadCurve2D.Double since: 1.2 |
clone | public Object clone()(Code) | | Creates a new object of the same class and with the same contents
as this object.
a clone of this instance. exception: OutOfMemoryError - if there is not enough memory. See Also: java.lang.Cloneable since: 1.2 |
contains | public boolean contains(double x, double y)(Code) | | since: 1.2 |
contains | public boolean contains(double x, double y, double w, double h)(Code) | | since: 1.2 |
getCtrlPt | abstract public Point2D getCtrlPt()(Code) | | Returns the control point.
a Point2D that is the control point of thisPoint2D . since: 1.2 |
getCtrlX | abstract public double getCtrlX()(Code) | | Returns the X coordinate of the control point in
double precision.
X coordinate the control point since: 1.2 |
getCtrlY | abstract public double getCtrlY()(Code) | | Returns the Y coordinate of the control point in
double precision.
the Y coordinate of the control point. since: 1.2 |
getFlatness | public static double getFlatness(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)(Code) | | Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the indicated control points.
Parameters: x1 - the X coordinate of the start point Parameters: y1 - the Y coordinate of the start point Parameters: ctrlx - the X coordinate of the control point Parameters: ctrly - the Y coordinate of the control point Parameters: x2 - the X coordinate of the end point Parameters: y2 - the Y coordinate of the end point the flatness of the quadratic curve defined by the specified coordinates. since: 1.2 |
getFlatness | public static double getFlatness(double coords, int offset)(Code) | | Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the control points stored in the
indicated array at the indicated index.
Parameters: coords - an array containing coordinate values Parameters: offset - the index into coords from which tostart getting the coordinate values the flatness of a quadratic curve defined by the specified array at the specified offset. since: 1.2 |
getFlatness | public double getFlatness()(Code) | | Returns the flatness, or maximum distance of a
control point from the line connecting the end points, of this
QuadCurve2D .
the flatness of this QuadCurve2D . since: 1.2 |
getFlatnessSq | public static double getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)(Code) | | Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the indicated control points.
Parameters: x1 - the X coordinate of the start point Parameters: y1 - the Y coordinate of the start point Parameters: ctrlx - the X coordinate of the control point Parameters: ctrly - the Y coordinate of the control point Parameters: x2 - the X coordinate of the end point Parameters: y2 - the Y coordinate of the end point the square of the flatness of the quadratic curvedefined by the specified coordinates. since: 1.2 |
getFlatnessSq | public static double getFlatnessSq(double coords, int offset)(Code) | | Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of the
quadratic curve specified by the control points stored in the
indicated array at the indicated index.
Parameters: coords - an array containing coordinate values Parameters: offset - the index into coords from which toto start getting the values from the array the flatness of the quadratic curve that is defined by thevalues in the specified array at the specified index. since: 1.2 |
getFlatnessSq | public double getFlatnessSq()(Code) | | Returns the square of the flatness, or maximum distance of a
control point from the line connecting the end points, of this
QuadCurve2D .
the square of the flatness of thisQuadCurve2D . since: 1.2 |
getP1 | abstract public Point2D getP1()(Code) | | Returns the start point.
a Point2D that is the start point of thisQuadCurve2D . since: 1.2 |
getP2 | abstract public Point2D getP2()(Code) | | Returns the end point.
a Point object that is the end pointof this Point2D . since: 1.2 |
getPathIterator | public PathIterator getPathIterator(AffineTransform at)(Code) | | Returns an iteration object that defines the boundary of the
shape of this QuadCurve2D .
The iterator for this class is not multi-threaded safe,
which means that this QuadCurve2D class does not
guarantee that modifications to the geometry of this
QuadCurve2D object do not affect any iterations of
that geometry that are already in process.
Parameters: at - an optional AffineTransform to apply to theshape boundary a PathIterator object that defines the boundaryof the shape. since: 1.2 |
getPathIterator | public PathIterator getPathIterator(AffineTransform at, double flatness)(Code) | | Returns an iteration object that defines the boundary of the
flattened shape of this QuadCurve2D .
The iterator for this class is not multi-threaded safe,
which means that this QuadCurve2D class does not
guarantee that modifications to the geometry of this
QuadCurve2D object do not affect any iterations of
that geometry that are already in process.
Parameters: at - an optional AffineTransform to applyto the boundary of the shape Parameters: flatness - the maximum distance that the control points for a subdivided curve can be with respect to a line connectingthe end points of this curve before this curve isreplaced by a straight line connecting the end points. a PathIterator object that defines the flattened boundary of the shape. since: 1.2 |
getX1 | abstract public double getX1()(Code) | | Returns the X coordinate of the start point in
double in precision.
the X coordinate of the start point. since: 1.2 |
getX2 | abstract public double getX2()(Code) | | Returns the X coordinate of the end point in
double precision.
the x coordiante of the end point. since: 1.2 |
getY1 | abstract public double getY1()(Code) | | Returns the Y coordinate of the start point in
double precision.
the Y coordinate of the start point. since: 1.2 |
getY2 | abstract public double getY2()(Code) | | Returns the Y coordinate of the end point in
double precision.
the Y coordinate of the end point. since: 1.2 |
intersects | public boolean intersects(double x, double y, double w, double h)(Code) | | since: 1.2 |
setCurve | abstract public void setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)(Code) | | Sets the location of the end points and control point of this curve
to the specified double coordinates.
Parameters: x1 - the X coordinate of the start point Parameters: y1 - the Y coordinate of the start point Parameters: ctrlx - the X coordinate of the control point Parameters: ctrly - the Y coordinate of the control point Parameters: x2 - the X coordinate of the end point Parameters: y2 - the Y coordinate of the end point since: 1.2 |
setCurve | public void setCurve(double[] coords, int offset)(Code) | | Sets the location of the end points and control points of this
QuadCurve2D to the double coordinates at
the specified offset in the specified array.
Parameters: coords - the array containing coordinate values Parameters: offset - the index into the array from which to startgetting the coordinate values and assigning them to thisQuadCurve2D since: 1.2 |
setCurve | public void setCurve(Point2D p1, Point2D cp, Point2D p2)(Code) | | Sets the location of the end points and control point of this
QuadCurve2D to the specified Point2D
coordinates.
Parameters: p1 - the start point Parameters: cp - the control point Parameters: p2 - the end point since: 1.2 |
setCurve | public void setCurve(Point2D[] pts, int offset)(Code) | | Sets the location of the end points and control points of this
QuadCurve2D to the coordinates of the
Point2D objects at the specified offset in
the specified array.
Parameters: pts - an array containing Point2D that definecoordinate values Parameters: offset - the index into pts from which to startgetting the coordinate values and assigning them to thisQuadCurve2D since: 1.2 |
setCurve | public void setCurve(QuadCurve2D c)(Code) | | Sets the location of the end points and control point of this
QuadCurve2D to the same as those in the specified
QuadCurve2D .
Parameters: c - the specified QuadCurve2D since: 1.2 |
solveQuadratic | public static int solveQuadratic(double eqn)(Code) | | Solves the quadratic whose coefficients are in the eqn
array and places the non-complex roots back into the same array,
returning the number of roots. The quadratic solved is represented
by the equation:
eqn = {C, B, A};
ax^2 + bx + c = 0
A return value of -1 is used to distinguish a constant
equation, which might be always 0 or never 0, from an equation that
has no zeroes.
Parameters: eqn - the array that contains the quadratic coefficients the number of roots, or -1 if the equation isa constant since: 1.2 |
solveQuadratic | public static int solveQuadratic(double eqn, double res)(Code) | | Solves the quadratic whose coefficients are in the eqn
array and places the non-complex roots into the res
array, returning the number of roots.
The quadratic solved is represented by the equation:
eqn = {C, B, A};
ax^2 + bx + c = 0
A return value of -1 is used to distinguish a constant
equation, which might be always 0 or never 0, from an equation that
has no zeroes.
Parameters: eqn - the specified array of coefficients to use to solvethe quadratic equation Parameters: res - the array that contains the non-complex roots resulting from the solution of the quadratic equation the number of roots, or -1 if the equation isa constant. since: 1.3 |
subdivide | public void subdivide(QuadCurve2D left, QuadCurve2D right)(Code) | | Subdivides this QuadCurve2D and stores the resulting
two subdivided curves into the left and
right curve parameters.
Either or both of the left and right
objects can be the same as this QuadCurve2D or
null .
Parameters: left - the QuadCurve2D object for storing theleft or first half of the subdivided curve Parameters: right - the QuadCurve2D object for storing theright or second half of the subdivided curve since: 1.2 |
subdivide | public static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right)(Code) | | Subdivides the quadratic curve specified by the src
parameter and stores the resulting two subdivided curves into the
left and right curve parameters.
Either or both of the left and right
objects can be the same as the src object or
null .
Parameters: src - the quadratic curve to be subdivided Parameters: left - the QuadCurve2D object for storing theleft or first half of the subdivided curve Parameters: right - the QuadCurve2D object for storing theright or second half of the subdivided curve since: 1.2 |
subdivide | public static void subdivide(double src, int srcoff, double left, int leftoff, double right, int rightoff)(Code) | | Subdivides the quadratic curve specified by the coordinates
stored in the src array at indices
srcoff through srcoff + 5
and stores the resulting two subdivided curves into the two
result arrays at the corresponding indices.
Either or both of the left and right
arrays can be null or a reference to the same array
and offset as the src array.
Note that the last point in the first subdivided curve is the
same as the first point in the second subdivided curve. Thus,
it is possible to pass the same array for left and
right and to use offsets such that
rightoff equals leftoff + 4 in order
to avoid allocating extra storage for this common point.
Parameters: src - the array holding the coordinates for the source curve Parameters: srcoff - the offset into the array of the beginning of thethe 6 source coordinates Parameters: left - the array for storing the coordinates for the firsthalf of the subdivided curve Parameters: leftoff - the offset into the array of the beginning of thethe 6 left coordinates Parameters: right - the array for storing the coordinates for the secondhalf of the subdivided curve Parameters: rightoff - the offset into the array of the beginning of thethe 6 right coordinates since: 1.2 |
|
|