|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.graphbuilder.curve.Curve
com.graphbuilder.curve.ParametricCurve
com.graphbuilder.curve.CubicBSpline
The cubic B-spline is defined by third order polynomial basis functions. Each point on the curve is locally controlled by 4 control-points. In general, the curve does not pass through the control points, only near. The exceptions to this are the first and last control-points and if there are duplicate sequential control-points.
The CubicBSpline is the same as the BSpline with degree 3. However, the CubicBSpline is much faster to compute than the BSpline. The following table represents the approximate speed difference in computation between the CubicBSpline and BSpline of degree 3.
Number of Points | Times Faster |
10 | 4.6 |
20 | 6.9 |
30 | 9.5 |
40 | 11 |
As the number of points increases, the BSpline gets slower and slower. The reason is the CubicBSpline is built in segments, using 4 points at a time. However, the BSpline is a single segment, and requires iteration through all the points to compute a single point on the curve. Unlike the BSpline, the CubicBSpline does not have a knot vector, a definable sample limit, range or degree, which means the memory required for the CubicBSpline is less than the BSpline.
Relative to other curves, the cubic B-spline is computationally inexpensive, and easy to work with. To create a closed cubic B-spline, use "0:n-1,0:2" as the control-string and set interpolateEndpoints to false. Figures 1, 2 & 3 show some examples of cubic B-splines. See the appendTo method for more information.
BSpline
Field Summary |
Fields inherited from class com.graphbuilder.curve.Curve |
connect, cp, gi |
Constructor Summary | |
CubicBSpline(ControlPath cp,
GroupIterator gi)
|
Method Summary | |
void |
appendTo(MultiPath mp)
The requirements for this curve are the group-iterator must be in-range and have a group size of at least 4. |
protected void |
eval(double[] p)
The eval method evaluates a point on a curve given a parametric value "t". |
boolean |
getInterpolateEndpoints()
Returns the interpolateEndpoints value. |
int |
getSampleLimit()
Returns a value of 1. |
void |
setInterpolateEndpoints(boolean b)
Sets the curve to start at the first control-point and end at the last control-point specified by the group-iterator. |
Methods inherited from class com.graphbuilder.curve.Curve |
getConnect, getControlPath, getGroupIterator, resetMemory, setConnect, setControlPath, setGroupIterator |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public CubicBSpline(ControlPath cp, GroupIterator gi)
Method Detail |
protected void eval(double[] p)
ParametricCurve
eval
in class ParametricCurve
public int getSampleLimit()
getSampleLimit
in class ParametricCurve
public void setInterpolateEndpoints(boolean b)
getInterpolateEndpoints()
public boolean getInterpolateEndpoints()
setInterpolateEndpoints(boolean)
public void appendTo(MultiPath mp)
appendTo
in class Curve
MultiPath
,
BinaryCurveApproximationAlgorithm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |