public class LagrangeCurve extends ParametricCurve
The Lagrange curve passes through the control-points specified by the group-iterator. It uses a knot-vector to control when the curve passes through each control-point. That is, if there is a knot-value for every control-point, then the curve will pass through point i when the value of t is knot[i], which is an interesting property. Figure 1 is an example of this.
In addition, when there is a knot-value for every point then the base-index should be 0, and the base-length should be n-1, where n is the size of the group-iterator.
A knot-vector with size less than n can still be used. In this case the Lagrange curve is generated in multiple sections. This approach works better when the points are roughly equally spaced. Figure 2 is an example of this.
Lagrange curves and also be closed as shown in figures 3 & 4.
Notes on the knot-vector, base-index and base-length. The size of the knot-vector specifies how many points are used for each section of the curve. The base-index specifies which point a section starts at. The base-index + base-length specify which point the section ends at. Once a section has been generated, the next section is generated starting from the end of the last section.
Constructor and Description |
---|
LagrangeCurve(ControlPath cp,
GroupIterator gi)
Creates a LagrangeCurve with knot vector [0, 1/3, 2/3, 1], baseIndex == 1, baseLength == 1,
interpolateFirst and interpolateLast are both false.
|
Modifier and Type | Method and Description |
---|---|
void |
appendTo(MultiPath mp)
For the control-points to be interpolated in order, the knot-vector values should be strictly
increasing, however that is not required.
|
protected void |
eval(double[] p)
The eval method evaluates a point on a curve given a parametric value "t".
|
int |
getBaseIndex()
Returns the base-index.
|
int |
getBaseLength()
Returns the base-length.
|
boolean |
getInterpolateFirst()
If baseIndex > 0 then the first control-points will only be interpolated if interpolate-first
is set to true.
|
boolean |
getInterpolateLast()
If baseIndex + baseLength < numKnots - 1 then the last control-points will only be interpolated if
interpolate-last is set to true.
|
ValueVector |
getKnotVector()
Returns the knot-vector for this curve.
|
int |
getSampleLimit()
Returns a value of 1.
|
void |
resetMemory()
Resets the shared memory to the initial state.
|
void |
setBaseIndex(int b)
The base-index is an index location into the knot vector such that, for each section, the curve is
evaluated between [knot[baseIndex], knot[baseIndex + baseLength]].
|
void |
setBaseLength(int b)
The base-length along with the base-index specify the interval to evaluate each section.
|
void |
setInterpolateFirst(boolean b)
Sets the value of the interpolateFirst flag.
|
void |
setInterpolateLast(boolean b)
Sets the value of the interpolateLast flag.
|
void |
setKnotVector(ValueVector v)
Sets the knot-vector for this curve.
|
getConnect, getControlPath, getGroupIterator, setConnect, setControlPath, setGroupIterator
public LagrangeCurve(ControlPath cp, GroupIterator gi)
appendTo(MultiPath)
public int getBaseIndex()
setBaseIndex(int)
public void setBaseIndex(int b)
IllegalArgumentException
- If base-index < 0.getBaseIndex()
public int getBaseLength()
setBaseLength(int)
public void setBaseLength(int b)
IllegalArgumentException
- If base-length <= 0.getBaseLength()
public boolean getInterpolateFirst()
setInterpolateFirst(boolean)
public boolean getInterpolateLast()
setInterpolateLast(boolean)
public void setInterpolateFirst(boolean b)
getInterpolateFirst()
public void setInterpolateLast(boolean b)
getInterpolateLast()
public ValueVector getKnotVector()
setKnotVector(ValueVector)
public void setKnotVector(ValueVector v)
IllegalArgumentException
- If the value-vector is null.getKnotVector()
public int getSampleLimit()
getSampleLimit
in class ParametricCurve
protected void eval(double[] p)
ParametricCurve
eval
in class ParametricCurve
public void appendTo(MultiPath mp)
appendTo
in class Curve
MultiPath
,
BinaryCurveApproximationAlgorithm
public void resetMemory()
Curve
resetMemory
in class Curve
Copyright © 2024. All rights reserved.