cocos2d-x  3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
PUSimpleSpline Class Reference

#include <CCPUSimpleSpline.h>

Public Member Functions

 PUSimpleSpline ()
 ~PUSimpleSpline ()
void addPoint (const Vec3 &p)
 Adds a control point to the end of the spline. More...
 
local addPoint ( local p)
 Adds a control point to the end of the spline. More...
 
const Vec3getPoint (unsigned short index) const
 Gets the detail of one of the control points of the spline. More...
 
unsigned short getNumPoints (void) const
 Gets the number of control points in the spline. More...
 
void clear (void)
 Clears all the points in the spline. More...
 
void updatePoint (unsigned short index, const Vec3 &value)
 Updates a single point in the spline. More...
 
local updatePoint ( local index, local value)
 Updates a single point in the spline. More...
 
Vec3 interpolate (float t) const
 Returns an interpolated point based on a parametric value over the whole series. More...
 
Vec3 interpolate (unsigned int fromIndex, float t) const
 Interpolates a single segment of the spline given a parametric value. More...
 
void setAutoCalculate (bool autoCalc)
 Tells the spline whether it should automatically calculate tangents on demand as points are added. More...
 
void recalcTangents (void)
 Recalculates the tangents associated with this spline. More...
 

Protected Attributes

bool _autoCalc
std::vector< Vec3_points
var _points
local _points
std::vector< Vec3_tangents
Mat4 _coeffs
 Matrix of coefficients. More...
 

Constructor & Destructor Documentation

var PUSimpleSpline ( )
local PUSimpleSpline ( )
var ~PUSimpleSpline ( )
local ~PUSimpleSpline ( )

Member Function Documentation

void addPoint ( const Vec3 p)

Adds a control point to the end of the spline.

var addPoint ( var  p)

Adds a control point to the end of the spline.

local addPoint ( local  p)

Adds a control point to the end of the spline.

void clear ( void  )

Clears all the points in the spline.

var clear (   )

Clears all the points in the spline.

local clear (   )

Clears all the points in the spline.

unsigned short getNumPoints ( void  ) const

Gets the number of control points in the spline.

var getNumPoints (   )

Gets the number of control points in the spline.

local getNumPoints (   )

Gets the number of control points in the spline.

const Vec3& getPoint ( unsigned short  index) const

Gets the detail of one of the control points of the spline.

var getPoint ( var  index)

Gets the detail of one of the control points of the spline.

local getPoint ( local  index)

Gets the detail of one of the control points of the spline.

Vec3 interpolate ( float  t) const

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

Remarks
Given a t value between 0 and 1 representing the parametric distance along the whole length of the spline, this method returns an interpolated point.
Parameters
tParametric value.
var interpolate ( var  t)

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

Remarks
Given a t value between 0 and 1 representing the parametric distance along the whole length of the spline, this method returns an interpolated point.
Parameters
tParametric value.
local interpolate ( local  t)

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

Remarks
Given a t value between 0 and 1 representing the parametric distance along the whole length of the spline, this method returns an interpolated point.
Parameters
tParametric value.
Vec3 interpolate ( unsigned int  fromIndex,
float  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
var interpolate ( var  fromIndex,
var  t 
)

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
local interpolate ( local  fromIndex,
local  t 
)

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

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.
var 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.
local 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.
var setAutoCalculate ( var  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.
local setAutoCalculate ( local  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.
void updatePoint ( unsigned short  index,
const Vec3 value 
)

Updates a single point in the spline.

Remarks
This point must already exist in the spline.
var updatePoint ( var  index,
var  value 
)

Updates a single point in the spline.

Remarks
This point must already exist in the spline.
local updatePoint ( local  index,
local  value 
)

Updates a single point in the spline.

Remarks
This point must already exist in the spline.

Member Data Documentation

bool _autoCalc
protected
Mat4 _coeffs
protected

Matrix of coefficients.

var _coeffs
protected

Matrix of coefficients.

local _coeffs
protected

Matrix of coefficients.

std::vector<Vec3> _points
protected
var _points
protected
local _points
protected
std::vector<Vec3> _tangents
protected
var _tangents
protected
local _tangents
protected

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