Support Forum G3D Web Page |
Common implementation code for all G3D::Spline template parameters. More...
Inherited by G3D::Spline< Control >, G3D::Spline< float >, G3D::Spline< PhysicsFrame >, G3D::Spline< Power3 >, and G3D::Spline< UprightFrame >.
Public Member Functions | |
SplineBase () | |
virtual | ~SplineBase () |
void | computeIndex (float s, int &i, float &u) const |
Given a time s, finds i and 0 <= u < 1 such that s = time[i] * u + time[i + 1] * (1 - u). More... | |
float | duration () const |
Returns the amount of time covered by this spline in one period. More... | |
float | getFinalInterval () const |
See specification for Spline::finalInterval; this handles the non-positive case. More... | |
Static Public Member Functions | |
static Matrix4 | computeBasis () |
Computes the derivative spline basis from the control point version. More... | |
Public Attributes | |
SplineExtrapolationMode | extrapolationMode |
If SplineInterpolationMode::CYCLIC, then the control points will be assumed to wrap around. More... | |
float | finalInterval |
For a cyclic spline, this is the time elapsed between the last control point and the first. More... | |
SplineInterpolationMode | interpolationMode |
Array< float > | time |
Times at which control points occur. More... | |
Protected Member Functions | |
void | computeIndexInBounds (float s, int &i, float &u) const |
Assumes that t0 <= s < tn. More... | |
Common implementation code for all G3D::Spline template parameters.
|
inline |
|
inlinevirtual |
|
static |
Computes the derivative spline basis from the control point version.
Referenced by G3D::Spline< UprightFrame >::evaluate().
void G3D::SplineBase::computeIndex | ( | float | s, |
int & | i, | ||
float & | u | ||
) | const |
Given a time s, finds i and 0 <= u < 1 such that s = time[i] * u + time[i + 1] * (1 - u).
Note that i may be outside the bounds of the time and control arrays; use getControl to handle wraparound and extrapolation issues.
This function takes expected O(1) time for control points with uniform time sampled control points or for uniformly distributed random time samples, but may take O( log time.size() ) time in the worst case.
Called from evaluate().
Referenced by G3D::Spline< UprightFrame >::evaluate().
|
protected |
Assumes that t0 <= s < tn.
called by computeIndex.
float G3D::SplineBase::duration | ( | ) | const |
Returns the amount of time covered by this spline in one period.
For a cyclic spline, this contains the final interval.
Referenced by G3D::Spline< UprightFrame >::getControl().
float G3D::SplineBase::getFinalInterval | ( | ) | const |
See specification for Spline::finalInterval; this handles the non-positive case.
Returns 0 if not cyclic.
SplineExtrapolationMode G3D::SplineBase::extrapolationMode |
If SplineInterpolationMode::CYCLIC, then the control points will be assumed to wrap around.
If SplineInterpolationMode::LINEAR, then the tangents at the ends of the spline point to the final control points. If SplineInterpolationMode::CLAMP, the end control points will be treated as multiple contol points (so the value remains constant at the ends)
Referenced by G3D::UprightSplineManipulator::extrapolationMode(), G3D::Spline< UprightFrame >::getControl(), G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), G3D::UprightSplineManipulator::setExtrapolationMode(), and G3D::Spline< UprightFrame >::toAny().
float G3D::SplineBase::finalInterval |
For a cyclic spline, this is the time elapsed between the last control point and the first.
If less than zero this is assumed to be:
(time[0] - time[1] + . time[time.size() - 1] - time[time.size() - 2]) / 2.
Referenced by G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), and G3D::Spline< UprightFrame >::toAny().
SplineInterpolationMode G3D::SplineBase::interpolationMode |
Array<float> G3D::SplineBase::time |
Times at which control points occur.
Must have the same number of elements as Spline::control.
Referenced by G3D::Spline< UprightFrame >::append(), G3D::Spline< UprightFrame >::clear(), G3D::Spline< UprightFrame >::evaluate(), G3D::Spline< UprightFrame >::getControl(), G3D::Spline< UprightFrame >::hashCode(), G3D::Spline< UprightFrame >::init(), G3D::Spline< UprightFrame >::operator==(), G3D::Spline< UprightFrame >::size(), G3D::Spline< UprightFrame >::Spline(), and G3D::Spline< UprightFrame >::toAny().