Contents User Forum Source Index APIs by Task APIs by Level Data


G3D::Spline< Control > Class Template Reference

Piecewise 3rd-order Catmull-Rom spline curve for uniformly spaced control points in time. More...

#include <Spline.h>

List of all members.

Public Member Functions

void append (const Control &c)
void clear ()
Control evaluate (float s) const
int size () const
 Spline ()
virtual ~Spline ()

Public Attributes

Array< Control > control
bool cyclic

Protected Member Functions

virtual void correct (Control &A) const
virtual void ensureShortestPath (Control *A, int N) const
const Control & getControl (int i) const
void getControls (int i, Control *A, int N) const


Detailed Description

template<typename Control>
class G3D::Spline< Control >

Piecewise 3rd-order Catmull-Rom spline curve for uniformly spaced control points in time.

See Real Time Rendering, 2nd edition, ch 12 for discussion of splines.

The template parameter must support operator+(Control) and operator*(float).

To provide shortest-path interpolation, override ensureShortestPath().

See also G3D::UprightSpline, G3D::QuatSpline.


Constructor & Destructor Documentation

template<typename Control>
G3D::Spline< Control >::Spline (  )  [inline]

template<typename Control>
virtual G3D::Spline< Control >::~Spline (  )  [inline, virtual]


Member Function Documentation

template<typename Control>
void G3D::Spline< Control >::append ( const Control &  c  )  [inline]

template<typename Control>
void G3D::Spline< Control >::clear (  )  [inline]

template<typename Control>
virtual void G3D::Spline< Control >::correct ( Control &  A  )  const [inline, protected, virtual]

Normalize or otherwise adjust this interpolated Control before returning it.

template<typename Control>
virtual void G3D::Spline< Control >::ensureShortestPath ( Control *  A,
int  N 
) const [inline, protected, virtual]

Mutates the array of N control points.

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 in G3D::UprightSpline.

template<typename Control>
Control G3D::Spline< Control >::evaluate ( float  s  )  const [inline]

Return the position at parameter s.

For a non-cyclic spline, the curve is clamped at the beginning and ending points and between 0 and 1

template<typename Control>
const Control& G3D::Spline< Control >::getControl ( int  i  )  const [inline, protected]

Returns the requested control point, wrapping at the ends.

template<typename Control>
void G3D::Spline< Control >::getControls ( int  i,
Control *  A,
int  N 
) const [inline, protected]

The indices may be assumed to be treated cyclically.

template<typename Control>
int G3D::Spline< Control >::size (  )  const [inline]

Number of control points.


Member Data Documentation

template<typename Control>
Array<Control> G3D::Spline< Control >::control

Control points.

template<typename Control>
bool G3D::Spline< Control >::cyclic

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

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


The documentation for this class was generated from the following file:
Generated on Thu Aug 2 11:40:47 2007 for G3D by doxygen 1.5.2
Hosted by SourceForge.net Logo