public class BSpline
extends java.lang.Object
Constructor and Description |
---|
BSpline(int degree,
double[] controlPoints,
int[] multiplicities,
boolean throughEndpoints)
Create a spline of the specified degree using the supplied x,y coordinate pairs as the control points.
|
BSpline(int degree,
java.util.Vector<SplineControlPoint> controlPoints)
Create e new B-spline of the specified degree using the supplied control points
|
Modifier and Type | Method and Description |
---|---|
static void |
drawSpline(java.awt.Graphics graphics,
int degree,
double[] controlPoints,
int[] multiplicities,
boolean throughEndpoints,
double tolerance)
An extension method that supports the drawing of a B-spline.
|
java.util.Vector<RealPoint> |
getCurvePoints(double tolerance)
Get a set of points on the spline curve, where the maximum distance between two adjacent points is given by tolerance.
|
java.lang.String |
toString() |
public BSpline(int degree, java.util.Vector<SplineControlPoint> controlPoints)
degree
- Degree of the spline polynomial piecescontrolPoints
- The set of control points used to define the splinepublic BSpline(int degree, double[] controlPoints, int[] multiplicities, boolean throughEndpoints)
degree
- The degree of the underlying piecewise-polynomial segmentscontrolPoints
- The control points used to define the shape of the spline, {x1, y1, x2, y2, ..., xn, yn}multiplicities
- Array giving the multiplicity of each of the control points. The size of the multiplicities
must be half the size of the controlPoints array.throughEndpoints
- Set true to force the spline curve to pass through the end control points. This is accomplished
by forcing the multiplicity of the first and last control points to degree + 1. Note that this
will give a different spline curve than that typically referred to as a "clamped" spline, in
which the spline knots are repeated at the beginning and end to force the spline to pass through
these points. The repeated control-point approach has the advantage of having the "open" spline
(where throughEndpoints is false) being a subset of the "closed" curve; this is not true for
"unclamped" and "clamped" splines.public static void drawSpline(java.awt.Graphics graphics, int degree, double[] controlPoints, int[] multiplicities, boolean throughEndpoints, double tolerance)
degree
- The degree of the spline; must be greater than 0controlPoints
- The control points that define the shape of the spline, {x1, y1, x2, y2, ..., xn, yn}.multiplicities
- The multiplicities for the control points; the number of multiplicity values must equal the
number of control points (i.e., the array size must be half that of the controlPoints array)throughEndpoints
- If true, the spline will be forced to pass through the endpoints by setting the end
control point multiplicities to degree + 1tolerance
- For non-DXF Graphics types, the spline is drawn as a set of connected line segments; the tolerance
specifies that maximum lenth of each line segment to control the smoothness of the representation.
Ignored for DXFGraphics, which has a true spline representation.graphics
- The graphics object specifying parameters for the arc (color, thickness)public java.util.Vector<RealPoint> getCurvePoints(double tolerance)
tolerance
- The maximum distance between any two adjacent points in the return vectorpublic java.lang.String toString()
toString
in class java.lang.Object