Support Forum       G3D Web Page     
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | List of all members
G3D::SplineBase Class Reference

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...
 

Detailed Description

Common implementation code for all G3D::Spline template parameters.

Constructor & Destructor Documentation

◆ SplineBase()

G3D::SplineBase::SplineBase ( )
inline

◆ ~SplineBase()

virtual G3D::SplineBase::~SplineBase ( )
inlinevirtual

Member Function Documentation

◆ computeBasis()

static Matrix4 G3D::SplineBase::computeBasis ( )
static

Computes the derivative spline basis from the control point version.

Referenced by G3D::Spline< UprightFrame >::evaluate().

◆ computeIndex()

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().

◆ computeIndexInBounds()

void G3D::SplineBase::computeIndexInBounds ( float  s,
int &  i,
float &  u 
) const
protected

Assumes that t0 <= s < tn.

called by computeIndex.

◆ duration()

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().

◆ getFinalInterval()

float G3D::SplineBase::getFinalInterval ( ) const

See specification for Spline::finalInterval; this handles the non-positive case.

Returns 0 if not cyclic.

Member Data Documentation

◆ extrapolationMode

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().

◆ finalInterval

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().

◆ interpolationMode

SplineInterpolationMode G3D::SplineBase::interpolationMode

◆ time

Array<float> G3D::SplineBase::time

documentation generated on Wed Nov 24 2021 08:02:00 using doxygen 1.8.15