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.

Constructor Detail

CubicCurve2D

protected CubicCurve2D()

This is an abstract class that cannot be instantiated directly.
Type-specific implementation subclasses are available for
instantiation and provide a number of formats for storing
the information necessary to satisfy the various accessor
methods below.

getFlatness

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.

Parameters:

x1 - the X coordinate that specifies the start point
of a CubicCurve2D

y1 - the Y coordinate that specifies the start point
of a CubicCurve2D

ctrlx1 - the X coordinate that specifies the first control point
of a CubicCurve2D

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

Returns:

the flatness of the CubicCurve2D
represented by the specified coordinates.

Since:

1.2

getFlatnessSq

public static double getFlatnessSq(double[] 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.

Parameters:

coords - an array containing coordinates

offset - the index of coords from which to begin
getting the end points and control points of the curve

Returns:

the square of the flatness of the CubicCurve2D
specified by the coordinates in coords at
the specified offset.

Since:

1.2

getFlatness

public static double getFlatness(double[] 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.

Parameters:

coords - an array containing coordinates

offset - the index of coords from which to begin
getting the end points and control points of the curve

Returns:

the flatness of the CubicCurve2D
specified by the coordinates in coords at
the specified offset.

Since:

1.2

getFlatnessSq

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

Returns:

the square of the flatness of this curve.

Since:

1.2

getFlatness

public double getFlatness()

Returns the flatness of this curve. The flatness is the
maximum distance of a control point from the line connecting the
end points.

Returns:

the flatness of this curve.

Since:

1.2

subdivide

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

Since:

1.2

subdivide

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 the left or
first half of the subdivided curve

right - the cubic curve object for storing the right or
second half of the subdivided curve

Since:

1.2

subdivide

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

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

Since:

1.2

solveCubic

public 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. The solved cubic 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
that might be always 0 or never 0 from an equation that has no
zeroes.

Parameters:

eqn - an array containing coefficients for a cubic

Returns:

the number of roots, or -1 if the equation is a constant.

Since:

1.2

solveCubic

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

Parameters:

eqn - the specified array of coefficients to use to solve
the cubic equation

res - the array that contains the non-complex roots
resulting from the solution of the cubic equation

true if the specified Point2D is
inside the boundary of the Shape;
false otherwise.

Since:

1.2

intersects

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.

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 - the X coordinate of the upper-left corner
of the specified rectangular area

y - the Y coordinate of the upper-left corner
of the specified rectangular area

w - the width of the specified rectangular area

h - the height of the specified rectangular area

Returns:

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.

intersects

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.

contains

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 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 - the X coordinate of the upper-left corner
of the specified rectangular area

y - the Y coordinate of the upper-left corner
of the specified rectangular area

w - the width of the specified rectangular area

h - the height of the specified rectangular area

Returns:

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.

contains

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.

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.

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.

Note that the
definition of insideness can lead to situations where points
on the defining outline of the shape may not be considered
contained in the returned bounds object, but only in cases
where those points are also not considered contained in the original
shape.

If a point is inside the shape according to the
contains(point) method, then
it must be inside the returned Rectangle bounds object
according to the contains(point)
method of the bounds. Specifically:

shape.contains(x,y) requires bounds.contains(x,y)

If a point is not inside the shape, then it might
still be contained in the bounds object:

getPathIterator

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

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