![]() |
Murl Engine API
Version 2018.3
|
A template base class for spline interpolations. More...
#include <murl_math_spline_base.h>
A template base class for spline interpolations.
Public Types | |
enum | WrapMode { WRAP_NONE, WRAP_CLAMP_TO_EDGE, WRAP_REPEAT, WRAP_REPEAT_MIRRORED } |
Enumeration of the wrap modes. More... | |
enum | CurveType { CURVE_DEFAULT, CURVE_CLOSED } |
Enumeration of the curve type. More... | |
typedef DataType | ValueType |
The template parameter value type. More... | |
typedef SplineKey< DataType > | Key |
Type definition of the animation key data type. More... | |
Public Member Functions | |
SplineBase () | |
The default constructor. More... | |
SplineBase (WrapMode wrapMode, CurveType curveType) | |
Constructor taking the wrap mode and the curve type. More... | |
virtual | ~SplineBase () |
The destructor. | |
void | SetCurveType (CurveType curveType) |
Set the current curve type. More... | |
CurveType | GetCurveType () const |
Get the current curve type. More... | |
void | SetWrapMode (WrapMode wrapMode) |
Set the current wrap mode. More... | |
WrapMode | GetWrapMode () const |
Get the current wrap mode. More... | |
SInt32 | AddKey (const Key &key) |
Add a new interpolation key. More... | |
SInt32 | AddKey (Real time, const DataType &value) |
Add a new interpolation key. More... | |
Bool | RemoveKey (SInt32 index) |
Remove a key at a specified index. More... | |
Bool | SetKeyValue (SInt32 index, const DataType &value) |
Set a key's value for a specified index. More... | |
SInt32 | SetKey (SInt32 index, const Key &key) |
Set a key for a specified index. More... | |
SInt32 | SetKey (SInt32 index, Real time, const DataType &value) |
Set a key for a specified index. More... | |
void | CopyKeys (const SplineBase< DataType > &source) |
Copy the keys from a spline object. More... | |
SInt32 | GetKeyIndex (Real time) const |
Get the nearest key index for a specified time. More... | |
SInt32 | GetNumberOfKeys () const |
Get the number of keys. More... | |
const Key & | GetKey (SInt32 index) const |
Get a key for a specified index. More... | |
void | EmptyKeys () |
Empty the keys, but keep the underlying storage. | |
void | ClearKeys () |
Clear the keys and remove the underlying storage. | |
virtual const DataType & | Interpolate (Double time) |
Get the interpolated value at a specific time. More... | |
Bool | UpdateControlPoints () |
Update the control points immediately. More... | |
void | SetControlPointsValid (Bool areValid) |
Set the control points valid state. More... | |
Protected Member Functions | |
virtual Bool | CalculateControlPoints ()=0 |
Override point for updating control points if the keys or the wrap mode or the curve type changed. More... | |
virtual void | InterpolateCurrentValue (Double time, SInt32 timeIndex)=0 |
Override point to update the current value for a specified time. More... | |
Key | GetPrevKey (SInt32 index) const |
Get the previous key for a specified index depending on the curve type and the wrap mode. More... | |
Key | GetNextKey (SInt32 index) const |
Get the next key for a specified index depending on the curve type and the wrap mode. More... | |
SInt32 | FindIndex (Real time) const |
Find the index using binary search O(log n). More... | |
Protected Attributes | |
Array< Key > | mKeys |
The key array stores all given keys sorted according to the time value. More... | |
CurveType | mCurveType |
The current curve type. More... | |
WrapMode | mWrapMode |
The current wrap mode. More... | |
DataType | mCurrentValue |
The current interpolated value. More... | |
typedef DataType Murl::Math::SplineBase< DataType >::ValueType |
The template parameter value type.
typedef SplineKey<DataType> Murl::Math::SplineBase< DataType >::Key |
Type definition of the animation key data type.
enum Murl::Math::SplineBase::WrapMode |
enum Murl::Math::SplineBase::CurveType |
|
inline |
The default constructor.
The default wrap mode is CLAMP_TO_EDGE. The default curve type is CURVE_DEFAULT.
|
inline |
Constructor taking the wrap mode and the curve type.
wrapMode | The wrapMode. |
curveType | The curveType. |
|
inline |
Set the current curve type.
curveType | The curve type to set. |
|
inline |
Get the current curve type.
|
inline |
Set the current wrap mode.
wrapMode | The wrap mode to set. |
|
inline |
Get the current wrap mode.
|
inline |
Add a new interpolation key.
The key is inserted into the sorted key array according to the time value.
key | The key to copy and add. |
|
inline |
Add a new interpolation key.
The key is inserted into the sorted key array according to the time value.
time | The time for the key in seconds. |
value | The value for the key. |
|
inline |
Remove a key at a specified index.
index | The zero-based index. |
|
inline |
Set a key's value for a specified index.
index | The zero-based index. |
value | The value to set. |
|
inline |
Set a key for a specified index.
The key is set into the sorted key array according to the key's time value, therefore the key's index may change which is returned.
index | The zero-based index. |
key | The key to copy and set. |
|
inline |
Set a key for a specified index.
The key is set into the sorted key array according to the time value, therefore the key's index may change which is returned.
index | The zero-based index. |
time | The time for the key in seconds. |
value | The value to set. |
|
inline |
Copy the keys from a spline object.
Overwrites this object's keys with the source keys.
source | The source spline object. |
|
inline |
Get the nearest key index for a specified time.
time | The time in seconds. |
|
inline |
Get the number of keys.
|
inline |
Get a key for a specified index.
index | The zero-based index in range [0 .. GetNumberOfKeys()-1]. |
|
inlinevirtual |
Get the interpolated value at a specific time.
time | The time for the interpolation value in seconds. |
|
inline |
Update the control points immediately.
The countrol points are updated automatically during Interpolate() if necessary, this method is used to update the control points before calling Interpolate().
|
inline |
Set the control points valid state.
Every modification of the key's time or value invalidates the control points. This method is used to suppress automatic updating of the control points, if manually modification of the control points is required.
areValid | The control points valid state. |
|
protectedpure virtual |
Override point for updating control points if the keys or the wrap mode or the curve type changed.
|
protectedpure virtual |
Override point to update the current value for a specified time.
time | The time to interpolate. |
timeIndex | The index to the nearest key which is greater or equal the time. |
|
inlineprotected |
Get the previous key for a specified index depending on the curve type and the wrap mode.
index | The index. |
|
inlineprotected |
Get the next key for a specified index depending on the curve type and the wrap mode.
index | The index. |
|
inlineprotected |
Find the index using binary search O(log n).
Returns the index of the nearest key that is greater or equal to the given time.
time | The time to search for. |
|
protected |
The key array stores all given keys sorted according to the time value.
|
protected |
The current curve type.
|
protected |
The current wrap mode.
|
protected |
The current interpolated value.