Support Forum       Library Source       SourceForge Page       G3D Web Page     
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 >, 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).
 
float duration () const
 Returns the amount of time covered by this spline in one period.
 
float getFinalInterval () const
 See specification for Spline::finalInterval; this handles the non-positive case.
 

Static Public Member Functions

static Matrix4 computeBasis ()
 Computes the derivative spline basis from the control point version.
 

Public Attributes

bool cyclic
 If cyclic, then the control points will be assumed to wrap around.
 
float finalInterval
 For a cyclic spline, this is the time elapsed between the last control point and the first.
 
Array< float > time
 Times at which control points occur.
 

Protected Member Functions

void computeIndexInBounds (float s, int &i, float &u) const
 Assumes that t0 <= s < tn.
 

Detailed Description

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

Constructor & Destructor Documentation

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

Member Function Documentation

static Matrix4 G3D::SplineBase::computeBasis ( )
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().

void G3D::SplineBase::computeIndexInBounds ( float  s,
int i,
float &  u 
) const
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.

Member Data Documentation

bool G3D::SplineBase::cyclic

If cyclic, then the control points will be assumed to wrap around.

If not cyclic, then the tangents at the ends of the spline point to the final control points.

Referenced by G3D::UprightSplineManipulator::cyclic(), G3D::Spline< UprightFrame >::getControl(), and G3D::UprightSplineManipulator::setCyclic().

float G3D::SplineBase::finalInterval

For a cyclic spline, this is the time elapsed between the last control point and the first.

If less than or equal to zero this is assumed to be:

(time[0] - time[1] + . time[time.size() - 1] - time[time.size() - 2]) / 2.

Array<float> G3D::SplineBase::time

documentation generated on Sat Jan 12 2013 22:49:57 using doxygen 1.8.2