public class BSplineBasisf extends Object implements Serializable
Modifier and Type | Field and Description |
---|---|
protected float[][] |
m_aafBD0
Storage for the basis functions.
|
protected float[][] |
m_aafBD1
Storage for first three derivatives.
|
protected float[][] |
m_aafBD2
bd2[d+1][n+d+1]
|
protected float[][] |
m_aafBD3
bd3[d+1][n+d+1]
|
protected float[] |
m_afKnot
knot[n+d+2]
|
protected boolean |
m_bOpen
flags
|
protected boolean |
m_bUniform
flags
|
protected int |
m_iDegree
d
|
protected int |
m_iNumCtrlPoints
n+1
|
protected int |
m_iNumKnots
number of knots
|
private static long |
serialVersionUID |
Constructor and Description |
---|
BSplineBasisf()
Empty default constructor.
|
BSplineBasisf(int iNumCtrlPoints,
int iDegree)
Open uniform.
|
BSplineBasisf(int iNumCtrlPoints,
int iDegree,
boolean bOpen)
Open uniform or periodic uniform.
|
BSplineBasisf(int iNumCtrlPoints,
int iDegree,
float[] afKnot)
Open nonuniform.
|
Modifier and Type | Method and Description |
---|---|
private float[][] |
Allocate()
Position and derivative storage allocation.
|
int |
Compute(float fU,
float[] afBD0,
float[] afBD1,
float[] afBD2)
Evaluate basis functions for the given input and return the knot index i
for which knot[i] <= fU < knot[i+1].
|
void |
Compute(float fTime,
int uiOrder,
int[] riMinIndex,
int[] riMaxIndex)
evaluate basis functions and their derivatives
|
void |
Create(int iNumCtrlPoints,
int iDegree,
boolean bOpen)
Open uniform or periodic uniform.
|
void |
Create(int iNumCtrlPoints,
int iDegree,
float[] afKnot)
Open nonuniform.
|
void |
dispose()
release resources
|
float |
GetD0(int i) |
float |
GetD1(int i) |
float |
GetD2(int i) |
float |
GetD3(int i) |
int |
GetDegree() |
int |
GetKey(float[] rfTime)
Determine knot index i for which knot[i] <= rfTime < knot[i+1].
|
float |
GetKnot(int i)
Knot access for nonuniform splines
|
int |
GetKnotIndex(float fU)
Return the knot index i for which knot[i] <= fU < knot[i+1].
|
static int |
GetMinNumControlPoints(int iDegree)
Given a BSpline degree, return the minimum number of control points that
is required.
|
int |
GetNumCtrlPoints() |
private int |
Initialize(int iNumCtrlPoints,
int iDegree,
boolean bOpen)
Common initialization.
|
boolean |
IsOpen() |
boolean |
IsSameAs(BSplineBasisf that)
Return indication of whether two BSpline basis instances are the same.
|
boolean |
IsUniform() |
void |
SetKnot(int i,
float fKnot)
Knot access for nonuniform splines
|
private static final long serialVersionUID
protected int m_iNumCtrlPoints
protected int m_iDegree
protected float[] m_afKnot
protected int m_iNumKnots
protected boolean m_bOpen
protected boolean m_bUniform
protected float[][] m_aafBD0
protected float[][] m_aafBD1
protected float[][] m_aafBD2
protected float[][] m_aafBD3
public BSplineBasisf()
public BSplineBasisf(int iNumCtrlPoints, int iDegree)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1Create(int, int, boolean)
public BSplineBasisf(int iNumCtrlPoints, int iDegree, boolean bOpen)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1bOpen
- true for open uniform, false for periodic uniform.Create(int, int, boolean)
public BSplineBasisf(int iNumCtrlPoints, int iDegree, float[] afKnot)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1afKnot
- The knot array must have n-d elements. The elements must be
nondecreasing. Each element must be in [0,1].Create(int, int, float[])
public static int GetMinNumControlPoints(int iDegree)
iDegree
- Input degree of the BSpline.public int Compute(float fU, float[] afBD0, float[] afBD1, float[] afBD2)
fU
- float Input value in the [0,1] range. Clamped if not.afBD0
- float[] Array to be filled with position basis evaluation at
each of the knot values for the given fU input. This array
must have enough elements to store a value for each control
point. This array must not be null.afBD1
- float[] Array to be filled with first derivative basis
evaluation at each of the knot values for the given fU input.
This array may be null meaning that the first derivative basis
evaluation is not computed, but if the array is defined it
must have enough elements to store a value for each control
point. If this array is null, then the afBD2 array must also
be null.afBD2
- float[] Array to be filled with second derivative basis
evaluation at each of the knot values for the given fU input.
This array may be null meaning that the second derivative
basis evaluation is not computed, but if the array is defined
it must have enough elements to store a value for each control
point. If this array is not null, then the afBD1 array must
not be null.IllegalArgumentException
- when afBD0 is nullpublic void Compute(float fTime, int uiOrder, int[] riMinIndex, int[] riMaxIndex)
public void Create(int iNumCtrlPoints, int iDegree, boolean bOpen)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1bOpen
- true for open uniform, false for periodic uniform.public void Create(int iNumCtrlPoints, int iDegree, float[] afKnot)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1afKnot
- The knot array must have n-d elements. The elements must be
nondecreasing. Each element must be in [0,1].public void dispose()
public float GetD0(int i)
i
- control pointpublic float GetD1(int i)
i
- control pointpublic float GetD2(int i)
i
- control pointpublic float GetD3(int i)
i
- control pointpublic int GetDegree()
public int GetKey(float[] rfTime)
public float GetKnot(int i)
i
- knot indexpublic int GetKnotIndex(float fU)
fU
- Input value in the [0,1] range.public int GetNumCtrlPoints()
public boolean IsOpen()
public boolean IsSameAs(BSplineBasisf that)
that
- BSplineBasisf BSpline basis instance to check for similarity.public boolean IsUniform()
public void SetKnot(int i, float fKnot)
i
- knot indexfKnot
- knot valueprivate float[][] Allocate()
private int Initialize(int iNumCtrlPoints, int iDegree, boolean bOpen)
iNumCtrlPoints
- number of spline control points, 2 or more.iDegree
- polynomial degree, between 1 and iNumCtrlPoints - 1bOpen
- true for open uniform, false for periodic uniform.Create(int, int, boolean)