public class BSplineCurve3f extends SingleCurve3f implements Serializable
Curve3f.PointList
Modifier and Type | Field and Description |
---|---|
protected Vector3f[] |
m_akCtrlPoint
Set of control points
|
protected boolean |
m_bLoop
Loop flag
|
protected int |
m_iNumCtrlPoints
Larger than basis control points, because of replication
|
protected int |
m_iReplicate
the number of replicated control points
|
protected BSplineBasisf |
m_kBasis
Spline basis
|
private static long |
serialVersionUID |
Constructor and Description |
---|
BSplineCurve3f(int iNumCtrlPoints,
Vector3f[] akCtrlPoint,
int iDegree,
boolean bLoop,
boolean bOpen)
Construction and destruction.
|
BSplineCurve3f(int iNumCtrlPoints,
Vector3f[] akCtrlPoint,
int iDegree,
boolean bLoop,
float[] afKnot)
Open, nonuniform spline.
|
Modifier and Type | Method and Description |
---|---|
static BSplineCurve3f |
CreateApproximation(float[] akValue,
int iNumControlPoints,
int iDegree)
Create a BSpline curve which best fits a set of 3D points.
|
static BSplineCurve3f |
CreateApproximation(Vector3f[] akPoint,
int iNumControlPoints,
int iDegree)
Create a BSpline curve which best fits a set of 3D points.
|
private void |
CreateControl(Vector3f[] akCtrlPoint)
Allocate our control points, with replication
|
void |
dispose()
release resources
|
void |
Get(float fTime,
Vector3f pkPos,
Vector3f pkDer1,
Vector3f pkDer2,
Vector3f pkDer3)
If you need position and derivatives at the same time, it is more
efficient to call these functions.
|
BSplineBasisf |
GetBasis()
Access the basis function to compute it without control points.
|
Vector3f |
GetControlPoint(int i)
Retrieve a control point.
|
int |
GetDegree() |
Vector3f |
GetFirstDerivative(float fTime)
Get the 3D coordinates of the 1st derivative vector at the point along
the curve evaluated for the input time value.
|
float |
GetKnot(int i) |
int |
GetNumCtrlPoints() |
Vector3f |
GetPosition(float fTime)
The spline is defined for 0 <= t <= 1.
|
Vector3f |
GetSecondDerivative(float fTime)
Get the 3D coordinates of the 2nd derivative vector at the point along
the curve evaluated for the input time value.
|
Vector3f |
GetThirdDerivative(float fTime) |
float |
GetVariation(float fT0,
float fT1,
Vector3f pkP0,
Vector3f pkP1)
TODO unimplemented
|
boolean |
IsLoop() |
boolean |
IsOpen() |
boolean |
IsUniform() |
void |
SetControlPoint(int i,
Vector3f rkCtrl)
Control points may be changed at any time.
|
void |
SetKnot(int i,
float fKnot)
The knot values can be changed only if the basis function is nonuniform
and the input index is valid (0 <= i <= n-d-1).
|
GetLength, GetTime, Integrate
GetBinormal, GetCurvature, GetFrame, GetMaxTime, GetMinTime, GetNormal, GetSpeed, GetTangent, GetTime, GetTorsion, GetTotalLength, SetTimeInterval, SubdivideByLength, SubdivideByTime, SubdivideByVariation, SubdivideByVariation
private static final long serialVersionUID
protected int m_iNumCtrlPoints
protected Vector3f[] m_akCtrlPoint
protected boolean m_bLoop
protected BSplineBasisf m_kBasis
protected int m_iReplicate
public BSplineCurve3f(int iNumCtrlPoints, Vector3f[] akCtrlPoint, int iDegree, boolean bLoop, boolean bOpen)
t[i] = 0, 0 <= i <= d (i-d)/(n+1-d), d+1 <= i <= n 1, n+1 <= i <= n+d+1If bOpen is 'false', the spline is periodic and the knots are
t[i] = (i-d)/(n+1-d), 0 <= i <= n+d+1If bLoop is 'true', extra control points are added to generate a closed curve. For an open spline, the control point array is reallocated and one extra control point is added, set to the first control point C[n+1] = C[0]. For a periodic spline, the control point array is reallocated and the first d points are replicated. In either case the knot array is calculated accordingly.
iNumCtrlPoints
- number of control points is n+1 >= 2akCtrlPoint
- control point arrayiDegree
- degree of the B-spline is d and must satisfy 1 <= d <= nbLoop
- true to generate a closed loopbOpen
- true for open, false for periodicpublic BSplineCurve3f(int iNumCtrlPoints, Vector3f[] akCtrlPoint, int iDegree, boolean bLoop, float[] afKnot)
iNumCtrlPoints
- number of control points is n+1 >= 2akCtrlPoint
- control point arrayiDegree
- degree of the B-spline is d and must satisfy 1 <= d <= nbLoop
- true to generate a closed loopafKnot
- knot arraypublic static BSplineCurve3f CreateApproximation(float[] akValue, int iNumControlPoints, int iDegree)
akValue
- float[] Array of values. The order of the points in the
array defines a path.iNumControlPoints
- int Number of control points to use when
creating the BSpline curve. The location of the control points
are determined to provide a least squares best fit.iDegree
- int Degree of the basis functions to use when creating the
BSpline curve.public static BSplineCurve3f CreateApproximation(Vector3f[] akPoint, int iNumControlPoints, int iDegree)
akPoint
- Point3f[] Array of 3D points. The order of the points in
the array defines a path.iNumControlPoints
- Number of 3D control points to use when creating
the BSpline curve. The location of the 3D control points are
determined to provide a least squares best fit.iDegree
- Degree of the basis functions to use when creating the
BSpline curve.public void dispose()
public void Get(float fTime, Vector3f pkPos, Vector3f pkDer1, Vector3f pkDer2, Vector3f pkDer3)
fTime
- timepkPos
- output positionpkDer1
- output first derivativepkDer2
- output second derivativepkDer3
- output third derivativepublic BSplineBasisf GetBasis()
public Vector3f GetControlPoint(int i)
i
- index return control pointpublic int GetDegree()
public Vector3f GetFirstDerivative(float fTime)
Curve3f
GetFirstDerivative
in class Curve3f
fTime
- Input time value which must be within the range for which
this curve is defined.GetPosition(float fTime)
public float GetKnot(int i)
public int GetNumCtrlPoints()
public Vector3f GetPosition(float fTime)
GetPosition
in class Curve3f
fTime
- timepublic Vector3f GetSecondDerivative(float fTime)
Curve3f
GetSecondDerivative
in class Curve3f
fTime
- Input time value which must be within the range for which
this curve is defined.GetPosition(float)
public Vector3f GetThirdDerivative(float fTime)
GetThirdDerivative
in class Curve3f
GetPosition(float fTime)
public float GetVariation(float fT0, float fT1, Vector3f pkP0, Vector3f pkP1)
GetVariation
in class Curve3f
fT0
- point 0fT1
- point 1pkP0
- curvature at point 0, may be nullpkP1
- curvature at point 1, may be nullCurve3f.SubdivideByVariation(float, int, int, Vector3f[])
public boolean IsLoop()
public boolean IsOpen()
public boolean IsUniform()
public void SetControlPoint(int i, Vector3f rkCtrl)
i
- indexrkCtrl
- new control pointpublic void SetKnot(int i, float fKnot)
i
- indexfKnot
- new knotprivate void CreateControl(Vector3f[] akCtrlPoint)
akCtrlPoint
- starting points