- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
BasicSplinePath3D
splineTo
to add a smooth
curve segment or
addCycle
to add smooth
closed path. If splineTo
is used, the starting point of the spline is the current point, which
is initially set using the Path3D
moveTo
method.
The smooth curves created are cubic Bézier curve segments
arranged so that the first and second derivatives of their
coordinates with respect to the curves' parameters match (one curve
at u = 1 and the other at u = 0). For
a call to splineTo
, at the
end points, the tangent to the curve points towards its neighbor. As a
result, calling splineTo for points p1, p2, p3, p4, followed by a call
to splineTo for points p5, p6, p7, p8 is not equivalent to calling
splineTo once for points p1, p2, ..., p8: in the former case, the
tangent lines can differ on both sides of point p4.
When addCycle
is used,
there is an implicit call to moveTo for the first point in the array and
this point becomes the last point, but otherwise the end points are not
treated specially. Regardless of
whether splineTo
,
addCycle
, or constructor
is used, the smoothed paths are simply sequences of calls to at most one
initial moveTo method and some number of curveTo methods.
The algorithm is described in an article, "Smooth Bézier Spline Through Prescribed Points" and works by making the first and second derivatives of Bézier curves (differentiating with respect to the parameter u) match at the given points. Each segment is a Bézier curve given by
B(u) = (1-u)3P0 + 3(1-u)2uP1 + 3(1-u)u2P2 + t3P3.
For n-1 cubic splines with control points $P0,i P1,i, P1,2 and P3,i, with i in the interval [0, n-1], connecting the points K0 ... Kn the P1 control points satisfy the equations
- 2P1,0 + P1,1 = 4K0 + 2K1
- P1,i-1 + 4P1,i + P1,i+1 = 4Ki + 2Ki+1 for i in [1, n-2]
- 2Pi,n-2 + 7P1,n-1 = 8Kn-1 + Kn.
- P0,i = Ki
- P3,i = Ki+1
- P2,i = 2Ki+1 - P1,i+1 for i in [0,n-2].
- P2,n-1 = (Kn + P1,n-1)/2.
For a closed paths, a case not covered in the article cited above, the equation for P1 are given by
- P1,n + 4P1,0 + P1,i+1 = 4Ki + 2Ki+1
- P1,i-1 + 4P1,i + P1,i+1 = 4Ki + 2Ki+1 for i in [1, n-1]
- P1,n-1 + 4P1,n + P1,0 = 4Kn + 2K0
- P0,i = Ki for i in [0,n]
- P2,i = 2Ki+1 - P1,i+1 for i in [0, n-1]
- P2,n = 2K0 - P1,0
- P3,i = Ki+1 for i in [0, n-1].
- P3,n = K0.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.bzdev.geom.Path3D
Path3D.Double, Path3D.Float
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty SplinePath3D object.SplinePath3D
(double[] x, double[] y, double[] z, boolean closed) Constructs a new SplinePath3D object from arrays of X, Y and Z coordinates.SplinePath3D
(double[] x, double[] y, double[] z, int n, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n x and y coordinates.SplinePath3D
(int initialCapacity) Constructs a new empty SplinePath3D object with the specified initial capacity to store path segments.SplinePath3D
(int initialCapacity, double[] x, double[] y, double[] z, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n X, Y and Z coordinates with the specified initial capacity for storing segments.SplinePath3D
(int initialCapacity, double[] x, double[] y, double[] z, int n, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n X, Y and Z coordinates with the specified initial capacity for storing segments.SplinePath3D
(int initialCapacity, Point3D[] pk, boolean closed) Constructs a new SplinePath3D object from an array of points, given an initial capacity.SplinePath3D
(int initialCapacity, Point3D[] pk, int n, boolean closed) Constructs a new SplinePath3D object from an array containing at least n points, given an initial capacity.SplinePath3D
(int initialCapacity, CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean closed) Constructs a new SplinePath3D object given cubic splines specifying the x, y and z coordinates and an initial capacity.SplinePath3D
(int initialCapacity, RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n, boolean closed) Constructs a new SplinePath3D object from functions giving x and y coordinates with the specified initial capacity for storing segments.SplinePath3D
(Path3D path) Constructor using another path to determine the initial path segments.SplinePath3D
(Path3D path, Transform3D transform) Constructor using another path to determine the initial path segments, modified with a 3D transform.SplinePath3D
(Point3D[] pk, boolean closed) Constructs a new SplinePath3D object from an array of points.SplinePath3D
(Point3D[] pk, int n, boolean closed) Constructs a new SplinePath3D object from an array containing at least n points.SplinePath3D
(Point3D[] pk, int offset, int n, boolean closed) Constructs a new SplinePath3D object from an array containing at least n points, starting at an offset.SplinePath3D
(CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean closed) Constructs a new SplinePath3D object given cubic splines specifying the x, y and z coordinates.SplinePath3D
(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n, boolean closed) Constructs a new SplinePath3D object given functions specifying the X, Y and Z coordinates. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCycle
(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates, forming a closed path starting at index 0.void
addCycle
(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates, forming a closed path starting at index 0.void
Add a sequence of segments that form a spline, specified as Point3D arguments to the addCycle method, and forming a closed path starting at index 0.void
Add a sequence of segments that form a spline, specified as an array of at least n points, forming a closed path starting at index 0.void
append
(CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean connect) Append a spline to this path.void
cycleTo
(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates, forming a smooth closed path.void
cycleTo
(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates, forming a smooth closed path.void
Add a sequence of segments that form a spline, specified as Point3D arguments to the cycleTo method, and forming a smooth closed path.void
Add a sequence of segments that form a spline, specified as an array of points, forming a smooth closed path.void
cycleTo
(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n) Add a sequence of segments that form a spline, specified as functions giving the X, Y and Z coordinates of points along the path and forming a smooth closed path.void
splineTo
(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates.void
splineTo
(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates.void
Add a sequence of segments that form a spline, specified as arguments passed to the splineTo method.void
Add a sequence of segments that form a spline, specified as an array of points.void
Add a sequence of segments that form a spline, specified as an array of points with an offset.void
splineTo
(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n) Add a sequence of segments that form a spline, specified as functions giving the X, Y and Z coordinates.Methods inherited from class org.bzdev.geom.Path3D.Double
append, clone, createTransformedPath, curveTo, getEnd, getPathIterator, getStart, lineTo, moveTo, quadTo, transform
Methods inherited from class org.bzdev.geom.Path3D
append, closePath, getBounds, getCurrentPoint, isEmpty, reset, setupCubic, setupCubic, setupCubic, setupCubic
-
Constructor Details
-
SplinePath3D
public SplinePath3D()Constructs a new empty SplinePath3D object. -
SplinePath3D
public SplinePath3D(int initialCapacity) Constructs a new empty SplinePath3D object with the specified initial capacity to store path segments.- Parameters:
initialCapacity
- an estimate for the number of path segments in the path
-
SplinePath3D
Constructor using another path to determine the initial path segments.- Parameters:
path
- the path whose segments will be copied
-
SplinePath3D
Constructor using another path to determine the initial path segments, modified with a 3D transform.- Parameters:
path
- the path whose segments will be copiedtransform
- the transform to apply to the path segments
-
SplinePath3D
Constructs a new SplinePath3D object from an array containing at least n points. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
pk
- the array of points that make up the knots of a splinen
- the number of points in the array to use, with valid indices in the range [0, n)closed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
Constructs a new SplinePath3D object from an array containing at least n points, starting at an offset. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
pk
- the array of points that contain up the knots of a splineoffset
- the starting index into the arrayn
- the number of points in the array to use, with valid indices in the range [offset, offset+n)closed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
Constructs a new SplinePath3D object from an array of points. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
pk
- the array of points that make up the knots of a splineclosed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
Constructs a new SplinePath3D object from an array containing at least n points, given an initial capacity. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathpk
- the array of points that make up the knots of a splinen
- the number of points in the array to use, with valid indices in the range [0, n)closed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
Constructs a new SplinePath3D object from an array of points, given an initial capacity. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathpk
- the array of points that make up the knots of a splineclosed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
public SplinePath3D(double[] x, double[] y, double[] z, int n, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n x and y coordinates. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotn
- the number of points in the array to use, with valid indices in the range [0, n)closed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
public SplinePath3D(CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean closed) throws IllegalArgumentException Constructs a new SplinePath3D object given cubic splines specifying the x, y and z coordinates. The functions must be instances ofCubicSpline
and must be created with the same number of "knots". The argument to each function will be rescaled so that it will be incremented by 1.0 when moving from one knot to the next. If closed is true and the initial knot is not at the same location as the final knot, a straight line segment will be used to close the path.This constructor is provided to support cases where the default algorithm for creating a spline is not appropriate: the class
CubicSpline
allows one to specify a number of types of splines, with most differing in how the ends are treated, but with one case (A Hermite spline) explicitly giving the derivative at each knot.- Parameters:
xf
- the spline specifying the x coordinates to useyf
- the spline specifying the y coordinates to usezf
- the spline specifying the y coordinates to useclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- The splines xf, yf and zf did not have the same number of knots
-
SplinePath3D
public SplinePath3D(int initialCapacity, CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean closed) throws IllegalArgumentException Constructs a new SplinePath3D object given cubic splines specifying the x, y and z coordinates and an initial capacity. The splines must be created with the same number of "knots". The argument to each function will be rescaled so that it will be incremented by 1.0 when moving from one knot to the next. The path will be constructed using the control points associated with the cubic splines providing the x, y, and z coordinates. If closed is true and the initial knot is not at the same location as the final knot, a straight line segment will be used to close the path.This constructor is provided to support cases where the default algorithm for creating a spline is not appropriate: the class
CubicSpline
allows one to specify a number of types of splines, with most differing in how the ends are treated, but with one case (A Hermite spline) explicitly giving the derivative at each knot.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathxf
- the spline specifying the x coordinates to useyf
- the spline specifying the y coordinates to usezf
- the spline specifying the y coordinates to useclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- The spline xf and yf did not have the same number of knotsIllegalArgumentException
- The splines xf, yf and zf did not have the same number of knots
-
SplinePath3D
public SplinePath3D(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n, boolean closed) throws IllegalArgumentException Constructs a new SplinePath3D object given functions specifying the X, Y and Z coordinates. For a closed path, the last point should not repeat the initial point.- Parameters:
xf
- the function specifying the x coordinates to useyf
- the function specifying the y coordinates to usezf
- the function specifying the z coordinates to uset1
- an end point for the domain of the argument of xf and yft2
- the other end point for the domain of the argument of xf and yfn
- the number of segments between the points at which to evaluate the functionsclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the arguments were illegal, typically because n was not positive or either t1 or t2 were not in the domain of xf or yf.
-
SplinePath3D
public SplinePath3D(double[] x, double[] y, double[] z, boolean closed) Constructs a new SplinePath3D object from arrays of X, Y and Z coordinates. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-
SplinePath3D
public SplinePath3D(int initialCapacity, double[] x, double[] y, double[] z, int n, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n X, Y and Z coordinates with the specified initial capacity for storing segments. The arrays specify the X, Y and Z coordinates of the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathx
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotn
- the number of points in the array to use, with valid indices in the range [0, n)closed
- true if the spline forms a closed path; false otherwise
-
SplinePath3D
public SplinePath3D(int initialCapacity, RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n, boolean closed) throws IllegalArgumentException Constructs a new SplinePath3D object from functions giving x and y coordinates with the specified initial capacity for storing segments. For a closed path, the last point should not repeat the initial point.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathxf
- the function specifying the x coordinates to useyf
- the function specifying the y coordinates to usezf
- the function specifying the z coordinates to uset1
- an end point for the domain of the argument of xf and yft2
- the other end point for the domain of the argument of xf and yfn
- the number of segments between the points at which to evaluate the functionsclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the arguments were illegal, typically because n was not positive or either t1 or t2 were not in the domain of xf or yf.
-
SplinePath3D
public SplinePath3D(int initialCapacity, double[] x, double[] y, double[] z, boolean closed) Constructs a new SplinePath3D object from arrays containing at least n X, Y and Z coordinates with the specified initial capacity for storing segments. The arrays specify the X, Y and Z coordinates of the "knots" of the spline - the points the spline is constrained to pass through. For a closed path, the last point should not repeat the initial point.- Parameters:
initialCapacity
- an estimate for the number of path segments in the pathx
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-
-
Method Details
-
splineTo
Add a sequence of segments that form a spline, specified as an array of points. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.).- Parameters:
pk
- the array of points that make up the knots of a splinen
- the number of points in the array to use, with valid indices in the range [0, n)
-
splineTo
Add a sequence of segments that form a spline, specified as an array of points with an offset. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.).- Parameters:
pk
- the array of points that make up the knots of a splineoffset
- the offset into the array for the starting pointn
- the number of points in the array to use, with valid indices in the range [0, n)
-
splineTo
Add a sequence of segments that form a spline, specified as arguments passed to the splineTo method. The arguments specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.).- Parameters:
points
- the array of points that make up the knots of a spline
-
splineTo
public void splineTo(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates. The arrays specify the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.).- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotn
- the number of points in the array to use, with valid indices in the range [0, n)
-
splineTo
public void splineTo(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates. The arrays specify the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.).- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knot- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-
splineTo
public void splineTo(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n) throws IllegalArgumentException Add a sequence of segments that form a spline, specified as functions giving the X, Y and Z coordinates. The "knots" of the spline - the points the spline is constrained to pass through - are at evenly spaced values of the argument passed to the functions, and the spline will have matching first and second derivatives at intermediate points. At the end points, the direction of the tangent line points towards the adjacent knot. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.). The end points at t1 and t2 are included as knots.The number of segments is one less than the number of points so that n=2 implies that the function will be evaluated at t1, t2, and (t1 + t2)/2.
- Parameters:
xf
- the function giving the x coordinates for the path segmentyf
- the function giving the y coordinates for the path segmentzf
- the function giving the z coordinates for the path segmentt1
- an end point for the domain of the argument of xf and yft2
- the other end point for the domain of the argument of xf and yfn
- the number of segments between the points at which to evaluate the functions- Throws:
IllegalArgumentException
- the arguments were illegal, typically because n was not positive or either t1 or t2 were not in the domain of xf or yf.
-
append
public void append(CubicSpline xf, CubicSpline yf, CubicSpline zf, boolean connect) throws IllegalArgumentException Append a spline to this path. The spline is provided by a CubicSpline for the x coordinates, a CubicSpline for the y coordinates, and a CubicSpline for the z coordinates.- Parameters:
xf
- the cubic spline providing the x coordinatesyf
- the cubic spline providing the y coordinateszf
- the cubic spline providing the z coordinatesconnect
- true if the appended spline is to be connected to this path with a lineTo operation; false if a moveTo operation will be used instead- Throws:
IllegalArgumentException
- The splines xf, yf and zf did not have the same number of knots
-
cycleTo
Add a sequence of segments that form a spline, specified as an array of points, forming a smooth closed path. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.) and there is an implicit moveTo operation to this point. The initial point (i.e., the current point) should not be repeated at the n-1 element of the array.- Parameters:
pk
- the array of points that make up the knots of a splinen
- the number of points in the array to use, with valid indices in the range [0, n)
-
cycleTo
Add a sequence of segments that form a spline, specified as Point3D arguments to the cycleTo method, and forming a smooth closed path. The points specify the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.). The last argument should not repeat the current point.- Parameters:
points
- the points that make up the knots of a spline
-
cycleTo
public void cycleTo(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates, forming a smooth closed path. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.) and there is an implicit moveTo operation to this point. The initial point (i.e., the current point) should not be repeated at the n-1 elements of the arrays.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotn
- the number of points in the array to use, with valid indices in the range [0, n)
-
cycleTo
public void cycleTo(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates, forming a smooth closed path. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.) and there is an implicit moveTo operation to this point. The initial point (i.e., the current point) should not be repeated as the last elements of the arrays.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knot- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-
cycleTo
public void cycleTo(RealValuedFunctOps xf, RealValuedFunctOps yf, RealValuedFunctOps zf, double t1, double t2, int n) throws IllegalArgumentException Add a sequence of segments that form a spline, specified as functions giving the X, Y and Z coordinates of points along the path and forming a smooth closed path.The "knots" of the spline - the points the spline is constrained to pass through - are are at evenly spaced values of the argument passed to the functions, and the spline will have matching first and second derivatives at all points. The initial point is the one previously added to the path via some other method (e.g., moveTo, lineTo, etc.) and there is an implicit moveTo operation to this point. The end points at t1 and t2 are included as knots.
The number of segments is one less than the number of points so that n=2 implies that the function will be evaluated at t1, t2, and (t1 + t2)/2. The initial point (i.e., the current point) should not be repeated at the n-1 function evaluation.
- Parameters:
xf
- the function giving the x coordinates for the path segmentyf
- the function giving the y coordinates for the path segmentzf
- the function giving the z coordinates for the path segmentt1
- an end point for the domain of the argument of xf and yft2
- the other end point for the domain of the argument of xf and yfn
- the number of segments between points at which to evaluate the functions- Throws:
IllegalArgumentException
- the arguments were illegal, typically because n was not positive or either t1 or t2 were not in the domain of xf or yf.
-
addCycle
Add a sequence of segments that form a spline, specified as an array of at least n points, forming a closed path starting at index 0. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is pk[0] and there is an implicit moveTo operation for this point. The n-1 element of the pk array should not repeat the initial point.- Parameters:
pk
- the array of points that make up the knots of a splinen
- the number of points in the array to use, with valid indices in the range [0, n)
-
addCycle
Add a sequence of segments that form a spline, specified as Point3D arguments to the addCycle method, and forming a closed path starting at index 0. The points specify the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is the one specified by the first argument and there is an implicit moveTo operation for this point. The last argument should not repeated the initial argument.- Parameters:
points
- the points that make up the knots of a spline
-
addCycle
public void addCycle(double[] x, double[] y, double[] z, int n) Add a sequence of segments that form a spline, specified as arrays of at least n X, Y and Z coordinates, forming a closed path starting at index 0. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is (x[0], y[0]) and there is an implicit moveTo operation for this point. The point corresponding to index n-1 should not repeated this initial point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knotn
- the number of points in the array to use, with valid indices in the range [0, n)
-
addCycle
public void addCycle(double[] x, double[] y, double[] z) Add a sequence of segments that form a spline, specified as arrays of X, Y and Z coordinates, forming a closed path starting at index 0. The array specifies the "knots" of the spline - the points the spline is constrained to pass through - and the spline will have matching first and second derivatives at all points. The initial point is (x[0], y[0]) and there is an implicit moveTo operation for this point. The point corresponding to end of the arrays should not repeated this initial point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knotz
- the z coordinates to use, one for each knot- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-