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.
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| public float | ctrlx1
The X coordinate of the first control point of the cubic curve segment. |
| public float | ctrlx2
The X coordinate of the second control point of the cubic curve segment. |
| public float | ctrly1
The Y coordinate of the first control point of the cubic curve segment. |
| public float | ctrly2
The Y coordinate of the second control point of the cubic curve segment. |
| private static final int | |
| private static final int | |
| private static final int | |
| public float | x1
The X coordinate of the start point of the cubic curve segment. |
| public float | x2
The X coordinate of the end point of the cubic curve segment. |
| public float | y1
The Y coordinate of the start point of the cubic curve segment. |
| public float | y2
The Y coordinate of the end point of the cubic curve segment. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | CubicCurve2D(float
the X coordinate for the start point
of the resulting x1, float CubicCurve2Dthe Y coordinate for the start point
of the resulting y1, float CubicCurve2Dthe X coordinate for the first control point
of the resulting ctrlx1, float CubicCurve2Dthe Y coordinate for the first control point
of the resulting ctrly1, float CubicCurve2Dthe X coordinate for the second control point
of the resulting ctrlx2, float CubicCurve2Dthe Y coordinate for the second control point
of the resulting ctrly2, float CubicCurve2Dthe X coordinate for the end point
of the resulting x2, float CubicCurve2Dthe Y coordinate for the end point
of the resulting y2)CubicCurve2DConstructs and initializes a |
| Modifier and Type | Method and Description |
|---|---|
| private float | |
| private float | |
| public boolean | contains(float
the specified X coordinate to be tested x, float the specified Y coordinate to be tested y)Implements abstract com. Tests if the specified coordinates are inside the boundary of the
|
| public boolean | contains(Point2D
the specified p)Point2D to be testedOverrides com. Tests if a specified |
| public boolean | contains(float
the X coordinate of the upper-left corner
of the specified rectangular area x, float the Y coordinate of the upper-left corner
of the specified rectangular area y, float the width of the specified rectangular area w, float the height of the specified rectangular area h)Implements abstract com. Tests if the interior of the |
| public CubicCurve2D | copy()
Implements abstract com. Returns a new copy of this |
| public boolean | equals(Object
the reference object with which to compare. obj)Overrides java. Indicates whether some other object is "equal to" this one. |
| public Point2D | Returns: a newly allocated Point2D containing the evaluation of the curve at that parameter valueparameter value at which to evaluate the curve t)Evaluates this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. |
| public void | |
| private static int | evalCubic(float[] vals, int num, boolean include0, boolean include1, float[] inflect, float c1, float cp1, float cp2, float c2)
|
| public Point2D | Returns: a newly allocated Point2D containing the derivative of the curve at that parameter valueparameter value at which to compute the derivative of
the curve t)Evaluates the derivative of this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. |
| public void | |
| private static void | |
| private static float | |
| private static void | |
| public RectBounds | getBounds()
Implements abstract com. Note that there is no guarantee that the returned
|
| public static float | Returns: the flatness of theCubicCurve2D
represented by the specified coordinates.the X coordinate that specifies the start point
of a x1, float CubicCurve2Dthe Y coordinate that specifies the start point
of a y1, float CubicCurve2Dthe X coordinate that specifies the first control point
of a ctrlx1, float CubicCurve2Dthe Y coordinate that specifies the first control point
of a ctrly1, float CubicCurve2Dthe X coordinate that specifies the second control point
of a ctrlx2, float CubicCurve2Dthe Y coordinate that specifies the second control point
of a ctrly2, float CubicCurve2Dthe X coordinate that specifies the end point
of a x2, float CubicCurve2Dthe Y coordinate that specifies the end point
of a y2)CubicCurve2DReturns the flatness of the cubic curve specified by the indicated control points. |
| public static float | Returns: the flatness of theCubicCurve2D
specified by the coordinates in coords at
the specified offset.an array containing coordinates coords, int the index of offset)coords from which to begin
getting the end points and control points of the curveReturns the flatness of the cubic curve specified by the control points stored in the indicated array at the indicated index. |
| public float | |
| public static float | Returns: the square of the flatness of theCubicCurve2D
represented by the specified coordinates.the X coordinate that specifies the start point
of a x1, float CubicCurve2Dthe Y coordinate that specifies the start point
of a y1, float CubicCurve2Dthe X coordinate that specifies the first control point
of a ctrlx1, float CubicCurve2Dthe Y coordinate that specifies the first control point
of a ctrly1, float CubicCurve2Dthe X coordinate that specifies the second control point
of a ctrlx2, float CubicCurve2Dthe Y coordinate that specifies the second control point
of a ctrly2, float CubicCurve2Dthe X coordinate that specifies the end point
of a x2, float CubicCurve2Dthe Y coordinate that specifies the end point
of a y2)CubicCurve2DReturns the square of the flatness of the cubic curve specified by the indicated control points. |
| public static float | Returns: the square of the flatness of theCubicCurve2D
specified by the coordinates in coords at
the specified offset.an array containing coordinates coords, int the index of offset)coords from which to begin
getting the end points and control points of the curveReturns the square of the flatness of the cubic curve specified by the control points stored in the indicated array at the indicated index. |
| public float | Returns: the square of the flatness of this curve.Returns the square of the flatness of this curve. |
| public PathIterator | Returns: thePathIterator object that returns the
geometry of the outline of this CubicCurve2D, one
segment at a time.an optional tx)BaseTransform to be applied to the
coordinates as they are returned in the iteration, or null
if untransformed coordinates are desiredImplements abstract com. Returns an iteration object that defines the boundary of the shape. |
| public PathIterator | Returns: thePathIterator object that returns the
geometry of the outline of this CubicCurve2D,
one segment at a time.an optional tx, float BaseTransform to be applied to the
coordinates as they are returned in the iteration, or null
if untransformed coordinates are desiredthe 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 end points flatness)Implements abstract com. Return an iteration object that defines the boundary of the flattened shape. |
| private static int | |
| public int | |
| public boolean | intersects(float
the X coordinate of the upper-left corner
of the specified rectangular area x, float the Y coordinate of the upper-left corner
of the specified rectangular area y, float the width of the specified rectangular area w, float the height of the specified rectangular area h)Implements abstract com. Tests if the interior of the |
| private static boolean | |
| public void | setCurve(float
the X coordinate used to set the start point
of this x1, float CubicCurve2Dthe Y coordinate used to set the start point
of this y1, float CubicCurve2Dthe X coordinate used to set the first control point
of this ctrlx1, float CubicCurve2Dthe Y coordinate used to set the first control point
of this ctrly1, float CubicCurve2Dthe X coordinate used to set the second control point
of this ctrlx2, float CubicCurve2Dthe Y coordinate used to set the second control point
of this ctrly2, float CubicCurve2Dthe X coordinate used to set the end point
of this x2, float CubicCurve2Dthe Y coordinate used to set the end point
of this y2)CubicCurve2DSets the location of the end points and control points
of this curve to the specified |
| public void | setCurve(float[]
a double array containing coordinates coords, int the index of offset)coords from which to begin
setting the end points and control points of this curve
to the coordinates contained in coordsSets the location of the end points and control points of this curve to the double coordinates at the specified offset in the specified array. |
| public void | setCurve(Point2D
the first specified p1, Point2D Point2D used to set the
start point of this curvethe second specified cp1, Point2D Point2D used to set the
first control point of this curvethe third specified cp2, Point2D Point2D used to set the
second control point of this curvethe fourth specified p2)Point2D used to set the
end point of this curveSets the location of the end points and control points of this curve
to the specified |
| public void | setCurve(Point2D[]
an array of pts, int Point2D objectsthe index of offset)pts from which to begin setting
the end points and control points of this curve to the
points contained in ptsSets the location of the end points and control points of this curve
to the coordinates of the |
| public void | setCurve(CubicCurve2D
the specified c)CubicCurve2DSets the location of the end points and control points of this curve
to the same as those in the specified |
| public static int | Returns: the number of roots, or -1 if the equation is a constant.an array containing coefficients for a cubic eqn)Solves the cubic whose coefficients are in the |
| public static int | Returns: the number of roots, or -1 if the equation is a constantthe specified array of coefficients to use to solve
the cubic equation eqn, float[] the array that contains the non-complex roots
resulting from the solution of the cubic equation res)Solve the cubic whose coefficients are in the |
| private static float | |
| public void | subdivide(float
the parameter value at which to subdivide the curve t, CubicCurve2D the cubic curve object for storing for the left or
first portion of the subdivided curve left, CubicCurve2D the cubic curve object for storing for the right or
second portion of the subdivided curve right)Subdivides this cubic curve at the given parameter value (expected to be between 0 and 1) and stores the resulting two subdivided curves into the left and right curve parameters. |
| public void | subdivide(CubicCurve2D
the cubic curve object for storing for the left or
first half of the subdivided curve left, CubicCurve2D the cubic curve object for storing for the right or
second half of the subdivided curve right)Subdivides this cubic curve and stores the resulting two subdivided curves into the left and right curve parameters. |
| public static void | subdivide(CubicCurve2D
the cubic curve to be subdivided src, CubicCurve2D the cubic curve object for storing the left or
first half of the subdivided curve left, CubicCurve2D the cubic curve object for storing the right or
second half of the subdivided curve right)Subdivides the cubic curve specified by the |
| public static void | subdivide(float[]
the array holding the coordinates for the source curve src, int the offset into the array of the beginning of the
the 6 source coordinates srcoff, float[] the array for storing the coordinates for the first
half of the subdivided curve left, int the offset into the array of the beginning of the
the 6 left coordinates leftoff, float[] the array for storing the coordinates for the second
half of the subdivided curve right, int the offset into the array of the beginning of the
the 6 right coordinates rightoff)Subdivides the cubic curve specified by the coordinates
stored in the |
| ABOVE | back to summary |
|---|---|
| private static final int ABOVE | |
| BELOW | back to summary |
|---|---|
| private static final int BELOW | |
| ctrlx1 | back to summary |
|---|---|
| public float ctrlx1 The X coordinate of the first control point of the cubic curve segment. | |
| ctrlx2 | back to summary |
|---|---|
| public float ctrlx2 The X coordinate of the second control point of the cubic curve segment. | |
| ctrly1 | back to summary |
|---|---|
| public float ctrly1 The Y coordinate of the first control point of the cubic curve segment. | |
| ctrly2 | back to summary |
|---|---|
| public float ctrly2 The Y coordinate of the second control point of the cubic curve segment. | |
| HIGHEDGE | back to summary |
|---|---|
| private static final int HIGHEDGE | |
| INSIDE | back to summary |
|---|---|
| private static final int INSIDE | |
| LOWEDGE | back to summary |
|---|---|
| private static final int LOWEDGE | |
| x1 | back to summary |
|---|---|
| public float x1 The X coordinate of the start point of the cubic curve segment. | |
| x2 | back to summary |
|---|---|
| public float x2 The X coordinate of the end point of the cubic curve segment. | |
| y1 | back to summary |
|---|---|
| public float y1 The Y coordinate of the start point of the cubic curve segment. | |
| y2 | back to summary |
|---|---|
| public float y2 The Y coordinate of the end point of the cubic curve segment. | |
| CubicCurve2D | back to summary |
|---|---|
| public CubicCurve2D() Constructs and initializes a CubicCurve with coordinates (0, 0, 0, 0, 0, 0, 0, 0). | |
| CubicCurve2D | back to summary |
|---|---|
| public CubicCurve2D(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) Constructs and initializes a
| |
| calcX | back to summary |
|---|---|
| private float calcX(final float t) | |
| calcY | back to summary |
|---|---|
| private float calcY(final float t) | |
| contains | back to summary |
|---|---|
| public boolean contains(float x, float y) Implements abstract com. Doc from com. Tests if the specified coordinates are inside the boundary of the
| |
| contains | back to summary |
|---|---|
| public boolean contains(Point2D p) Overrides com. Doc from com. Tests if a specified | |
| contains | back to summary |
|---|---|
| public boolean contains(float x, float y, float w, float h) Implements abstract com. Doc from com. Tests if the interior of the
The
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.
| |
| copy | back to summary |
|---|---|
| public CubicCurve2D copy() Implements abstract com. Doc from com. Returns a new copy of this
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object obj) Overrides java. Doc from java. Indicates whether some other object is "equal to" this one.
The
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes. | |
| eval | back to summary |
|---|---|
| public Point2D eval(float t) Evaluates this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. 0 corresponds to the start point of the curve and 1 corresponds to the end point of the curve.
| |
| eval | back to summary |
|---|---|
| public void eval(float td, Point2D result) Evaluates this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. 0 corresponds to the start point of the curve and 1 corresponds to the end point of the curve.
| |
| evalCubic | back to summary |
|---|---|
| private static int evalCubic(float[] vals, int num, boolean include0, boolean include1, float[] inflect, float c1, float cp1, float cp2, float c2) | |
| evalDt | back to summary |
|---|---|
| public Point2D evalDt(float t) Evaluates the derivative of this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. 0 corresponds to the derivative at the start point of the curve and 1 corresponds to the derivative at the end point of the curve.
| |
| evalDt | back to summary |
|---|---|
| public void evalDt(float td, Point2D result) Evaluates the derivative of this cubic curve at the given parameter value, where it is expected, but not required, that the parameter will be between 0 and 1. 0 corresponds to the derivative at the start point of the curve and 1 corresponds to the derivative at the end point of the curve.
| |
| fillEqn | back to summary |
|---|---|
| private static void fillEqn(float[] eqn, float val, float c1, float cp1, float cp2, float c2) | |
| findZero | back to summary |
|---|---|
| private static float findZero(float t, float target, float[] eqn) | |
| fixRoots | back to summary |
|---|---|
| private static void fixRoots(float[] res, float[] eqn) | |
| getBounds | back to summary |
|---|---|
| public RectBounds getBounds() Implements abstract com. Doc from com. Note that there is no guarantee that the returned
| |
| getFlatness | back to summary |
|---|---|
| public static float getFlatness(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) Returns the flatness of the cubic curve specified by the indicated control points. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getFlatness | back to summary |
|---|---|
| public static float getFlatness(float[] coords, int offset) Returns the flatness of the cubic curve specified by the control points stored in the indicated array at the indicated index. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getFlatness | back to summary |
|---|---|
| public float getFlatness() Returns the flatness of this curve. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getFlatnessSq | back to summary |
|---|---|
| public static float getFlatnessSq(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) Returns the square of the flatness of the cubic curve specified by the indicated control points. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getFlatnessSq | back to summary |
|---|---|
| public static float getFlatnessSq(float[] coords, int offset) Returns the square of the flatness of the cubic curve specified by the control points stored in the indicated array at the indicated index. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getFlatnessSq | back to summary |
|---|---|
| public float getFlatnessSq() Returns the square of the flatness of this curve. The flatness is the maximum distance of a control point from the line connecting the end points.
| |
| getPathIterator | back to summary |
|---|---|
| public PathIterator getPathIterator(BaseTransform tx) Implements abstract com. Returns an iteration object that defines the boundary of the
shape.
The iterator for this class is not multi-threaded safe,
which means that this
| |
| getPathIterator | back to summary |
|---|---|
| public PathIterator getPathIterator(BaseTransform tx, float flatness) Implements abstract com. Return an iteration object that defines the boundary of the
flattened shape.
The iterator for this class is not multi-threaded safe,
which means that this
| |
| getTag | back to summary |
|---|---|
| private static int getTag(float coord, float low, float high) | |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides java. Doc from java. Returns a hash code value for this object. This method is
supported for the benefit of hash tables such as those provided by
The general contract of
| |
| intersects | back to summary |
|---|---|
| public boolean intersects(float x, float y, float w, float h) Implements abstract com. Doc from com. Tests if the interior of the
The
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.
| |
| inwards | back to summary |
|---|---|
| private static boolean inwards(int pttag, int opt1tag, int opt2tag) | |
| setCurve | back to summary |
|---|---|
| public void setCurve(float x1, float y1, float ctrlx1, float ctrly1, float ctrlx2, float ctrly2, float x2, float y2) Sets the location of the end points and control points
of this curve to the specified
| |
| setCurve | back to summary |
|---|---|
| public void setCurve(float[] coords, int offset) Sets the location of the end points and control points of this curve to the double coordinates at the specified offset in the specified array.
| |
| setCurve | back to summary |
|---|---|
| public void setCurve(Point2D p1, Point2D cp1, Point2D cp2, Point2D p2) Sets the location of the end points and control points of this curve
to the specified
| |
| setCurve | back to summary |
|---|---|
| public void setCurve(Point2D[] pts, int offset) Sets the location of the end points and control points of this curve
to the coordinates of the
| |
| setCurve | back to summary |
|---|---|
| public void setCurve(CubicCurve2D c) Sets the location of the end points and control points of this curve
to the same as those in the specified
| |
| solveCubic | back to summary |
|---|---|
| public static int solveCubic(float[] eqn) Solves the cubic whose coefficients are in the
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.
| |
| solveCubic | back to summary |
|---|---|
| public static int solveCubic(float[] eqn, float[] res) Solve the cubic whose coefficients are in the
| |
| solveEqn | back to summary |
|---|---|
| private static float solveEqn(float[] eqn, int order, float t) | |
| subdivide | back to summary |
|---|---|
| public void subdivide(float t, CubicCurve2D left, CubicCurve2D right) Subdivides this cubic curve at the given parameter value (expected to be between 0 and 1) 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.
| |
| subdivide | back to summary |
|---|---|
| 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.
| |
| subdivide | back to summary |
|---|---|
| public static void subdivide(CubicCurve2D src, CubicCurve2D left, CubicCurve2D right) Subdivides the cubic curve specified by the
| |
| subdivide | back to summary |
|---|---|
| public static void subdivide(float[] src, int srcoff, float[] left, int leftoff, float[] right, int rightoff) Subdivides the cubic curve specified by the coordinates
stored in the
| |