-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classClass defining a list entry describing a path segment.static final classClass to store values used in computations on a segment of a path.static final classClass to represent a value of the path parameter u. -
Method Summary
Modifier and TypeMethodDescriptionstatic doublecubicLength(double u, double x0, double y0, double z0, double[] coords) Compute the length of a cubic path segment from its start to a position specified by the path parameterstatic RealValuedFunctOpscubicLengthFunction(double x0, double y0, double z0, double[] coords) Compute a function that provides the length of a cubic path segment from its start to a position specified by the path parameter.static doublecurvature(double u, double x0, double y0, double z0, int type, double[] coords) Compute the curvature given path-segment parameters.booleancurvatureExists(double u, double x0, double y0, double z0, int type, double[] coords) Determine if the arguments allow the curvature to be computed.static doubled2sDu2(double u, double x0, double y0, double z0, int type, double[] coords) Compute the second derivative of the path length s with respect to u given path-segment parameters.static doubled2xDu2(double u, double x0, double y0, double z0, int type, double[] coords) Compute the second derivative of x with respect to u given path-segment parameters.static doubled2yDu2(double u, double x0, double y0, double z0, int type, double[] coords) Compute the second derivative of y with respect to u given path-segment parameters.static doubled2zDu2(double u, double x0, double y0, double z0, int type, double[] coords) Compute the second derivative of z with respect to u given path-segment parameters.static doubled3xDu3(double u, double x0, double y0, double z0, int type, double[] coords) Compute the third derivative of x with respect to u given path-segment parameters.static doubled3yDu3(double u, double x0, double y0, double z0, int type, double[] coords) Compute the third derivative of y with respect to u given path-segment parameters.static doubled3zDu3(double u, double x0, double y0, double z0, int type, double[] coords) Compute the third derivative of z with respect to u given path-segment parameters.static doubledsDu(double u, double x0, double y0, double z0, int type, double[] coords) Compute the derivative of the path length s with respect to the path's parameter u given path-segment parameters.static doubledxDu(double u, double x0, double y0, double z0, int type, double[] coords) Compute dx/du given path-segment parameters.static doubledyDu(double u, double x0, double y0, double z0, int type, double[] coords) Compute dy/du given path-segment parameters.static doubledzDu(double u, double x0, double y0, double z0, int type, double[] coords) Compute dz/du given path-segment parameters.static voidelevateDegree(int degree, double[] result, double x, double y, double z, double[] coords) Elevate the degree of a three-dimensional Bézier curve of degree n by 1, specifying the last n control points in an array.static voidelevateDegree(int degree, double[] result, int rOffset, double[] coords, int cOffset) Elevate the degree of a three-dimensional Bézier curve by 1.static booleangetBinormal(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the binormal vector for a given value of the path parameter and an offset for the array storing the normal vector.static double[]getControlPoints(Path3D path, boolean all) List the control points of a path.static double[]getControlPoints(Path3D path, boolean all, boolean asCubic) List the control points of a path, optionally treating each segment of the path as a cubic segment.static double[]getControlPoints(PathIterator3D pit, boolean all) List the control points of a path specified by a path iterator.static double[]getControlPoints(PathIterator3D pit, boolean all, boolean asCubic) List the control points of a path provided by a path iterator, optionally treating each segment of the path as a cubic segment.static List<Path3DInfo.Entry>getEntries(Path3D p) Get a list of entries describing a path's segments or those for the outline of a shape.static List<Path3DInfo.Entry>getEntries(Path3D p, Transform3D at) Get a list of entries describing a path's segments or those for the outline of a shape, modified by an affine transform.static booleangetFirstTNB(Path3D path, double[] tangent, double[] normal, double[] binormal) Get the tangent vector, normal vector, and binormal vector of the first point along a path where all three exist.static booleangetNormal(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the normal vector for a given value of the path parameter and an offset for the array storing the normal vector.static PathIterator3DgetPathIterator(AffineTransform3D af, CubicSpline x, CubicSpline y, CubicSpline z) Get a 3D path iterator for the path implied by three cubic splines.static booleangetStartingTangent(Path3D path, double[] tangent) Get the first point on the first segment of a path where a tangent vector exists.static booleangetTangent(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the tangent vector for a specified value of the path parameter and an output-array offset.static StringgetTypeString(int type) Get the type of a path-iterator item, formatted as a stringstatic doublegetX(double u, double x0, double y0, double z0, int type, double[] coords) Compute the x coordinate of a point on the path given path-segment parameters.static doublegetY(double u, double x0, double y0, double z0, int type, double[] coords) Compute the y coordinate of a point on a path given path-segment parameters.static doublegetZ(double u, double x0, double y0, double z0, int type, double[] coords) Compute the z coordinate of a point on a path given path-segment parameters.static booleanDetermine if the first continuous portion of a path is closed.static intCount the number of segments in the first continuous portion of a path that are Drawable.static doublepathLength(Path3D path) Compute the length of a path or the length of an outline of a shape.static doublepathLength(Path3D path, int start, int end) Compute the length of a path or the length of an outline of a shape for a given range of path/outline segments.static doublepathLength(Path3D path, Transform3D at) Compute the length of a path or the length of an outline of a shape, modified by an affine transform.static doublepathLength(Path3D path, Transform3D at, int start, int end) Compute the length of a path or the length of an outline of a shape for a given range of path/outline segments, modified by an affine transform.static voidprintSegments(Appendable appendable, Path3D s) Print information about the segments that make up a path or an outline of a shape.static voidprintSegments(String prefix, Appendable appendable, Path3D s) Print information about the segments that make up a path or the outline of a shape, adding a prefix.static voidPrint information about the segments that make up a path, or the outline of a shape, to the standard output.static doublequadLength(double u, double x0, double y0, double z0, double[] coords) Compute the length of a quadratic path segment from its start to a position specified by the path parameter.static RealValuedFunctOpsquadLengthFunction(double x0, double y0, double z0, double[] coords) Provide a function that computes the length of a quadratic path segment from its start to a position specified by a path parameter.static doublesegmentLength(double u, int type, double x0, double y0, double z0, double[] coords) Get the length of a subpath of a path segment.static doublesegmentLength(int type, double x0, double y0, double z0, double[] coords) Compute the length of a segment given parameters describing it.static doublesegmentLength(Path3D p, int segment) Get the length of the ith segment of a path or of a shape's outline.static RealValuedFunctOpssegmentLengthFunction(int type, double x0, double y0, double z0, double[] coords) Provide a function to compute the length of a subpath of a path segment.
-
Method Details
-
segmentLength
public static double segmentLength(double u, int type, double x0, double y0, double z0, double[] coords) throws IllegalArgumentException Get the length of a subpath of a path segment.When the path parameter is
PathIterator3D.SEG_CLOSE, the array must contain the X, Y, and Z coordinates of the path's initial point in that order.- Parameters:
u- the path parameter for the end of the subpath which includes all points on the path whose path parameters are in the range [0, 1.0]type- eitherPathIterator3D.SEG_MOVETOPathIterator3D.SEG_LINETO,PathIterator3D.SEG_QUADTO,PathIterator3D.SEG_CUBICTO, orPathIterator3D.SEG_CLOSEx0- the X coordinate at the start of the segmenty0- the Y coordinate at the start of the segmentz0- the X coordinate at the start of the segmentcoords- the remaining control points, with the X coordinate followed immediately by the Y coordinate and then the Z coordinate for each- Returns:
- the path-segment length
- Throws:
IllegalArgumentException- if the type argument is not recognized or if the fifth argument is null or is too short
-
segmentLengthFunction
public static RealValuedFunctOps segmentLengthFunction(int type, double x0, double y0, double z0, double[] coords) throws IllegalArgumentException, ArithmeticException Provide a function to compute the length of a subpath of a path segment.When the path parameter is
PathIterator3D.SEG_CLOSE, the array must contain the X, Y, and Z coordinates of the path's initial point in that order.- Parameters:
type- eitherPathIterator3D.SEG_MOVETOPathIterator3D.SEG_LINETO,PathIterator3D.SEG_QUADTO,PathIterator3D.SEG_CUBICTO, orPathIterator3D.SEG_CLOSEx0- the X coordinate at the start of the segmenty0- the Y coordinate at the start of the segmentz0- the X coordinate at the start of the segmentcoords- the remaining control points, with the X coordinate followed immediately by the Y coordinate and then the Z coordinate for each- Returns:
- a function that will compute the length of a subsegment of a path segement from the segment's start to the point specified by a path parameter provided as the function's argument
- Throws:
IllegalArgumentException- if the type argument is not recognized or if the fifth argument is null or is too shortArithmeticException- if a real-valued function could not be provided
-
quadLength
public static double quadLength(double u, double x0, double y0, double z0, double[] coords) Compute the length of a quadratic path segment from its start to a position specified by the path parameter.- Parameters:
u- the path parameter in the range [0.0, 1.0]x0- the X coordinate of the first control pointy0- the Y coordinate of the first control pointz0- the Z coordinate of the first control pointcoords- the remaining control points in order, with each control point represented by 3 consecutive elements containing a control point's X coordinate, Y coordinate, and Z coordinate respectively (only the first 6 indices will be used)- Returns:
- the path length from u = 0 to the given value of u.
-
quadLengthFunction
public static RealValuedFunctOps quadLengthFunction(double x0, double y0, double z0, double[] coords) Provide a function that computes the length of a quadratic path segment from its start to a position specified by a path parameter.- Parameters:
x0- the X coordinate of the first control pointy0- the Y coordinate of the first control pointz0- the Z coordinate of the first control pointcoords- the remaining control points in order, with each control point represented by 3 consecutive elements containing a control point's X coordinate, Y coordinate, and Z coordinate respectively (only the first 6 indices will be used)- Returns:
- a function of the path parameter providing the length of a path segment from its start to the point specified by the path parameter provided as the function's argument
-
cubicLength
public static double cubicLength(double u, double x0, double y0, double z0, double[] coords) Compute the length of a cubic path segment from its start to a position specified by the path parameter- Parameters:
u- the path parameter in the range [0.0, 1.0]x0- the X coordinate of the first control pointy0- the Y coordinate of the first control pointz0- the Z coordinate of the first control pointcoords- the remaining control points in order, with each control point represented by 3 consecutive elements containing a control point's X coordinate, Y coordinate, and Z coordinate respectively (only the first 9 indices will be used)- Returns:
- the path length from u = 0 to the given value of u.
-
cubicLengthFunction
public static RealValuedFunctOps cubicLengthFunction(double x0, double y0, double z0, double[] coords) Compute a function that provides the length of a cubic path segment from its start to a position specified by the path parameter.- Parameters:
x0- the X coordinate of the first control pointy0- the Y coordinate of the first control pointz0- the Z coordinate of the first control pointcoords- the remaining control points in order, with each control point represented by 3 consecutive elements containing a control point's X coordinate, Y coordinate, and Z coordinate respectively (only the first 9 indices will be used)- Returns:
- a function of the path parameter that computes the length of a path segment from its start to the point corresponding to the path parameter provided as the function's argument
-
getControlPoints
List the control points of a path. If a path is closed and the last control point before a SEG_CLOSE segment matches the preceding SEG_MOVE segment, that control point is not included in the list.- Parameters:
path- the pathall- true if all control points are included; false if only the control points starting or ending a segment are included- Returns:
- an array containing the control points, each as a triplet of values where each triplet consists of a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinate
-
getControlPoints
List the control points of a path, optionally treating each segment of the path as a cubic segment. If a path is closed and the last control point before a SEG_CLOSE segment matches the preceding SEG_MOVE segment, that control point is not included in the list.The third argument
asCubichas no effect on the results when the second argumentallhas the valuefalse.- Parameters:
path- the pathall- true if all control points are included; false if only the control points starting or ending a segment are includedasCubic- true if each linear or quadratic segment is elevated to be a cubic Bézier segment; false otherwise- Returns:
- an array containing the control points, each as a pair of values
-
getControlPoints
List the control points of a path specified by a path iterator. If a path is closed and the last control point before a SEG_CLOSE segment matches the preceding SEG_MOVE segment, that control point is not included in the list.- Parameters:
pit- the path iterator providing the control pointsall- true if all control points are included; false if only the control points starting or ending a segment are included- Returns:
- an array containing the control points, each as a pair of values
-
getControlPoints
List the control points of a path provided by a path iterator, optionally treating each segment of the path as a cubic segment. If a path is closed and the last control point before a SEG_CLOSE segment matches the preceding SEG_MOVE segment, that control point is not included in the list.The third argument
asCubichas no effect on the results when the second argumentallhas the valuefalse.- Parameters:
pit- the path iterator providing the control pointsall- true if all control points are included; false if only the control points starting or ending a segment are includedasCubic- true if each linear or quadratic segment is elevated to be a cubic Bézier segment; false otherwise- Returns:
- an array containing the control points, each as a triplet of values where each triplet consists of a control point's X coordinate, followed by its Y coordinate, followed by its Z coordinate
-
getPathIterator
public static PathIterator3D getPathIterator(AffineTransform3D af, CubicSpline x, CubicSpline y, CubicSpline z) Get a 3D path iterator for the path implied by three cubic splines. The splines must have the same number of knots.- Parameters:
af- the affine transform to apply to the path iterator; null is equivalent to an identity transformx- the cubic spline for the X coordinatesy- the cubic spline for the Y coordinatesz- the cubic spline for the Z coordinates- Returns:
- the path iterator
-
elevateDegree
public static void elevateDegree(int degree, double[] result, int rOffset, double[] coords, int cOffset) Elevate the degree of a three-dimensional Bézier curve by 1. The algorithm is describe in Degree Elevation of a Bézier Curve. The length of the coords array must be at least 3*(degree+1), whereas the length of the result array must be at least 3*(degree+2).Control points are stored so that the x, y, and z coordinates for control point i/3 are in array locations i, i+1, and i+2 where i = 0 (mod 3).
- Parameters:
degree- the degree of the original curveresult- an array storing the control points for an the new curverOffset- the offset into the result array at which the control points for the new curve will be storedcoords- the array containing the control points for the original curvecOffset- the offset into the coords array at which the control points for the original curve start
-
elevateDegree
public static void elevateDegree(int degree, double[] result, double x, double y, double z, double[] coords) Elevate the degree of a three-dimensional Bézier curve of degree n by 1, specifying the last n control points in an array. The length of the result array must be at least 3*(n+1), whereas the length of the coords array must be at least 3*n. The algorithm is describe in Degree Elevation of a Bézier Curve.Control points are stored so that the x, y, and z coordinates for control point (i/3)+1 are in array locations i, i+1, and i+2 respectively, where i = 0 (mod 3).
- Parameters:
degree- the degree of the curveresult- an array storing the last n control points for an the new curve, which excludes its starting pointx- the X coordinate for the start of the curve (control point 0)y- the Y coordinate for the start of the curve (control point 0)z- the Z coordinate for the start of the curve (control point 0)coords- the array containing the last n-1 control points for the original curve, which excludes its starting point
-
getX
public static double getX(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the x coordinate of a point on the path given path-segment parameters. When the type is SEG_MOVETO, x0 and y0 are ignored. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO, and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of the x coordinate
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
getY
public static double getY(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the y coordinate of a point on a path given path-segment parameters. When the type is SEG_MOVETO, x0 and y0 are ignored. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of the y coordinate
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
getZ
public static double getZ(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the z coordinate of a point on a path given path-segment parameters. When the type is SEG_MOVETO, x0 and y0 are ignored. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of the y coordinate
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
dxDu
public static double dxDu(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute dx/du given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of dx/ds
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
dyDu
public static double dyDu(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute dy/du given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of dy/du
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
dzDu
public static double dzDu(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute dz/du given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0;type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of dy/du
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
dsDu
public static double dsDu(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the derivative of the path length s with respect to the path's parameter u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of ds/du
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d2xDu2
public static double d2xDu2(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the second derivative of x with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2x/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d2yDu2
public static double d2yDu2(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the second derivative of y with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2y/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d2zDu2
public static double d2zDu2(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the second derivative of z with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2y/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d3xDu3
public static double d3xDu3(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the third derivative of x with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.Note: the value is 0.0 except for a cubic segment, where it is constant for u in the range [0.0, 1.0]. Curves with torsion should be represented by cubic Bézier curves for accuracy.
- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2x/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d3yDu3
public static double d3yDu3(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the third derivative of y with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.Note: the value is 0.0 except for a cubic segment, where it is constant for u in the range [0.0, 1.0]. Curves with torsion should be represented by cubic Bézier curves for accuracy.
- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2y/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d3zDu3
public static double d3zDu3(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the third derivative of z with respect to u given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.Note: the value is 0.0 except for a cubic segment, where it is constant for u in the range [0.0, 1.0]. Curves with torsion should be represented by cubic Bézier curves for accuracy.
- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2y/du2;
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
d2sDu2
public static double d2sDu2(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the second derivative of the path length s with respect to u given path-segment parameters. When the type is SEG_CLOSE, the first two elements of the fifth argument (coords) must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO.The returned value will be Double.NaN in cases where division by zero would occur, such as when the initial point for a segment and the control points and final point given by the array argument are identical. The most likely case is when the type is
PathIterator3D.SEG_CLOSE.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the value of d2s/du2; Double.NaN if
not defined but zero if the type is
PathIterator3D.SEG_MOVETO - Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null- See Also:
-
curvature
public static double curvature(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException Compute the curvature given path-segment parameters. The type may not be SEG_MOVETO. When the type is SEG_CLOSE, the first two elements of coords must be set to the x and y coordinate respectively for the point provided by most recent segment whose type is SET_MOVETO. The curvature is given by the expression
where the derivative are computed with respect to the path parameter. The radius of curvature is the multiplicative inverse of the absolute value of the curvature.sqrt((z"y'-y"z')2 + (x"z'-z"x')2 + (y"x'-x"y')2) / (x'2 + y'2 + z'2)3/2
- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the curvature; Double.NaN if not defined (this may happen if a line segment has zero length)
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueArrayIndexOutOfBoundsException- the array argument was two smallNullPointerException- the array argument was null
-
curvatureExists
public boolean curvatureExists(double u, double x0, double y0, double z0, int type, double[] coords) throws IllegalArgumentException, NullPointerException, IndexOutOfBoundsException Determine if the arguments allow the curvature to be computed. The curvature cannot be computed when the type is PathIterator3D.SEG_MOVETO or when the control points provided by the array match the initial values x0 and y0.- Parameters:
u- the path-segment parameter in the range [0,1]x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the curvature; Double.NaN if not defined (this may happen if a line segment has zero length)
- Throws:
IllegalArgumentException- u is out of range or the type does not have a legal valueNullPointerExceptionIndexOutOfBoundsException
-
getTangent
public static boolean getTangent(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the tangent vector for a specified value of the path parameter and an output-array offset. If the tangent vector does not exist (e.g., the length of the line does not vary with the path parameter), the tangent vector will be set to zero. The tangent vector will have unit length if it is not zero.- Parameters:
u- the path-segment parameter in the range [0,1]array- an array of length no less than 3 used to store the tangent vector, with array[offset] containing the tangent vector's X component and array[offset+1] containing the tangent vector's Y componentoffset- the index into the array at which to store the tangent vectorx0- the X coordinate of the point on the segment for u = 0y0- the Y coordinate of the point on the segment for u = 0z0- the Z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0], coords[1], and coords[2] set to the X, Y, and Z coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- true if the tangent vector exists; false if the tangent vector does not exist
-
getNormal
public static boolean getNormal(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the normal vector for a given value of the path parameter and an offset for the array storing the normal vector. The normal vector N is a vector of unit length, perpendicular to the tangent vector, and oriented so that d2r/ds2 = κN where κ is the curvature. If the normal vector does not exist (e.g., the length of the line does not vary with the path parameter), the normal vector will not be changed.- Parameters:
u- the path-segment parameter in the range [0,1]array- an array of length no less than 3 used to store the normal vector, with array[offset] containing the normal vector's X component, array[offset+1] containing the normal vector's Y component, and array[offset + 2] containing the normal vector's Y componentoffset- the index into the array at which to store the normal vectorx0- the X coordinate of the point on the segment for u = 0y0- the Y coordinate of the point on the segment for u = 0z0- the Y coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO, and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator3D, but with coords[0], coords[1], and coords[2] set to the X, Y, and Z coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- true if the normal vector exists; false if the normal vector does not exist
-
getBinormal
public static boolean getBinormal(double u, double[] array, int offset, double x0, double y0, double z0, int type, double[] coords) Get the binormal vector for a given value of the path parameter and an offset for the array storing the normal vector. The binormal vector is defined as the cross product T × N of the tangent vector T and the normal vector N. If the binormal vector does not exist (e.g., the length of the line does not vary with the path parameter or the path is locally straight), the binormal vector will be set to zero.- Parameters:
u- the path-segment parameter in the range [0,1]array- an array of length no less than 3 used to store the normal vector, with array[offset] containing the normal vector's X component, array[offset+1] containing the normal vector's Y component, and array[offset + 2] containing the normal vector's Y componentoffset- the index into the array at which to store the normal vectorx0- the X coordinate of the point on the segment for u = 0y0- the Y coordinate of the point on the segment for u = 0z0- the Y coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO, and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator3D, but with coords[0], coords[1], and coords[2] set to the X, Y, and Z coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- true if the normal vector exists; false if the normal vector does not exist
-
getTypeString
Get the type of a path-iterator item, formatted as a string- Parameters:
type- the path-iterator type as an integer- Returns:
- a string describing the type
-
pathLength
Compute the length of a path or the length of an outline of a shape. This is the sum of the the lengths of all the path or outline segments. A shape's outline may pass through the shape, so this method does not reliably compute the circumference of a shape.- Parameters:
path- the path- Returns:
- the path length
-
pathLength
Compute the length of a path or the length of an outline of a shape, modified by an affine transform. This is the sum of the the lengths of all the path or outline segments. A shape's outline may pass through the shape, so this method does not reliably compute the circumference of a shape.- Parameters:
path- the pathat- the affine transform; null if none is to be used- Returns:
- the path length
-
pathLength
Compute the length of a path or the length of an outline of a shape for a given range of path/outline segments. This is the sum of the the lengths of all the path segments whose indices are in the interval [start, end) with start < end. Some of the segments for a shape may pass though the interior of the shape.- Parameters:
path- the pathstart- the starting indexend- the index just past the last index counted- Returns:
- the length of the portion of a path in the specified interval
-
pathLength
Compute the length of a path or the length of an outline of a shape for a given range of path/outline segments, modified by an affine transform. This is the sum of the the lengths of all the path segments whose indices are in the interval [start, end) with start < end. Some of the segments for a shape may pass though the interior of the shape.- Parameters:
path- the pathat- the affine transform; null if none is to be usedstart- the starting indexend- the index just past the last index counted- Returns:
- the length of the portion of a path in the specified interval
-
segmentLength
public static double segmentLength(int type, double x0, double y0, double z0, double[] coords) Compute the length of a segment given parameters describing it.- Parameters:
x0- the x coordinate of the point on the segment for u = 0y0- the y coordinate of the point on the segment for u = 0z0- the z coordinate of the point on the segment for u = 0type- the segment type as defined byPathIterator3D(values may be PathIterator3D.SEG_MOVETO, PathIterator3D.SEG_LINETO, PathIterator3D.SEG_QUADTO, PathIterator3D.SEG_CUBICTO and PathIterator3D.SEG_CLOSE)coords- the coordinates array as defined byPathIterator, but with coords[0] and coords[1] set to the x and y coordinates respectively for the last MOVETO operation when the type is PathIterator3D.SEG_CLOSE- Returns:
- the segment length
-
segmentLength
Get the length of the ith segment of a path or of a shape's outline. For a shape, some of the segments may pass through the interior of the shape.- Parameters:
p- the path or shapesegment- the segment number from 0 up to but not including the number of segments- Returns:
- the segment length
-
getEntries
Get a list of entries describing a path's segments or those for the outline of a shape.- Parameters:
p- the path or shape- Returns:
- the list of entries
-
getEntries
Get a list of entries describing a path's segments or those for the outline of a shape, modified by an affine transform.- Parameters:
p- the path or shapeat- the affine transform; null if none is to be used- Returns:
- the list of entries
-
printSegments
Print information about the segments that make up a path, or the outline of a shape, to the standard output. Entry i contains the x and y coordinate when the parameter is equal to i, followed by control points, the last of which is the coordinate when the parameter is i+1.- Parameters:
s- the shape or path
-
printSegments
Print information about the segments that make up a path or an outline of a shape. Entry i contains the x and y coordinate when the parameter is equal to i, followed by control points, the last of which is the coordinate when the parameter is i+1.- Parameters:
appendable- an Appendable on which to prints- the shape or path
-
printSegments
Print information about the segments that make up a path or the outline of a shape, adding a prefix. Entry i contains the x and y coordinate when the parameter is equal to i, followed by control points, the last of which is the coordinate when the parameter is i+1.- Parameters:
prefix- a prefix to print at the start of each line (null implies an empty string)appendable- the appendable for outputs- the shape or path
-
numberOfDrawableSegments
Count the number of segments in the first continuous portion of a path that are Drawable. Drawable segments exclude PathIterator3D.SEG_MOVETO segments and PathIterator3D.SEG_CLOSE segments whose current point is the same as that of a previous PathIterator3D.SEG_MOVETO segment. The test ignores any segments after a second PathIterator3D.SEG_MOVE, excluding an initial set of back-to-back PathIterator3D.SEG_MOVE segments, or a first PathIterator3D.SEG_CLOSE. If the last point is the segment preceding a PathIterator3D.SEG_CLOSE segment is equal to t he initial segment (whose type is first PathIterator3D.SEG_MOVETO), the terminating PathIterator3D.SEG_CLOSE segment is not included in the count.- Parameters:
path- the path- Returns:
- true if the path is closed; false otherwise
- Throws:
IllegalStateException- if the path does not start with a segment whose type is PathIterator3D.SEG_MOVE.
-
isClosed
Determine if the first continuous portion of a path is closed. The test ignores any segments- Parameters:
path- the path- Returns:
- true if the path is closed; false otherwise
-
getFirstTNB
public static boolean getFirstTNB(Path3D path, double[] tangent, double[] normal, double[] binormal) Get the tangent vector, normal vector, and binormal vector of the first point along a path where all three exist.A path can be represented as a function P(s) that specifies a point as a function of the distance along a path. The tangent vector T = dP/ds points in the direction of an increasing path parameter. The normal vector is perpendicular to the tangent vector and is equal to (1/κ)(dT/ds) where s is the distance along the path. The binormal vector B is equal to the cross product T × N. All are unit vectors. Because dT/ds and κ, are zero for a straight-line segment, these segments do not have a unique normal vector. As a result, initial straight-line segments are skipped
A precondition is that the path must be such that its tangent vector is a continuous function of the path parameter, and the tangent function should be a differentiable function as well, which implies that successive straight-line segments should have the same tangent vectors.
- Parameters:
path- the pathtangent- the tangent vector; null if not wantednormal- the normal vector; null if not wantedbinormal- the binormal vector; null if not wanted- Returns:
- true on success; false on failure
-
getStartingTangent
Get the first point on the first segment of a path where a tangent vector exists. If the path consists of multiple disjoint components, only the first component is used.- Parameters:
path- the pathtangent- the tangent, stored in x, y, z order- Returns:
- true if a tangent exists; false otherwise
-