
Java^{TM} 2 Platform Std. Ed. v1.4.2 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object java.awt.geom.QuadCurve2D
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.
Nested Class Summary  
static class 
QuadCurve2D.Double
A quadratic parametric curve segment specified with double coordinates. 
static class 
QuadCurve2D.Float
A quadratic parametric curve segment specified with float coordinates. 
Constructor Summary  
protected 
QuadCurve2D()
This is an abstract class that cannot be instantiated directly. 
Method Summary  
Object 
clone()
Creates a new object of the same class and with the same contents as this object. 
boolean 
contains(double x,
double y)
Tests if a specified coordinate is inside the boundary of the shape of this QuadCurve2D . 
boolean 
contains(double x,
double y,
double w,
double h)
Tests if the interior of the shape of this QuadCurve2D entirely contains the specified
set of rectangular coordinates. 
boolean 
contains(Point2D p)
Tests if a specified Point2D is inside the boundary of
the shape of this QuadCurve2D . 
boolean 
contains(Rectangle2D r)
Tests if the interior of the shape of this QuadCurve2D entirely contains the specified
Rectangle2D . 
Rectangle 
getBounds()
Returns the bounding box of this QuadCurve2D . 
abstract Point2D 
getCtrlPt()
Returns the control point. 
abstract double 
getCtrlX()
Returns the x coordinate of the control point in double precision. 
abstract double 
getCtrlY()
Returns the y coordinate of the control point in double precision. 
double 
getFlatness()
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this QuadCurve2D . 
static double 
getFlatness(double[] coords,
int offset)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the quadratic curve specified by the controlpoints stored in the indicated array at the indicated index. 
static double 
getFlatness(double x1,
double y1,
double ctrlx,
double ctrly,
double x2,
double y2)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the quadratic curve specified by the indicated controlpoints. 
double 
getFlatnessSq()
Returns the square of the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this QuadCurve2D . 
static double 
getFlatnessSq(double[] coords,
int offset)
Returns the square of the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the quadratic curve specified by the controlpoints stored in the indicated array at the indicated index. 
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 controlpoint from the line connecting the endpoints, of the quadratic curve specified by the indicated controlpoints. 
abstract Point2D 
getP1()
Returns the start point. 
abstract Point2D 
getP2()
Returns the end point. 
PathIterator 
getPathIterator(AffineTransform at)
Returns an iteration object that defines the boundary of the shape of this QuadCurve2D . 
PathIterator 
getPathIterator(AffineTransform at,
double flatness)
Returns an iteration object that defines the boundary of the flattened shape of this QuadCurve2D . 
abstract double 
getX1()
Returns the x coordinate of the start point in double in precision. 
abstract double 
getX2()
Returns the x coordinate of the end point in double precision. 
abstract double 
getY1()
Returns the y coordinate of the start point in double precision. 
abstract double 
getY2()
Returns the y coordinate of the end point in double precision. 
boolean 
intersects(double x,
double y,
double w,
double h)
Tests if the shape of this QuadCurve2D intersects the
interior of a specified set of rectangular coordinates. 
boolean 
intersects(Rectangle2D r)
Tests if the shape of this QuadCurve2D intersects the
interior of a specified Rectangle2D . 
void 
setCurve(double[] coords,
int offset)
Sets the location of the endpoints and controlpoints of this QuadCurve2D to the double coordinates at
the specified offset in the specified array. 
abstract void 
setCurve(double x1,
double y1,
double ctrlx,
double ctrly,
double x2,
double y2)
Sets the location of the endpoints and controlpoint of this curve to the specified double coordinates. 
void 
setCurve(Point2D[] pts,
int offset)
Sets the location of the endpoints and controlpoints of this QuadCurve2D to the coordinates of the
Point2D objects at the specified offset in
the specified array. 
void 
setCurve(Point2D p1,
Point2D cp,
Point2D p2)
Sets the location of the endpoints and controlpoint of this QuadCurve2D to the specified Point2D
coordinates. 
void 
setCurve(QuadCurve2D c)
Sets the location of the endpoints and controlpoint of this QuadCurve2D to the same as those in the specified
QuadCurve2D . 
static int 
solveQuadratic(double[] eqn)
Solves the quadratic whose coefficients are in the eqn
array and places the noncomplex roots back into the same array,
returning the number of roots. 
static int 
solveQuadratic(double[] eqn,
double[] res)
Solves the quadratic whose coefficients are in the eqn
array and places the noncomplex roots into the res
array, returning the number of roots. 
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. 
void 
subdivide(QuadCurve2D left,
QuadCurve2D right)
Subdivides this QuadCurve2D and stores the resulting
two subdivided curves into the left and
right curve parameters. 
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. 
Methods inherited from class java.lang.Object 
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Methods inherited from interface java.awt.Shape 
getBounds2D 
Constructor Detail 
protected QuadCurve2D()
QuadCurve2D.Float
,
QuadCurve2D.Double
Method Detail 
public abstract double getX1()
double
in precision.
public abstract double getY1()
double
precision.
public abstract Point2D getP1()
Point2D
that is the start point of this
QuadCurve2D
.public abstract double getCtrlX()
double
precision.
public abstract double getCtrlY()
double
precision.
public abstract Point2D getCtrlPt()
Point2D
that is the control point of this
Point2D
.public abstract double getX2()
double
precision.
public abstract double getY2()
double
precision.
public abstract Point2D getP2()
Point
object that is the end point
of this Point2D
.public abstract void setCurve(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
double
coordinates.
public void setCurve(double[] coords, int offset)
QuadCurve2D
to the double
coordinates at
the specified offset in the specified array.
coords
 the array containing coordinate valuesoffset
 the index into the array from which to start
getting the coordinate values and assigning them to this
QuadCurve2D
public void setCurve(Point2D p1, Point2D cp, Point2D p2)
QuadCurve2D
to the specified Point2D
coordinates.
p1
 the starting pointcp
 the control pointp2
 the ending pointpublic void setCurve(Point2D[] pts, int offset)
QuadCurve2D
to the coordinates of the
Point2D
objects at the specified offset in
the specified array.
pts
 an array containing Point2D
that define
coordinate valuesoffset
 the index into pts
at which to start
getting the coordinate values and assigning them to this
QuadCurve2D
public void setCurve(QuadCurve2D c)
QuadCurve2D
to the same as those in the specified
QuadCurve2D
.
c
 the specified QuadCurve2D
public static double getFlatnessSq(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
public static double getFlatness(double x1, double y1, double ctrlx, double ctrly, double x2, double y2)
public static double getFlatnessSq(double[] coords, int offset)
coords
 an array containing coordinate valuesoffset
 the index into coords
at which to
to start getting the values from the array and
assigning them to a quadratic curve
public static double getFlatness(double[] coords, int offset)
coords
 an array containing coordinate valuesoffset
 the index into coords
at which to
start getting the coordinate values and assigning
them to a quadratic curve
public double getFlatnessSq()
QuadCurve2D
.
QuadCurve2D
.public double getFlatness()
QuadCurve2D
.
QuadCurve2D
.public void subdivide(QuadCurve2D left, QuadCurve2D right)
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
.
left
 the QuadCurve2D
object for storing the
left or first half of the subdivided curveright
 the QuadCurve2D
object for storing the
right or second half of the subdivided curvepublic static void subdivide(QuadCurve2D src, QuadCurve2D left, QuadCurve2D right)
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
.
src
 the quadratic curve to be subdividedleft
 the QuadCurve2D
object for storing the
left or first half of the subdivided curveright
 the QuadCurve2D
object for storing the
right or second half of the subdivided curvepublic static void subdivide(double[] src, int srcoff, double[] left, int leftoff, double[] right, int rightoff)
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.
src
 the array holding the coordinates for the source curvesrcoff
 the offset into the array of the beginning of the
the 6 source coordinatesleft
 the array for storing the coordinates for the first
half of the subdivided curveleftoff
 the offset into the array of the beginning of the
the 6 left coordinatesright
 the array for storing the coordinates for the second
half of the subdivided curverightoff
 the offset into the array of the beginning of the
the 6 right coordinatespublic static int solveQuadratic(double[] eqn)
eqn
array and places the noncomplex 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 = 0A 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.
eqn
 the array that contains the quadratic coefficients
1
if the equation is
a constantpublic static int solveQuadratic(double[] eqn, double[] res)
eqn
array and places the noncomplex 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 = 0A 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.
eqn
 the specified array of coefficients to use to solve
the quadratic equationres
 the array that contains the noncomplex roots
resulting from the solution of the quadratic equation
1
if the equation is
a constant.public boolean contains(double x, double y)
QuadCurve2D
.
contains
in interface Shape
x
 the specified x coordinatey
 the specified y coordinate
true
if the specified coordinate is inside
the boundary of the shape of this
QuadCurve2D
; false
otherwise.public boolean contains(Point2D p)
Point2D
is inside the boundary of
the shape of this QuadCurve2D
.
contains
in interface Shape
p
 the specified Point2D
true
if the specified Point2D
is
inside the boundary of the shape of this
QuadCurve2D
.public boolean intersects(double x, double y, double w, double h)
QuadCurve2D
intersects the
interior of a specified set of rectangular coordinates.
intersects
in interface Shape
w
 the width of the specified rectangular areah
 the height of the specified rectangular areax
 the x coordinate of the specified rectangular areay
 the y coordinate of the specified rectangular area
true
if the shape of this
QuadCurve2D
intersects the interior of the
specified set of rectangular coordinates;
false
otherwise.Area
public boolean intersects(Rectangle2D r)
QuadCurve2D
intersects the
interior of a specified Rectangle2D
.
intersects
in interface Shape
r
 the specified Rectangle2D
true
if the shape of this
QuadCurve2D
intersects the interior of
the specified Rectangle2D
;
false
otherwise.Shape.intersects(double, double, double, double)
public boolean contains(double x, double y, double w, double h)
QuadCurve2D
entirely contains the specified
set of rectangular coordinates.
contains
in interface Shape
w
 the width of the specified rectangular areah
 the height of the specified rectangular areax
 the x coordinate of the specified rectangular areay
 the y coordinate of the specified rectangular area
true
if the interior of the shape of this
QuadCurve2D
entirely contains the specified
rectangluar area; false
otherwise.Area
,
Shape.intersects(double, double, double, double)
public boolean contains(Rectangle2D r)
QuadCurve2D
entirely contains the specified
Rectangle2D
.
contains
in interface Shape
r
 the specified Rectangle2D
true
if the interior of the shape of this
QuadCurve2D
entirely contains the specified
Rectangle2D
; false
otherwise.Shape.contains(double, double, double, double)
public Rectangle getBounds()
QuadCurve2D
.
getBounds
in interface Shape
Rectangle
that is the bounding box of the shape
of this QuadCurve2D
.Shape.getBounds2D()
public PathIterator getPathIterator(AffineTransform at)
QuadCurve2D
.
The iterator for this class is not multithreaded 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.
getPathIterator
in interface Shape
at
 an optional AffineTransform
to apply to the
shape boundary
PathIterator
object that defines the boundary
of the shape.public PathIterator getPathIterator(AffineTransform at, double flatness)
QuadCurve2D
.
The iterator for this class is not multithreaded 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.
getPathIterator
in interface Shape
at
 an optional AffineTransform
to apply
to the boundary of the shapeflatness
 the maximum distance that the control points for a
subdivided curve can be with respect to a line connecting
the endpoints of this curve before this curve is
replaced by a straight line connecting the endpoints.
PathIterator
object that defines the
flattened boundary of the shape.public Object clone()
clone
in class Object
OutOfMemoryError
 if there is not enough memory.Cloneable

Java^{TM} 2 Platform Std. Ed. v1.4.2 

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
Copyright © 2003, 2010 Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.