Murl::Math::SplineBezier< DataType > Class Template Reference

A template class to create a Bezier spline interpolation object. More...

#include "murl_math_spline_bezier.h"

Inheritance diagram for Murl::Math::SplineBezier< DataType >:

Classes

class  ControlPoint
 The control point class. More...
 

Public Types

using ValueType = DataType
 The template parameter value type.
 
using BaseType = SplineBase< DataType >
 The base class type.
 
using Key = SplineKey< DataType >
 Type definition of the animation key data type.
 
enum  WrapMode
 Enumeration of the wrap modes.
 
enum  CurveType
 Enumeration of the curve type.
 
- Public Types inherited from Murl::Math::SplineBase< DataType >
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...
 
using ValueType = DataType
 The template parameter value type.
 
using Key = SplineKey< DataType >
 Type definition of the animation key data type.
 

Public Member Functions

 SplineBezier ()
 The default constructor.
 
 SplineBezier (WrapMode wrapMode, CurveType curveType)
 Constructor taking the wrap mode and the curve type. More...
 
 ~SplineBezier () override
 The destructor.
 
Array< ControlPoint > & GetControlPoints ()
 Get the control points for each key. More...
 
Bool CalculateControlPoint (SInt32 index)
 Calculate the control point for a specified index. More...
 
- Public Member Functions inherited from Murl::Math::SplineBase< DataType >
 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 KeyGetKey (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 Attributes

Array< KeymKeys
 The key array stores all given keys sorted according to the time value.
 
- Protected Attributes inherited from Murl::Math::SplineBase< DataType >
Array< KeymKeys
 The key array stores all given keys sorted according to the time value.
 
CurveType mCurveType
 The current curve type.
 
WrapMode mWrapMode
 The current wrap mode.
 
DataType mCurrentValue
 The current interpolated value.
 

Additional Inherited Members

- Protected Member Functions inherited from Murl::Math::SplineBase< DataType >
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...
 

Detailed Description

template<class DataType>
class Murl::Math::SplineBezier< DataType >

A template class to create a Bezier spline interpolation object.

The control points are calculated automatically.

Constructor & Destructor Documentation

◆ SplineBezier()

template<class DataType >
Murl::Math::SplineBezier< DataType >::SplineBezier ( WrapMode  wrapMode,
CurveType  curveType 
)
inline

Constructor taking the wrap mode and the curve type.

Parameters
wrapModeThe wrapMode.
curveTypeThe curveType.

Member Function Documentation

◆ GetControlPoints()

template<class DataType >
Array<ControlPoint>& Murl::Math::SplineBezier< DataType >::GetControlPoints ( )
inline

Get the control points for each key.

Returns
The control points for each key.

◆ CalculateControlPoint()

template<class DataType >
Bool Murl::Math::SplineBezier< DataType >::CalculateControlPoint ( SInt32  index)
inline

Calculate the control point for a specified index.

Parameters
indexThe zero-based index in range [0 .. GetNumberOfKeys()-1].
Returns
true if successful, false if the index is invalid.

References Murl::Math::SplineBase< DataType >::GetNextKey(), Murl::Math::SplineBase< DataType >::GetPrevKey(), Murl::Array< DataType >::IsIndexValid(), Murl::Math::SplineBezier< DataType >::mKeys, Murl::Math::SplineKey< DataType >::mTime, and Murl::Math::SplineKey< DataType >::mValue.


The documentation for this class was generated from the following file:
  • murl_math_spline_bezier.h


Copyright © 2011-2024 Spraylight GmbH.