public class NURBSCurve2d extends NURBSCurveBase
CLOSED, init, OPEN
TRANSPARENT, TWO_DIMENSIONAL
Constructor and Description |
---|
NURBSCurve2d()
Creates an empty NURBS curve.
|
NURBSCurve2d(int d,
int type,
Vector4d[] ctrlPnts,
double[] knots)
Creates an open or closed NURBS curve with a specified degree, knots, and
control points.
|
NURBSCurve2d(NURBSCurve2d curve)
Creates a NURBS curve that is a copy of another curve.
|
Modifier and Type | Method and Description |
---|---|
void |
addControlPoint(Vector4d pnt,
double knotSpacing)
Add an additional control point and knot to the end of this curve.
|
void |
eval(Point3d pnt,
double u)
Evaluates the point on this curve for parameter u.
|
Point2d[] |
evalPoints(int npnts)
Returns a set of points evaluated along the curve at intervals which are
evenly spaced with respect to the curve parameter.
|
double |
findPoint(Point2d pnt,
double umin,
double umax)
Finds a u value for a given curve point within a specified interval of the
curve.
|
int |
getOrientation()
For closed curves, return 1 if it is oriented counter-clockwise and -1 if
clockwise.
|
void |
set(int d,
int type,
Vector4d[] ctrlPnts,
double[] knots)
Sets this NURBS curve to either an open or closed curve with a specified
degree, knots, and control points.
|
void |
set(NURBSCurve2d curve) |
computeControlPolygonLength, convertToBezier, createRenderProps, createUniformKnots, getDegree, getKnot, getKnotIndex, getKnots, getRange, getResolution, getType, insertKnot, isBezier, isBSpline, isClosed, numKnots, read, read, removeControlPoint, render, reset, set, set, setBezier, setCircle, setRange, setResolution, setUniformCubic, write, write
controlPointIsSelected, getControlPoint, getControlPoints, getDrawControlShape, getLineWidth, getObjToWorld, getObjToWorld, getPointSize, getRenderHints, getRenderProps, getSelection, isSelectable, numControlPoints, numSelectionQueriesNeeded, prerender, render, selectControlPoint, setDrawControlShape, setLineWidth, setObjToWorld, setPointSize, setRenderProps, transform, updateBounds, write, write
public NURBSCurve2d()
public NURBSCurve2d(NURBSCurve2d curve)
public NURBSCurve2d(int d, int type, Vector4d[] ctrlPnts, double[] knots)
set
.d
- degree of the curvetype
- curve type, which must be either OPEN
or
CLOSED
.knots
- knot valuesctrlPnts
- control pointsjava.lang.IllegalArgumentException
- if constraints on the arguments are violatedset(int,int,Vector4d[],double[])
public Point2d[] evalPoints(int npnts)
npnts
- number of points to createpublic int getOrientation()
public void set(int d, int type, Vector4d[] ctrlPnts, double[] knots)
Let d, numk, and numc be the degree of the curve, the number of knots, and the number of control points. The degree must be 1 or greater. For open curves,
numc = numk - d + 1and for closed curves,
numc = numk - 2*d + 1
The knots argument may be set to null, in which case an appropriate number of uniformly spaced knots will be created, in the range [0, 1]. Otherwise, if knots is specified, the ctrlPnts argument must contain at least numc elements.
This method automatically sets ustart and uend (see
setRange
) to knots[d-1] and knots[numk-d].
The control points are specified as 4-vectors, where their spatial location is given by x, y, and z and their weight is given by w. The points should not be in homogeneous form; i.e., x, y, and z should not be premultipled by w.
set
in class NURBSCurveBase
d
- degree of the curvetype
- curve type, which must be either OPEN
or
CLOSED
.ctrlPnts
- control pointsknots
- knot valuespublic void addControlPoint(Vector4d pnt, double knotSpacing)
NURBSCurveBase
h
. If this is specified as -1,
then the default uniform knot spacing (typically 1) is used.addControlPoint
in class NURBSCurveBase
public void eval(Point3d pnt, double u)
eval
in class NURBSCurveBase
pnt
- returns the curve point valueu
- curve parameter valuepublic double findPoint(Point2d pnt, double umin, double umax)
This routine uses an iterative golden section search, and so is not particularly fast.
pnt
- point to search forumin
- minimum u valu for the intervalumax
- maximum u valu for the intervalpublic void set(NURBSCurve2d curve)