SpecZone .ru
спецификации, руководства, описания, API


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

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: INNER  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object  +java.awt.geom.CubicCurve2D
The CubicCurve2D
class defines a cubic parametric curve
segment in (x, y) coordinate space.
This class is only the abstract superclass for all objects which store a 2D cubic curve segment. The actual storage representation of the coordinates is left to the subclass.
Inner Class Summary  
static class 
CubicCurve2D.Double
A cubic parametric curve segment specified with double coordinates. 
static class 
CubicCurve2D.Float
A cubic parametric curve segment specified with float coordinates. 
Constructor Summary  
protected 
CubicCurve2D()
This is an abstract class that cannot be instantiated directly. 
Method Summary  
Object 
clone()
Creates a new object of the same class as this object. 
boolean 
contains(double x,
double y)
Tests if a specified coordinate is inside the boundary of the shape. 
boolean 
contains(double x,
double y,
double w,
double h)
Tests if the interior of the shape entirely contains the specified set of rectangular coordinates. 
boolean 
contains(Point2D p)
Tests if a specified Point2D is inside the boundary of
the shape. 
boolean 
contains(Rectangle2D r)
Tests if the interior of the shape entirely contains the specified Rectangle2D . 
Rectangle 
getBounds()
Returns the bounding box of the shape. 
abstract Point2D 
getCtrlP1()
Returns the first control point. 
abstract Point2D 
getCtrlP2()
Returns the second control point. 
abstract double 
getCtrlX1()
Returns the X coordinate of the first control point in double precision. 
abstract double 
getCtrlX2()
Returns the X coordinate of the second control point in double precision. 
abstract double 
getCtrlY1()
Returns the Y coordinate of the first control point in double precision. 
abstract double 
getCtrlY2()
Returns the Y coordinate of the second control point in double precision. 
double 
getFlatness()
Returns the flatness of this curve. 
static double 
getFlatness(double[] coords,
int offset)
Returns the flatness of the cubic curve specified by the controlpoints stored in the indicated array at the indicated index. 
static double 
getFlatness(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
Returns the flatness of the cubic curve specified by the indicated controlpoints. 
double 
getFlatnessSq()
Returns the square of the flatness of this curve. 
static double 
getFlatnessSq(double[] coords,
int offset)
Returns the square of the flatness of the cubic curve specified by the controlpoints stored in the indicated array at the indicated index. 
static double 
getFlatnessSq(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
Returns the square of the flatness of the cubic 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. 
PathIterator 
getPathIterator(AffineTransform at,
double flatness)
Return an iteration object that defines the boundary of the flattened shape. 
abstract double 
getX1()
Returns the X coordinate of the start point in double 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 intersects the interior of a specified set of rectangular coordinates. 
boolean 
intersects(Rectangle2D r)
Tests if the shape intersects the interior of a specified Rectangle2D . 
void 
setCurve(CubicCurve2D c)
Sets the location of the endpoints and controlpoints of this curve to the same as those in the specified CubicCurve2D . 
void 
setCurve(double[] coords,
int offset)
Sets the location of the endpoints and controlpoints of this curve to the double coordinates at the specified offset in the specified array. 
abstract void 
setCurve(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
Sets the location of the endpoints and controlpoints of this curve to the specified double coordinates. 
void 
setCurve(Point2D[] pts,
int offset)
Sets the location of the endpoints and controlpoints of this curve to the coordinates of the Point2D objects at the specified
offset in the specified array. 
void 
setCurve(Point2D p1,
Point2D cp1,
Point2D cp2,
Point2D p2)
Sets the location of the endpoints and controlpoints of this curve to the specified Point2D coordinates. 
static int 
solveCubic(double[] eqn)
Solves the cubic whose coefficients are in the eqn
array and places the noncomplex roots back into the same array,
returning the number of roots. 
static int 
solveCubic(double[] eqn,
double[] res)
Solve the cubic whose coefficients are in the eqn
array and place the noncomplex roots into the res
array, returning the number of roots. 
void 
subdivide(CubicCurve2D left,
CubicCurve2D right)
Subdivides this cubic curve and stores the resulting two subdivided curves into the left and right curve parameters. 
static void 
subdivide(CubicCurve2D src,
CubicCurve2D left,
CubicCurve2D right)
Subdivides the cubic curve specified by the src parameter
and stores the resulting two subdivided curves into the
left and right curve parameters. 
static void 
subdivide(double[] src,
int srcoff,
double[] left,
int leftoff,
double[] right,
int rightoff)
Subdivides the cubic curve specified by the coordinates stored in the src array at indices srcoff
through (srcoff + 7) and stores the
resulting two subdivided curves into the two result arrays at the
corresponding indices. 
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 CubicCurve2D()
CubicCurve2D.Float
,
CubicCurve2D.Double
Method Detail 
public abstract double getX1()
CubicCurve2D
.public abstract double getY1()
CubicCurve2D
.public abstract Point2D getP1()
Point2D
that is the start point of
the CubicCurve2D
.public abstract double getCtrlX1()
CubicCurve2D
.public abstract double getCtrlY1()
CubicCurve2D
.public abstract Point2D getCtrlP1()
Point2D
that is the first control point of
the CubicCurve2D
.public abstract double getCtrlX2()
CubicCurve2D
.public abstract double getCtrlY2()
CubicCurve2D
.public abstract Point2D getCtrlP2()
Point2D
that is the second control point of
the CubicCurve2D
.public abstract double getX2()
CubicCurve2D
.public abstract double getY2()
CubicCurve2D
.public abstract Point2D getP2()
Point2D
that is the end point of
the CubicCurve2D
.public abstract void setCurve(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
x1, y1
 the first specified coordinates used to set the start
point of this CubicCurve2D
ctrlx1, ctrly1
 the second specified coordinates used to set the
first control point of this CubicCurve2D
ctrlx2, ctrly2
 the third specified coordinates used to set the
second control point of this CubicCurve2D
x2, y2
 the fourth specified coordinates used to set the end
point of this CubicCurve2D
public void setCurve(double[] coords, int offset)
coords
 a double array containing coordinatesoffset
 the index of coords
at which to begin
setting the endpoints and controlpoints of this curve
to the coordinates contained in coords
public void setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2)
Point2D
coordinates.p1
 the first specified Point2D
used to set the
start point of this curvep2
 the second specified Point2D
used to set the
first control point of this curvep3
 the third specified Point2D
used to set the
second control point of this curvep4
 the fourth specified Point2D
used to set the
end point of this curvepublic void setCurve(Point2D[] pts, int offset)
Point2D
objects at the specified
offset in the specified array.pts
 an array of Point2D
objectsoffset
 the index of pts
at which to begin setting
the endpoints and controlpoints of this curve to the
points contained in pts
public void setCurve(CubicCurve2D c)
CubicCurve2D
.c
 the specified CubicCurve2D
public static double getFlatnessSq(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
x1, y1
 the first specified coordinates that specify the start
point of a CubicCurve2D
ctrlx1, ctrly1
 the second specified coordinates that specify the
first control point of a CubicCurve2D
ctrlx2, ctrly2
 the third specified coordinates that specify the
second control point of a CubicCurve2D
x2, y2
 the fourth specified coordinates that specify the
end point of a CubicCurve2D
CubicCurve2D
represented by the specified coordinates.public static double getFlatness(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
x1, y1
 the first specified coordinates that specify the start
point of a CubicCurve2D
ctrlx1, ctrly1
 the second specified coordinates that specify the
first control point of a CubicCurve2D
ctrlx2, ctrly2
 the third specified coordinates that specify the
second control point of a CubicCurve2D
x2, y2
 the fourth specified coordinates that specify the
end point of a CubicCurve2D
CubicCurve2D
represented by the specified coordinates.public static double getFlatnessSq(double[] coords, int offset)
coords
 an array containing coordinatesoffset
 the index of coords
at which to begin
setting the endpoints and controlpoints of this curve
to the coordinates contained in coords
CubicCurve2D
specified by the coordinates in coords
at
the specified offset.public static double getFlatness(double[] coords, int offset)
coords
 an array containing coordinatesoffset
 the index of coords
at which to begin
setting the endpoints and controlpoints of this curve
to the coordinates contained in coords
CubicCurve2D
specified by the coordinates in coords
at
the specified offset.public double getFlatnessSq()
public double getFlatness()
public void subdivide(CubicCurve2D left, CubicCurve2D right)
left
 the cubic curve object for storing for the left or
first half of the subdivided curveright
 the cubic curve object for storing for the right or
second half of the subdivided curvepublic static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D 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
may be the same as the src
object or null
.src
 the cubic curve to be subdividedleft
 the cubic curve object for storing the left or
first half of the subdivided curveright
 the cubic curve 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
+ 7) 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 may be null
or a reference to the same array
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 as rightoff
equals (leftoff
+ 6), 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 solveCubic(double[] eqn)
eqn
array and places the noncomplex roots back into the same array,
returning the number of roots. The solved cubic is represented
by the equation:
eqn = {c, b, a, d} dx^3 + ax^2 + bx + c = 0A return value of 1 is used to distinguish a constant equation that might be always 0 or never 0 from an equation that has no zeroes.
eqn
 an array containing coefficients for a cubicpublic static int solveCubic(double[] eqn, double[] res)
eqn
array and place the noncomplex roots into the res
array, returning the number of roots.
The cubic solved is represented by the equation:
eqn = {c, b, a, d}
dx^3 + ax^2 + bx + c = 0
A return value of 1 is used to distinguish a constant equation,
which may be always 0 or never 0, from an equation which has no
zeroes.public boolean contains(double x, double y)
contains
in interface Shape
x, y
 the specified coordinate to be testedtrue
if the coordinate is inside the boundary of
the shape; false
otherwise.public boolean contains(Point2D p)
Point2D
is inside the boundary of
the shape.contains
in interface Shape
p
 the specified Point2D
to be testedtrue
if the p
is inside the boundary
of the shape; false
otherwise.public boolean intersects(double x, double y, double w, double h)
intersects
in interface Shape
x, y
 the coordinates of the upper left corner
of the specified rectangular areaw
 the width of the specified rectangular areah
 the height of the specified rectangular areatrue
if the shape intersects the
interior of the specified rectangular area;
false
otherwise.public boolean intersects(Rectangle2D r)
Rectangle2D
.intersects
in interface Shape
r
 the specified Rectangle2D
to be testedtrue
if the shape intersects the interior of
the specified Rectangle2D
;
false
otherwise.public boolean contains(double x, double y, double w, double h)
contains
in interface Shape
x, y
 the coordinates of the upper left corner of the specified
rectangular shapew
 the width of the specified rectangular shapeh
 the height of the specified rectangular shapetrue
if the shape entirely contains
the specified set of rectangular coordinates;
false
otherwise.public boolean contains(Rectangle2D r)
Rectangle2D
.contains
in interface Shape
r
 the specified Rectangle2D
to be testedtrue
if the shape entirely contains
the specified Rectangle2D
;
false
otherwise.public Rectangle getBounds()
getBounds
in interface Shape
Rectangle
that is the bounding box of the shape.public PathIterator getPathIterator(AffineTransform at)
CubicCurve2D
class does not
guarantee that modifications to the geometry of this
CubicCurve2D
object do not affect any iterations of
that geometry that are already in process.getPathIterator
in interface Shape
at
 an optional AffineTransform
to be applied to the
coordinates as they are returned in the iteration, or null
if untransformed coordinates are desiredPathIterator
object that returns the
geometry of the outline of this CubicCurve2D
, one
segment at a time.public PathIterator getPathIterator(AffineTransform at, double flatness)
CubicCurve2D
class does not
guarantee that modifications to the geometry of this
CubicCurve2D
object do not affect any iterations of
that geometry that are already in process.getPathIterator
in interface Shape
at
 an optional AffineTransform
to be applied to the
coordinates as they are returned in the iteration, or null
if untransformed coordinates are desiredflatness
 the maximum amount that the control points
for a given curve can vary from colinear before a subdivided
curve is replaced by a straight line connecting the endpointsPathIterator
object that returns the
geometry of the outline of this CubicCurve2D
, one segment at a time.public Object clone()
clone
in class Object
OutOfMemoryError
 if there is not enough memory.Cloneable

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

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: INNER  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 19932001 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.