- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionstatic Point2D
split
(double[] first, double[] second, double t, int degree, double x, double y, double[] coords) Split a Bézier curve of degree n at a point t∈[0,1].static void
split
(int type, double startX, double startY, double[] coords, int offset, double[] scoords, int soffset, double u) Split a path segment with 2 dimensions into two parts.static void
split
(int type, double startX, double startY, double startZ, double[] coords, int offset, double[] scoords, int soffset, double u) Split a path segment with 3 dimensions into two parts.static Path2D[]
Split a path (2 dimensions).static Path2D[]
split
(Path2D path, AffineTransform at) Split a path (2 dimensions) with an affine transformation.static Path3D[]
Split a path (3 dimensions).static Path3D[]
split
(Path3D path, AffineTransform3D at) Split a path (3 dimensions) with an affine transformation.static Path2D
Get a subpath of a path with 2 dimensions.static Path2D
Get a subpath of a path with 2 dimensions, specifying path parameters by a segment index and a path parameter specific to that index.static Path3D
Get a subpath of a path with three dimensions.static Path3D
Get a subpath of a path with three dimensions, specifying path parameters by a segment index and a path parameter specific to that index.
-
Method Details
-
split
Split a path (2 dimensions). The paths end in two ways. If a path-segment's type isPathIterator.SEG_CLOSE
, a new path starts, optionally with segment whose type isPathIterator.SEG_MOVETO
. If aPathIterator.SEG_MOVETO
segment is not preceded by aPathIterator.SEG_CLOSE
segment, thePathIterator.SEG_MOVETO
segment becomes the first segment in the next path.- Parameters:
path
- the path to split- Returns:
- an array of subpaths
-
split
Split a path (2 dimensions) with an affine transformation. The paths end in two ways. If a path-segment's type isPathIterator.SEG_CLOSE
, a new path starts, optionally with segment whose type isPathIterator.SEG_MOVETO
. If aPathIterator.SEG_MOVETO
segment is not preceded by aPathIterator.SEG_CLOSE
segment, thePathIterator.SEG_MOVETO
segment becomes the first segment in the next path.- Parameters:
path
- the path to splitat
- the affine transformation to apply to the path's components; null if there is none- Returns:
- an array of subpaths
-
split
Split a path (3 dimensions). The paths end in two ways. If a path-segment's type isPathIterator3D.SEG_CLOSE
, a new path starts, optionally with segment whose type isPathIterator3D.SEG_MOVETO
. If aPathIterator3D.SEG_MOVETO
segment is not preceded by aPathIterator3D.SEG_CLOSE
segment, thePathIterator3D.SEG_MOVETO
segment becomes the first segment in the next path.- Parameters:
path
- the path to split- Returns:
- an array of subpaths
-
split
Split a path (3 dimensions) with an affine transformation. The paths end in two ways. If a path-segment's type isPathIterator3D.SEG_CLOSE
, a new path starts, optionally with segment whose type isPathIterator3D.SEG_MOVETO
. If aPathIterator3D.SEG_MOVETO
segment is not preceded by aPathIterator3D.SEG_CLOSE
segment, thePathIterator3D.SEG_MOVETO
segment becomes the first segment in the next path.- Parameters:
path
- the path to splitat
- the affine transformation to apply to the path's components; null if there is none- Returns:
- an array of subpaths
-
split
public static void split(int type, double startX, double startY, double[] coords, int offset, double[] scoords, int soffset, double u) Split a path segment with 2 dimensions into two parts. The path parameter u is the fractional distance at which the split occurs, measured from the start of the line segment to its end. The parameter u must be in the range [0,1]. The X, and Y coordinates of each control point are adjacent in the coords array in that order. the 0th control point's coordinates are (startX,startY). The coords array provides the other control points with the first followed by the second. This is the same order used byPathIterator.currentSegment(double[])
.The scoords argument contains control points from the split curves, denoted as the first curve and second curve. The scoords argument contains the first control point of the first curve, followed by its second and control point if present. This last control point is also the 0th control point of the second curve. The remainder of the scoords array contains the first control point of the second curve followed by the second and control points, if present, of the second curve. For eac control point, the array contains that control point's X coordinate, followed by its Y coordinate. The 0th control point for the original curve is the 0th control point for the first curve and is not copied into the scoords array.
The minimum length for the coords array is 6 and the minimum length for the scoords array is 12.
- Parameters:
type
- the segment type (PathIterator.SEG_LINETO
,PathIterator.SEG_QUADTO
, orPathIterator.SEG_CUBICTO
)startX
- the starting X coordinatestartY
- the starting Y coordinatecoords
- an array containing the remaining control pointsoffset
- the offset for the 1st control pointscoords
- an array containing the control points for a pair of Bézier curves.soffset
- the offset for the 0th control point of the first cubic B&ecute;zier curve of the pair of curves createdu
- the path parameter at which a curve is to be split- Throws:
IllegalArgumentException
- a parameter was out of range
-
split
public static void split(int type, double startX, double startY, double startZ, double[] coords, int offset, double[] scoords, int soffset, double u) Split a path segment with 3 dimensions into two parts. The path parameter u is the fractional distance at which the split occurs, measured from the startof the line segment to its end. The parameter u must be in the range [0,1]. The X, Y, and Z coordinates of each control point are adjacent in the coords array in that order. the 0th control point's coordinates are (startX,startY,startZ). The coords array provides the other control points with the first followed by the second. This is the same order used byPathIterator3D.currentSegment(double[])
.The scoords argument contains control points from the split curves, denoted as the first curve and second curve. The scoords argument contains the first control point of the first curve, followed by its second and third control points if present. The last of these control points is also the 0th control point of the second curve. The remainder of the scoords array contains the first control point of the second curve followed by the second and thir control point of the second curve if present. For each control point, the array contains that control point's X coordinate, followed by its Y coordinate, and finally its Z coordinate. The* 0th control point for the original curve is the 0th control point for the first curve and is not copied into the scoords array.
The minimum length for the coords array is 9 and the minimum length for the scoords array is 18.
- Parameters:
type
- the segment type (PathIterator3D.SEG_LINETO
,PathIterator3D.SEG_QUADTO
, orPathIterator3D.SEG_CUBICTO
)startX
- the starting X coordinatestartY
- the starting Y coordinatestartZ
- the starting Z coordinatecoords
- an array containing the remaining control pointsoffset
- the offset for the 1st control pointscoords
- an array containing the control points for a pair of Bézier curves.soffset
- the offset for the 0th control point of the first cubic B&ecute;zier curve of the pair of curves createdu
- the path parameter at which a curve is to be split
-
split
public static Point2D split(double[] first, double[] second, double t, int degree, double x, double y, double[] coords) Split a Bézier curve of degree n at a point t∈[0,1]. After the split, the first curve's initial point will be (x, y) and its remaining control points will be in the arrayfirst
. The second curve's initial point will be returned and its remaining control points will be in the arraysecond
. For all the arrays, the initial point of the curve is excluded and the array contains the remaining control points in order, with X values immediately followed by the corresponding Y values, the same convention used by thePathIterator
interface.See A Primer on Bézier Curves for a description of how to use de Casteljau's algorithm for splitting a Bézier curve.
- Parameters:
first
- the control point array for the first curve; null if these control points should not be computedsecond
- the control point array for the second curve; null if these control points should not be computedt
- the point at which the curve is splitdegree
- the degree of the initial Bézier curvex
- the starting X coordinate for the initial Bézier curvey
- the starting Y coordinate for the initial Bézier curvecoords
- the coordinates for the remaining control points for the initial Bézier curve, where the control points appear in order as pairs of X followed by Y coordinates- Returns:
- the initial point of the second curve; null if the argument
second
is null
-
subpath
Get a subpath of a path with 2 dimensions. The path returned will be the same as a portion of the path provided in the first argument. The path parameters are those for the path provided by this method's first argument. For the ith segment in a path, The value of a path parameter is (i + u) where u ∈ [0,1].- Parameters:
path
- the path whose subpath will be computedu1
- the path parameter determining the start of the new pathu2
- the path parameter determining the end of the new path.- Returns:
- the subpath
- Throws:
IllegalArgumentException
-
subpath
Get a subpath of a path with 2 dimensions, specifying path parameters by a segment index and a path parameter specific to that index.- Parameters:
path
- the path whose subpath will be computedstart
- the index for the path segment determining the start of the new pathu1
- the path parameter for segmentstart
determining the start of the new path, with a range of [0,1]end
- the index for the path segment determining the end of the new pathu2
- the path parameter for segmentend
determining the end of the new path, with a range of [0,1]- Returns:
- the subpath
-
subpath
Get a subpath of a path with three dimensions. The path parameters are those for the path provided by this method's first argument. For the ith segment in a path, The value of a path parameter is (i + u) where u ∈ [0,1].- Parameters:
path
- the path whose subpath will be computedu1
- the path parameter determining the start of the new pathu2
- the path parameter determining the end of the new path.- Returns:
- the subpath
- Throws:
IllegalArgumentException
-
subpath
Get a subpath of a path with three dimensions, specifying path parameters by a segment index and a path parameter specific to that index.- Parameters:
path
- the path whose subpath will be computedstart
- the index for the path segment determining the start of the new pathu1
- the path parameter for segmentstart
determining the start of the new path, with a range of [0,1]end
- the index for the path segment determining the end of the new pathu2
- the path parameter for segmentend
determining the end of the new path, with a range of [0,1]- Returns:
- the subpath
-