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 | Protected Attributes | List of all members
G3D::PhysicsFrameSpline Class Reference

A subclass of Spline that keeps the rotation field of a PhysicsFrame normalized and rotating the short direction. More...

Inherits G3D::Spline< PhysicsFrame >.

Public Member Functions

 PhysicsFrameSpline ()
 
 PhysicsFrameSpline (const Any &any)
 Accepts a table of properties, or any valid PhysicsFrame specification for a single control.
 
void append (float t, const PhysicsFrame &c)
 Appends a control point at a specific time that must be greater than that of the previous point.
 
void append (const PhysicsFrame &c)
 Appends control point spaced in time based on the previous control point, or spaced at unit intervals if this is the first control point.
 
void clear ()
 Erases all control points and times, but retains the state of cyclic and finalInterval.
 
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).
 
virtual void correct (PhysicsFrame &frame) const
 Normalize or otherwise adjust this interpolated Control.
 
float duration () const
 Returns the amount of time covered by this spline in one period.
 
virtual void ensureShortestPath (PhysicsFrame *A, int N) const
 Mutates the array of N control points that begins at A.
 
PhysicsFrame evaluate (float s) const
 Return the position at time s.
 
void getControl (int i, float &t, PhysicsFrame &c) const
 Returns the requested control point and time sample based on array index.
 
float getFinalInterval () const
 See specification for Spline::finalInterval; this handles the non-positive case.
 
bool operator!= (const PhysicsFrameSpline &a) const
 
PhysicsFrameSplineoperator= (const Any &any)
 Clear and then reset all values from the any.
 
bool operator== (const PhysicsFrameSpline &a) const
 
int size () const
 Number of control points.
 
Any toAny () const
 

Static Public Member Functions

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

Public Attributes

Array< PhysicsFramecontrol
 Control points.
 
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.
 
void getControls (int i, float *T, PhysicsFrame *A, int N) const
 Returns a series of N control points and times, fixing boundary issues.
 

Protected Attributes

PhysicsFrame zero
 The additive identity control point.
 

Detailed Description

A subclass of Spline that keeps the rotation field of a PhysicsFrame normalized and rotating the short direction.

See Also
UprightFrameSpline

Constructor & Destructor Documentation

G3D::PhysicsFrameSpline::PhysicsFrameSpline ( )
G3D::PhysicsFrameSpline::PhysicsFrameSpline ( const Any any)

Accepts a table of properties, or any valid PhysicsFrame specification for a single control.

Member Function Documentation

void G3D::Spline< PhysicsFrame >::append ( float  t,
const PhysicsFrame c 
)
inlineinherited

Appends a control point at a specific time that must be greater than that of the previous point.

void G3D::Spline< PhysicsFrame >::append ( const PhysicsFrame c)
inlineinherited

Appends control point spaced in time based on the previous control point, or spaced at unit intervals if this is the first control point.

void G3D::Spline< PhysicsFrame >::clear ( )
inlineinherited

Erases all control points and times, but retains the state of cyclic and finalInterval.

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

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
inherited

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
protectedinherited

Assumes that t0 <= s < tn.

called by computeIndex.

virtual void G3D::PhysicsFrameSpline::correct ( PhysicsFrame A) const
virtual

Normalize or otherwise adjust this interpolated Control.

Reimplemented from G3D::Spline< PhysicsFrame >.

float G3D::SplineBase::duration ( ) const
inherited

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

virtual void G3D::PhysicsFrameSpline::ensureShortestPath ( PhysicsFrame A,
int  N 
) const
virtual

Mutates the array of N control points that begins at A.

It is useful to override this method by one that wraps the values if they are angles or quaternions for which "shortest path" interpolation is significant.

Reimplemented from G3D::Spline< PhysicsFrame >.

PhysicsFrame G3D::Spline< PhysicsFrame >::evaluate ( float  s) const
inlineinherited

Return the position at time s.

The spline is defined outside of the time samples by extrapolation or cycling.

void G3D::Spline< PhysicsFrame >::getControl ( int  i,
float &  t,
PhysicsFrame c 
) const
inlineinherited

Returns the requested control point and time sample based on array index.

If the array index is out of bounds, wraps (for a cyclic spline) or linearly extrapolates (for a non-cyclic spline), assuming time intervals follow the first or last sample recorded.

Calls correct() on the control point if it was extrapolated.

Returns 0 if there are no control points.

See Also
Spline::control and Spline::time for the underlying control point array; Spline::computeIndex to find the index given a time.
void G3D::Spline< PhysicsFrame >::getControls ( int  i,
float *  T,
PhysicsFrame A,
int  N 
) const
inlineprotectedinherited

Returns a series of N control points and times, fixing boundary issues.

The indices may be assumed to be treated cyclically.

float G3D::SplineBase::getFinalInterval ( ) const
inherited

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

Returns 0 if not cyclic.

bool G3D::PhysicsFrameSpline::operator!= ( const PhysicsFrameSpline a) const
inline
PhysicsFrameSpline& G3D::PhysicsFrameSpline::operator= ( const Any any)

Clear and then reset all values from the any.

bool G3D::PhysicsFrameSpline::operator== ( const PhysicsFrameSpline a) const
int G3D::Spline< PhysicsFrame >::size ( ) const
inlineinherited

Number of control points.

Any G3D::PhysicsFrameSpline::toAny ( ) const

Member Data Documentation

Array<PhysicsFrame > G3D::Spline< PhysicsFrame >::control
inherited

Control points.

Must have the same number of elements as Spline::time.

bool G3D::SplineBase::cyclic
inherited

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
inherited

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
inherited
PhysicsFrame G3D::Spline< PhysicsFrame >::zero
protectedinherited

The additive identity control point.


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