- All Implemented Interfaces:
Shape
,Serializable
,Cloneable
- Direct Known Subclasses:
BasicSplinePath2D
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 Path2D
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. The usual winding rules apply in determining whether
one is inside or outside a shape described by the path. 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.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.geom.Path2D
Path2D.Double, Path2D.Float
-
Field Summary
Fields inherited from class java.awt.geom.Path2D
WIND_EVEN_ODD, WIND_NON_ZERO
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new empty SplinePath2D object with a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays of x and y coordinates given a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates given a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(int rule) Constructs a new empty SplinePath2D object with the specified winding rule to control operations that require the interior of the path to be defined.SplinePath2D
(int rule, double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays of x and y coordinates and specifying a winding rule.SplinePath2D
(int rule, double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates and specifying a winding rule.SplinePath2D
(int rule, int initialCapacity) Constructs a new empty SplinePath2D object with the specified winding rule and the specified initial capacity to store path segments.SplinePath2D
(int rule, int initialCapacity, double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates with the specified winding rule and initial capacity for storing segments.SplinePath2D
(int rule, int initialCapacity, double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates with the specified winding rule and initial capacity for storing segments.SplinePath2D
(int rule, int initialCapacity, Point2D[] pk, boolean closed) Constructs a new SplinePath2D object from an array of points, given a winding rule and initial capacity.SplinePath2D
(int rule, int initialCapacity, Point2D[] pk, int n, boolean closed) Constructs a new SplinePath2D object from an array containing at least n points, given a winding rule and initial capacity.SplinePath2D
(int rule, int initialCapacity, CubicSpline xf, CubicSpline yf, boolean closed) Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates, a winding rule, and an initial capacity.SplinePath2D
(int rule, int initialCapacity, RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) Constructs a new SplinePath2D object from functions giving x and y coordinates with the specified winding rule and initial capacity for storing segments.SplinePath2D
(int rule, Point2D[] pk, boolean closed) Constructs a new SplinePath2D object from an array of points, given a winding rule.SplinePath2D
(int rule, Point2D[] pk, int n, boolean closed) Constructs a new SplinePath2D object from an array containing at least n points, given a winding rule.SplinePath2D
(int rule, Point2D[] pk, int offset, int n, boolean closed) Constructs a new SplinePath2D object from an array containing at least n points, given an offset into the array and given a winding rule.SplinePath2D
(int rule, CubicSpline xf, CubicSpline yf, boolean closed) Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates and a winding rule.SplinePath2D
(int rule, RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) Constructs a new SplinePath2D object from arrays of x and y coordinates and specifying a winding rule.SplinePath2D
(Point2D[] pk, boolean closed) Constructs a new SplinePath2D object from an array of points, given a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(Point2D[] pk, int n, boolean closed) Constructs a new SplinePath2D object from an array containing at least n points, given a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(Point2D[] pk, int offset, int n, boolean closed) Constructs a new SplinePath2D object from an array containing at least n points, starting at an offset and given a default winding rule ofWIND_NON_ZERO
.Constructs a new SplinePath2D object from an arbitraryShape
object.SplinePath2D
(Shape s, AffineTransform at) Constructs a new SplinePath2D object from an arbitraryShape
object, transformed by anAffineTransform
object.SplinePath2D
(CubicSpline xf, CubicSpline yf, boolean closed) Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates and given a default winding rule ofWIND_NON_ZERO
.SplinePath2D
(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) Constructs a new SplinePath2D object given functions specifying the x and y coordinates and given a default winding rule ofWIND_NON_ZERO
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCycle
(double[] x, double[] y) Add a sequence of segments that form a spline, specified as arrays of x and y coordinates, forming a closed path starting at index 0.void
addCycle
(double[] x, double[] y, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y coordinates, forming a closed path starting at index 0.void
Add a sequence of segments that form a spline, specified as Point2D 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, boolean connect) Append a spline to this path.void
cycleTo
(double[] x, double[] y) Add a sequence of segments that form a spline, specified as arrays of x and y coordinates, forming a smooth closed path.void
cycleTo
(double[] x, double[] y, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y coordinates, forming a smooth closed path.void
Add a sequence of segments that form a spline, specified as Point2D 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, double t1, double t2, int n) Add a sequence of segments that form a spline, specified as functions giving the x and y coordinates of points along the path and forming a smooth closed path.void
splineTo
(double[] x, double[] y) Add a sequence of segments that form a spline, specified as arrays of x and y coordinates.void
splineTo
(double[] x, double[] y, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y 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, double t1, double t2, int n) Add a sequence of segments that form a spline, specified as functions giving the x and y coordinates.Methods inherited from class java.awt.geom.Path2D.Double
append, clone, curveTo, getBounds2D, getPathIterator, lineTo, moveTo, quadTo, transform, trimToSize
Methods inherited from class java.awt.geom.Path2D
append, closePath, contains, contains, contains, contains, contains, contains, contains, contains, createTransformedShape, getBounds, getCurrentPoint, getPathIterator, getWindingRule, intersects, intersects, intersects, intersects, reset, setWindingRule
-
Constructor Details
-
SplinePath2D
public SplinePath2D()Constructs a new empty SplinePath2D object with a default winding rule ofWIND_NON_ZERO
. -
SplinePath2D
public SplinePath2D(int rule) Constructs a new empty SplinePath2D object with the specified winding rule to control operations that require the interior of the path to be defined.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)- See Also:
-
SplinePath2D
public SplinePath2D(int rule, int initialCapacity) Constructs a new empty SplinePath2D object with the specified winding rule and the specified initial capacity to store path segments.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)initialCapacity
- an estimate for the number of path segments in the path- See Also:
-
SplinePath2D
Constructs a new SplinePath2D object from an arbitraryShape
object.- Parameters:
s
- the specified Shape object
-
SplinePath2D
Constructs a new SplinePath2D object from an arbitraryShape
object, transformed by anAffineTransform
object.- Parameters:
s
- the specified Shape objectat
- the specified AffineTransform object
-
SplinePath2D
Constructs a new SplinePath2D object from an array containing at least n points, given a default winding rule ofWIND_NON_ZERO
. The array specifies the "knots" of the spline - the points the spline is constrained to pass through.- 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
-
SplinePath2D
Constructs a new SplinePath2D object from an array containing at least n points, starting at an offset and given a default winding rule ofWIND_NON_ZERO
. The array specifies the "knots" of the spline - the points the spline is constrained to pass through.- Parameters:
pk
- the array of points that contain the knots of a splineoffset
- the offset into the array for the starting knotn
- 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
-
SplinePath2D
Constructs a new SplinePath2D object from an array of points, given a default winding rule ofWIND_NON_ZERO
. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final 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
-
SplinePath2D
Constructs a new SplinePath2D object from an array containing at least n points, given a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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- See Also:
-
SplinePath2D
Constructs a new SplinePath2D object from an array containing at least n points, given an offset into the array and given a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)pk
- the array of points that make up the knots of a splineoffset
- the staring index int the array for the spline's knotsn
- 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- See Also:
-
SplinePath2D
Constructs a new SplinePath2D object from an array of points, given a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)pk
- the array of points that make up the knots of a splineclosed
- true if the spline forms a closed path; false otherwise- See Also:
-
SplinePath2D
Constructs a new SplinePath2D object from an array containing at least n points, given a winding rule and initial capacity. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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- See Also:
-
SplinePath2D
Constructs a new SplinePath2D object from an array of points, given a winding rule and initial capacity. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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- See Also:
-
SplinePath2D
public SplinePath2D(double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates given a default winding rule ofWIND_NON_ZERO
. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y 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
-
SplinePath2D
Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates and given a default winding rule ofWIND_NON_ZERO
. The spline 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 useclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the splines xf and yf did not have the same number of knots
-
SplinePath2D
public SplinePath2D(int rule, CubicSpline xf, CubicSpline yf, boolean closed) throws IllegalArgumentException Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates and a winding rule. The splines must be created with the same number of "knots". The argument to each spline 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:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)xf
- the spline specifying the x coordinates to useyf
- the spline specifying the y coordinates to useclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the splines xf and yf did not have the same number of knots
-
SplinePath2D
public SplinePath2D(int rule, int initialCapacity, CubicSpline xf, CubicSpline yf, boolean closed) throws IllegalArgumentException Constructs a new SplinePath2D object given cubic splines specifying the x and y coordinates, a winding rule, and an initial capacity. The splines must be created with the same number of "knots". The argument to each spline 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 and y 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:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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 useclosed
- true if the spline forms a closed path; false otherwise- Throws:
IllegalArgumentException
- the splines xf and yf did not have the same number of knots
-
SplinePath2D
public SplinePath2D(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) throws IllegalArgumentException Constructs a new SplinePath2D object given functions specifying the x and y coordinates and given a default winding rule ofWIND_NON_ZERO
. When closed, the initial point should not be repeated by the final point.- Parameters:
xf
- the function specifying the x coordinates to useyf
- the function specifying the y 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.
-
SplinePath2D
public SplinePath2D(double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays of x and y coordinates given a default winding rule ofWIND_NON_ZERO
. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y 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
-
SplinePath2D
public SplinePath2D(int rule, double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates and specifying a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)x
- the x coordinates to use, one for each knoty
- the y 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- See Also:
-
SplinePath2D
public SplinePath2D(int rule, double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays of x and y coordinates and specifying a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rulex
- the x coordinates to use, one for each knoty
- the y 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- See Also:
-
SplinePath2D
public SplinePath2D(int rule, int initialCapacity, double[] x, double[] y, int n, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates with the specified winding rule and initial capacity for storing segments. The arrays specify the x and y coordinates of the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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 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- See Also:
-
SplinePath2D
public SplinePath2D(int rule, RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) throws IllegalArgumentException Constructs a new SplinePath2D object from arrays of x and y coordinates and specifying a winding rule. The array specifies the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)xf
- the function specifying the x coordinates to useyf
- the function specifying the y 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.- See Also:
-
SplinePath2D
public SplinePath2D(int rule, int initialCapacity, RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n, boolean closed) throws IllegalArgumentException Constructs a new SplinePath2D object from functions giving x and y coordinates with the specified winding rule and initial capacity for storing segments. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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 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.- See Also:
-
SplinePath2D
public SplinePath2D(int rule, int initialCapacity, double[] x, double[] y, boolean closed) Constructs a new SplinePath2D object from arrays containing at least n x and y coordinates with the specified winding rule and initial capacity for storing segments. The arrays specify the x and y coordinates of the "knots" of the spline - the points the spline is constrained to pass through. When closed, the initial point should not be repeated by the final point.- Parameters:
rule
- the winding rule (WIND_EVEN_ODD
orWIND_NON_ZERO
)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 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- See Also:
-
-
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, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y 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 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) Add a sequence of segments that form a spline, specified as arrays of x and y 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 knot- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-
splineTo
public void splineTo(RealValuedFunctOps xf, RealValuedFunctOps yf, double t1, double t2, int n) throws IllegalArgumentException Add a sequence of segments that form a spline, specified as functions giving the x and y 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 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
Append a spline to this path. The spline is provided by a CubicSpline for the x coordinates and a CubicSpline for the y coordinates.- Parameters:
xf
- the cubic spline providing the x coordinatesyf
- the cubic spline providing the y 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 and yf 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. Element n-1 in the array pk should not repeat this initial point. The implicit moveTo may result in the path containing multiple moveTo segments back to back.- 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 Point2D 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 this initial point.- Parameters:
points
- the points that make up the knots of a spline
-
cycleTo
public void cycleTo(double[] x, double[] y, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y 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 point specified by the array index n-1 should not repeat this initial point. The implicit moveTo may result in the path containing multiple moveTo segments back to back.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y 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) Add a sequence of segments that form a spline, specified as arrays of x and y 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 point specified by the last elements in the x and y arrays should not repeat this initial point. The implicit moveTo may result in the path containing multiple moveTo segments back to back.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y 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, double t1, double t2, int n) throws IllegalArgumentException Add a sequence of segments that form a spline, specified as functions giving the x and y 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 end point at t2 should not repeat the initial point. The implicit moveTo may result in the path containing multiple moveTo segments back to back.
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 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, which should not be repeated as the element at index n-1 of the array provided as this method's first argument.- 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 Point2D 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, which should not be repeated by the last argument.- Parameters:
points
- the points that make up the knots of a spline
-
addCycle
public void addCycle(double[] x, double[] y, int n) Add a sequence of segments that form a spline, specified as arrays of at least n x and y 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, which should not be repeated by the point specified by the array arguments at index n-1.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y 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) Add a sequence of segments that form a spline, specified as arrays of x and y 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, which should not be repeated by the point specified by the last arguments of the x and y arrays.- Parameters:
x
- the x coordinates to use, one for each knoty
- the y coordinates to use, one for each knot- Throws:
IllegalArgumentException
- the arguments were illegal, typically because the lengths of the arrays differ
-