Class NURBSpline
General implementation of the Non-Uniform Rational B-spline or NURB-Spline. The main advantage of the NURB-Spline over the B-Spline is the ability to represent conic sections. To do this, a curve with degree of 2 is used. Figure 1 contains examples of conic arcs.

NURB-Splines can also be used to generate circles as shown in figure 2.

As seen in the figures, every control-point has an associated weight value. The weight-values control how much relative pull each control-point has on the curve. If the weight-value is 0, then the associated point will have no affect on the curve. If a point has an associated weight of 0, but the curve is expected to pass through that point, then it is likely that the result of evaluation will be the origin. All weights must be >= 0.
-
Field Summary
Fields inherited from class com.graphbuilder.curve.BSpline
NON_UNIFORM, UNIFORM_CLAMPED, UNIFORM_UNCLAMPED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThe requirements of the appendTo method include the requirements of the BSpline appendTo method, plus a couple more.protected voideval(double[] p) The eval method evaluates a point on a curve given a parametric value "t".booleanReturns the value of the useWeightVector flag.Returns the weight-vector.voidResets the shared memory to the initial state.voidsetUseWeightVector(boolean b) Sets the value of the useWeightVector flag.voidSets the weight-vector.Methods inherited from class com.graphbuilder.curve.BSpline
getDegree, getKnotVector, getKnotVectorType, getSampleLimit, getUseDefaultInterval, N, setDegree, setInterval, setKnotVector, setKnotVectorType, setSampleLimit, setUseDefaultInterval, t_max, t_minMethods inherited from class com.graphbuilder.curve.Curve
getConnect, getControlPath, getGroupIterator, setConnect, setControlPath, setGroupIterator
-
Constructor Details
-
NURBSpline
-
-
Method Details
-
eval
protected void eval(double[] p) Description copied from class:ParametricCurveThe eval method evaluates a point on a curve given a parametric value "t". The parametric value "t" is stored in the last index location of the specified double array. This value should not be changed. The dimension of the point to evaluate is p.length - 1. The result of the evaluation is placed in index locations 0 .. p.length - 2 (inclusive). The eval method should remain protected except for those curves that do no need any preparation to be done in the appendTo method. -
getWeightVector
Returns the weight-vector.- See Also:
-
setWeightVector
Sets the weight-vector.- Throws:
IllegalArgumentException- If the value-vector is null.- See Also:
-
getUseWeightVector
public boolean getUseWeightVector()Returns the value of the useWeightVector flag. The default value is true.- See Also:
-
setUseWeightVector
public void setUseWeightVector(boolean b) Sets the value of the useWeightVector flag. If the flag is true, then the internal weightVector will be used. If the flag is false, then all weights will be assumed to be 1.- See Also:
-
appendTo
The requirements of the appendTo method include the requirements of the BSpline appendTo method, plus a couple more. The additional requirements only apply if the useWeightVector flag is true. If so, then the weight-vector must have size equal to the group-size of the GroupIterator and all weights must have a value >= 0. This method returns quietly if these requirements are not met. -
resetMemory
public void resetMemory()Description copied from class:CurveResets the shared memory to the initial state.- Overrides:
resetMemoryin classBSpline
-