Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Class java.awt.geom.CubicCurve2D

java.lang.Object
    |
    +----java.awt.geom.CubicCurve2D
Subclasses:
CubicCurve2D.Double, CubicCurve2D.Float

public abstract class CubicCurve2D
extends Object
implements Shape, Cloneable
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   CubicCurve2D.Double
A cubic parametric curve segment specified with double coordinates.
static   CubicCurve2D.Float
A cubic parametric curve segment specified with float coordinates.
 

Constructor Summary
 CubicCurve2D()
 
 

Method Summary
Object  clone()
Creates a new object of the same class as this object.
boolean  contains(double x, double y)
Test if a given coordinate is inside the boundary of the shape.
boolean  contains(Point2D p)
Test if a given Point is inside the boundary of the shape.
boolean  contains(double x, double y, double w, double h)
Test if the interior of the Shape entirely contains the given set of rectangular coordinates.
boolean  contains(Rectangle2D r)
Test if the interior of the Shape entirely contains the given Rectangle.
Rectangle  getBounds()
Return the bounding box of the shape.
double  getCtrlX1()
Returns the X coordinate of the first control point in double precision.
double  getCtrlX2()
Returns the X coordinate of the second control point in double precision.
double  getCtrlY1()
Returns the Y coordinate of the first control point in double precision.
double  getCtrlY2()
Returns the Y coordinate of the second control point in double precision.
static double  getFlatness(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the indicated controlpoints.
static double  getFlatness(double[] coords, int offset)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the controlpoints stored in the indicated array at the indicated index.
double  getFlatness()
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this curve.
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, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the indicated controlpoints.
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 cubic curve specified by the controlpoints stored in the indicated array at the indicated index.
double  getFlatnessSq()
Returns the square of the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this curve.
PathIterator  getPathIterator(AffineTransform at)
Return 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.
double  getX1()
Returns the X coordinate of the start point in double precision.
double  getX2()
Returns the X coordinate of the end point in double precision.
double  getY1()
Returns the Y coordinate of the start point in double precision.
double  getY2()
Returns the Y coordinate of the end point in double precision.
boolean  intersects(double x, double y, double w, double h)
Test if the Shape intersects the interior of a given set of rectangular coordinates.
boolean  intersects(Rectangle2D r)
Test if the Shape intersects the interior of a given Rectangle.
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(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.
void  setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2)
Sets the location of the endpoints and controlpoints of this curve to the specified Point coordinates.
void  setCurve(Point2D[] pts, int offset)
Sets the location of the endpoints and controlpoints of this curve to the coordinates of the Point objects at the specified offset in the specified array.
void  setCurve(CubicCurve2D c)
Sets the location of the endpoints and controlpoints of this curve to the same as those in the specified CubicCurve.
static int  solveCubic(double[] eqn)
Solve the cubic whose coefficients are in the eqn array and place the non-complex roots back into the 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 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
 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CubicCurve2D

protected CubicCurve2D()
Method Detail

getX1

public abstract double getX1()
Returns the X coordinate of the start point in double precision.

getY1

public abstract double getY1()
Returns the Y coordinate of the start point in double precision.

getCtrlX1

public abstract double getCtrlX1()
Returns the X coordinate of the first control point in double precision.

getCtrlY1

public abstract double getCtrlY1()
Returns the Y coordinate of the first control point in double precision.

getCtrlX2

public abstract double getCtrlX2()
Returns the X coordinate of the second control point in double precision.

getCtrlY2

public abstract double getCtrlY2()
Returns the Y coordinate of the second control point in double precision.

getX2

public abstract double getX2()
Returns the X coordinate of the end point in double precision.

getY2

public abstract double getY2()
Returns the Y coordinate of the end point in double precision.

setCurve

public 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.

setCurve

public 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.

setCurve

public void setCurve(Point2D p1,
                     Point2D cp1,
                     Point2D cp2,
                     Point2D p2)
Sets the location of the endpoints and controlpoints of this curve to the specified Point coordinates.

setCurve

public void setCurve(Point2D[] pts,
                     int offset)
Sets the location of the endpoints and controlpoints of this curve to the coordinates of the Point objects at the specified offset in the specified array.

setCurve

public void setCurve(CubicCurve2D c)
Sets the location of the endpoints and controlpoints of this curve to the same as those in the specified CubicCurve.

getFlatnessSq

public 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, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the indicated controlpoints.

getFlatness

public static double getFlatness(double x1,
                                 double y1,
                                 double ctrlx1,
                                 double ctrly1,
                                 double ctrlx2,
                                 double ctrly2,
                                 double x2,
                                 double y2)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the indicated controlpoints.

getFlatnessSq

public 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 cubic curve specified by the controlpoints stored in the indicated array at the indicated index.

getFlatness

public static double getFlatness(double[] coords,
                                 int offset)
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of the cubic curve specified by the controlpoints stored in the indicated array at the indicated index.

getFlatnessSq

public double getFlatnessSq()
Returns the square of the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this curve.

getFlatness

public double getFlatness()
Returns the flatness, or maximum distance of a controlpoint from the line connecting the endpoints, of this curve.

subdivide

public void subdivide(CubicCurve2D left,
                      CubicCurve2D right)
Subdivides this cubic curve 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 this object or null.
Parameters:
left - the cubic curve object for storing for the left or first half of the subdivided curve
right - the cubic curve object for storing for the right or second half of the subdivided curve

subdivide

public 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. Either or both of the left and right objects may be the same as the src object or null.
Parameters:
src - the cubic curve to be subdivided
left - the cubic curve object for storing for the left or first half of the subdivided curve
right - the cubic curve object for storing for the right or second half of the subdivided curve

subdivide

public static void subdivide(double[] src,
                             int srcoff,
                             double[] left,
                             int leftoff,
                             double[] right,
                             int rightoff)
Subdivides the cubic curve specified by the 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. 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 and thus it is possible to pass the same array for left and right and to use offsets such that rightoff equals (leftoff + 6) in order to avoid allocating extra storage for this common point.
Parameters:
src - the array holding the coordinates for the source curve
srcoff - the offset into the array of the beginning of the the 6 source coordinates
left - the array for storing the coordinates for the first half of the subdivided curve
leftoff - the offset into the array of the beginning of the the 6 left coordinates
right - the array for storing the coordinates for the second half of the subdivided curve
rightoff - the offset into the array of the beginning of the the 6 right coordinates

solveCubic

public static int solveCubic(double[] eqn)
Solve the cubic whose coefficients are in the eqn array and place the non-complex roots back into the array, returning the number of roots. The quadratic 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.
Returns:
the number of roots, or -1 if the equation is a constant

contains

public boolean contains(double x,
                        double y)
Test if a given coordinate is inside the boundary of the shape.
Implements:
contains in interface Shape

contains

public boolean contains(Point2D p)
Test if a given Point is inside the boundary of the shape.
Implements:
contains in interface Shape

intersects

public boolean intersects(double x,
                          double y,
                          double w,
                          double h)
Test if the Shape intersects the interior of a given set of rectangular coordinates.
Implements:
intersects in interface Shape

intersects

public boolean intersects(Rectangle2D r)
Test if the Shape intersects the interior of a given Rectangle.
Implements:
intersects in interface Shape

contains

public boolean contains(double x,
                        double y,
                        double w,
                        double h)
Test if the interior of the Shape entirely contains the given set of rectangular coordinates.
Implements:
contains in interface Shape

contains

public boolean contains(Rectangle2D r)
Test if the interior of the Shape entirely contains the given Rectangle.
Implements:
contains in interface Shape

getBounds

public Rectangle getBounds()
Return the bounding box of the shape.
Implements:
getBounds in interface Shape

getPathIterator

public PathIterator getPathIterator(AffineTransform at)
Return an iteration object that defines the boundary of the shape.
Implements:
getPathIterator in interface Shape

getPathIterator

public PathIterator getPathIterator(AffineTransform at,
                                    double flatness)
Return an iteration object that defines the boundary of the flattened shape.
Implements:
getPathIterator in interface Shape

clone

public Object clone()
Creates a new object of the same class as this object.
Returns:
a clone of this instance.
Throws:
OutOfMemoryError - if there is not enough memory.
Overrides:
clone in class Object
See Also:
Cloneable

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.