Public Member Functions | Protected Attributes
Spline Class Reference

List of all members.

Public Member Functions

void AddPoint (const Vector3 &_pt)
 Adds a control point to the end of the spline.
const Vector3GetPoint (unsigned short _index) const
 Gets the detail of one of the control points of the spline.
unsigned int GetNumPoints () const
 Gets the number of control points in the spline.
void Clear ()
 Clears all the points in the spline.
void UpdatePoint (unsigned int _index, const Vector3 &_value)
 Updates a single point in the spline.
Vector3 Interpolate (double _t) const
 Returns an interpolated point based on a parametric value over the whole series.
Vector3 Interpolate (unsigned int _fromIndex, double _t) const
 Interpolates a single segment of the spline given a parametric value.
void SetAutoCalculate (bool _autoCalc)
 Tells the spline whether it should automatically calculate tangents on demand as points are added.
void RecalcTangents ()
 Recalculates the tangents associated with this spline.

Protected Attributes

bool autoCalc
std::vector< Vector3points
std::vector< Vector3tangents
Matrix4 coeffs
 Matrix of coefficients.

Member Function Documentation

Vector3 Interpolate ( double  _t) const

Returns an interpolated point based on a parametric value over the whole series.

Vector3 Interpolate ( unsigned int  _fromIndex,
double  _t 
) const

Interpolates a single segment of the spline given a parametric value.

Parameters:
_fromIndexThe point index to treat as t=0. fromIndex + 1 is deemed to be t=1
_tParametric value
void RecalcTangents ( )

Recalculates the tangents associated with this spline.

Remarks:
If you tell the spline not to update on demand by calling setAutoCalculate(false) then you must call this after completing your updates to the spline points.
void SetAutoCalculate ( bool  _autoCalc)

Tells the spline whether it should automatically calculate tangents on demand as points are added.

Remarks:
The spline calculates tangents at each point automatically based on the input points. Normally it does this every time a point changes. However, if you have a lot of points to add in one go, you probably don't want to incur this overhead and would prefer to defer the calculation until you are finished setting all the points. You can do this by calling this method with a parameter of 'false'. Just remember to manually call the recalcTangents method when you are done.
Parameters:
_autoCalcIf true, tangents are calculated for you whenever a point changes. If false, you must call reclacTangents to recalculate them when it best suits.

The documentation for this class was generated from the following file: