is new.
java.lang.Objectjava.awt.geom.CubicCurve2D
public abstract class CubicCurve2D
The CubicCurve2D class defines a cubic parametric curve segment in
(x,y)
(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.
Since:
1.2
| Nested 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
the
coordinates are
Shape.
|
| boolean |
contains
(double x, double y, double w, double h) Tests if the interior of the
Shape
area.
|
| boolean |
contains
(
Point2D
Tests if a specified
Point2D
|
| boolean |
contains
(
Rectangle2D
Tests if the interior of the
Shape
|
| Rectangle |
getBounds
() Returns
an integer
Rectangle
|
| 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
control points
|
| 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
control points.
|
| 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
control points
|
| 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
control points.
|
| 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
interior of the Shape
area.
|
| boolean |
intersects
(
Rectangle2D
Tests if the
interior of the Shape
|
| void |
setCurve
(
CubicCurve2D
Sets the location of the
end points
control points
|
| void |
setCurve
(double[] coords, int offset) Sets the location of the
end points
control points
|
| abstract void |
setCurve
(double x1, double y1, double ctrlx1, double ctrly1, double ctrlx2, double ctrly2, double x2, double y2) Sets the location of the
end points
control points
|
| void |
setCurve
(
Point2D
Sets the location of the
end points
control points
|
| void |
setCurve
(
Point2D
p1,
Point2D
cp1,
Point2D
cp2,
Point2D
Sets the location of the
end points
control points
|
| static int |
solveCubic
(double[] eqn) Solves the cubic whose coefficients are in the eqn array and places the non-complex 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 non-complex 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()
Since:
1.2
| Method Detail |
|---|
public abstract double getX1()
Since:
1.2
public abstract double getY1()
Since:
1.2
public abstract Point2D getP1()
Since:
1.2
public abstract double getCtrlX1()
Since:
1.2
public abstract double getCtrlY1()
Since:
1.2
public abstract Point2D getCtrlP1()
Since:
1.2
public abstract double getCtrlX2()
Since:
1.2
public abstract double getCtrlY2()
Since:
1.2
public abstract Point2D getCtrlP2()
Since:
1.2
public abstract double getX2()
Since:
1.2
public abstract double getY2()
Since:
1.2
public abstract Point2D getP2()
Since:
1.2
public abstract void setCurve(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
end points
control points
x1
X coordinate
y1
Y coordinate
start
ctrlx1
X coordinate
first
ctrly1 - the Y coordinate used to set the first control point of this CubicCurve2D
ctrlx2 - the X coordinate used to set the second control point of this CubicCurve2D
ctrly2 - the Y coordinate used to set the second control point of this CubicCurve2D
x2 - the X coordinate used to set the end point of this CubicCurve2D
y2 - the Y coordinate used to set the end point of this CubicCurve2D
Since:
1.2
public void setCurve(double[] coords,
int offset)
end points
control points
from
end points
control points
Since:
1.2
public void setCurve(Point2D p1,
Point2D cp1,
Point2D cp2,
Point2D p2)
end points
control points
Since:
1.2
public void setCurve(Point2D[] pts,
int offset)
end points
control points
from
end points
control points
Since:
1.2
public void setCurve(CubicCurve2D c)
end points
control points
Since:
1.2
public static double getFlatnessSq(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
control points.
control point
end points.
x1
X coordinate
specifies
y1
Y coordinate
specifies
start
ctrlx1
X coordinate
specifies
first
ctrly1 - the Y coordinate that specifies the first control point of a CubicCurve2D
ctrlx2 - the X coordinate that specifies the second control point of a CubicCurve2D
ctrly2 - the Y coordinate that specifies the second control point of a CubicCurve2D
x2 - the X coordinate that specifies the end point of a CubicCurve2D
y2 - the Y coordinate that specifies the end point of a CubicCurve2D
Since:
1.2
public static double getFlatness(double x1,
double y1,
double ctrlx1,
double ctrly1,
double ctrlx2,
double ctrly2,
double x2,
double y2)
control points.
control point
end points.
x1
X coordinate
specifies
y1
Y coordinate
specifies
start
ctrlx1
X coordinate
specifies
first
ctrly1 - the Y coordinate that specifies the first control point of a CubicCurve2D
ctrlx2 - the X coordinate that specifies the second control point of a CubicCurve2D
ctrly2 - the Y coordinate that specifies the second control point of a CubicCurve2D
x2 - the X coordinate that specifies the end point of a CubicCurve2D
y2 - the Y coordinate that specifies the end point of a CubicCurve2D
Since:
1.2
public static double getFlatnessSq(double[] coords,
int offset)
control points
control point
end points.
from
getting
end points
control points
curve
Since:
1.2
public static double getFlatness(double[] coords,
int offset)
control points
control point
end points.
from
getting
end points
control points
curve
Since:
1.2
public double getFlatnessSq()
control point
end points.
Since:
1.2
public double getFlatness()
control point
end points.
Since:
1.2
public void subdivide(CubicCurve2D left,
CubicCurve2D right)
Since:
1.2
public static void subdivide(CubicCurve2D src,
CubicCurve2D left,
CubicCurve2D right)
Since:
1.2
public static void subdivide(double[] src,
int srcoff,
double[] left,
int leftoff,
double[] right,
int rightoff)
Since:
1.2
public static int solveCubic(double[] eqn)
eqn = {c, b, a, d}
dx^3 + ax^2 + bx + c = 0
A 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.
Since:
1.2
public static int solveCubic(double[] eqn,
double[] res)
Since:
1.3
public boolean contains(double x,
double y)
the
coordinates are
Shape.
x
X
coordinate to be tested
y - the specified Y coordinate to be tested
true if the specified coordinates are inside the Shape boundary; false otherwise.
Since:
1.2
public boolean contains(Point2D p)
Point2D
Shape.
specified Point2D
Shape;
Since:
1.2
public boolean intersects(double x,
double y,
double w,
double h)
Tests if the interior of the Shape intersects the interior of a specified rectangular area. The rectangular area is considered to intersect the Shape if any point is contained in both the interior of the Shape and the specified rectangular area.
The Shape.intersects() method allows a Shape implementation to conservatively return true when:
there is a high probability that the rectangular area and the Shape intersect, but
the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some Shapes this method might return true even though the rectangular area does not intersect the Shape. The
Area
class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.
x
X coordinate
upper-left
y - the Y coordinate of the upper-left corner of the specified rectangular area
true if the interior of the Shape and the interior of the rectangular area intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.
Since:
1.2
public boolean intersects(Rectangle2D r)
Tests if the interior of the Shape intersects the interior of a specified Rectangle2D. The Shape.intersects() method allows a Shape implementation to conservatively return true when:
there is a high probability that the Rectangle2D and the Shape intersect, but
the calculations to accurately determine this intersection are prohibitively expensive.
This means that for some Shapes this method might return true even though the Rectangle2D does not intersect the Shape. The
Area
class performs more accurate computations of geometric intersection than most Shape objects and therefore can be used if a more precise answer is required.
true if the interior of the Shape and the interior of the specified Rectangle2D intersect, or are both highly likely to intersect and intersection calculations would be too expensive to perform; false otherwise.
Since:
1.2
public boolean contains(double x,
double y,
double w,
double h)
Tests if the interior of the Shape entirely contains the specified rectangular area. All coordinates that lie inside the rectangular area must lie within the Shape for the entire rectanglar area to be considered contained within the Shape.
The Shape.contains() method allows a Shape implementation to conservatively return false when:
the intersect method returns true and
the calculations to determine whether or not the Shape entirely contains the rectangular area are prohibitively expensive.
This means that for some Shapes this method might return false even though the Shape contains the rectangular area. The
Area
class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.
x
X coordinate
upper-left
area
y
Y coordinate
upper-left corner of the
specified rectangular
area
w - the width of the specified rectangular area
area
true if the interior of the Shape entirely contains the specified rectangular area; false otherwise or, if the Shape contains the rectangular area and the intersects method returns true and the containment calculations would be too expensive to perform.
Since:
1.2
public boolean contains(Rectangle2D r)
Tests if the interior of the Shape entirely contains the specified Rectangle2D. The Shape.contains() method allows a Shape implementation to conservatively return false when:
the intersect method returns true and
the calculations to determine whether or not the Shape entirely contains the Rectangle2D are prohibitively expensive.
This means that for some Shapes this method might return false even though the Shape contains the Rectangle2D. The
Area
class performs more accurate geometric computations than most Shape objects and therefore can be used if a more precise answer is required.
The
true if the interior of the Shape entirely contains the Rectangle2D; false otherwise or, if the Shape contains the Rectangle2D and the intersects method returns true and the containment calculations would be too expensive to perform.
Since:
1.2
public Rectangle getBounds()
Returns an integer
Rectangle
that completely encloses the Shape. Note that there is no guarantee that the returned Rectangle is the smallest bounding box that encloses the Shape, only that the Shape lies entirely within the indicated Rectangle. The returned Rectangle might also fail to completely enclose the Shape if the Shape overflows the limited range of the integer data type. The getBounds2D method generally returns a tighter bounding box due to its greater flexibility in representation.
an integer Rectangle that completely encloses the Shape.
Since:
1.2
public PathIterator getPathIterator(AffineTransform at)
Since:
1.2
public PathIterator getPathIterator(AffineTransform at,
double flatness)
end points
Since:
1.2
public Object clone()