|
VR-Engage
2.2
|
This template class provides interpolation between start and end values using Bezier curves for easing over a specified time period. Specializations are provided for float, double, DtVector, and DtQuat types.
| T | The type of value to interpolate |
#include <bezierInterpolator.h>
Public Member Functions | |
| DtBezierInterpolator (makVrv::DtEaser easer, T start, T stop, double period) | |
| ~DtBezierInterpolator () | |
| void | tick (double dt) |
| T | value () const |
| bool | isDone () const |
| void | reset () |
| void | reset (T start, T stop, double period) |
| void | reset (makVrv::DtEaser easer, T start, T stop, double period) |
| T | start () const |
| T | stop () const |
| double | timeRemaining () const |
Protected Attributes | |
| makVrv::DtEaser | myEaser |
| T | myStart |
| T | myEnd |
| T | myCurrentValue |
| double | myPeriod |
| double | myCurrentTime |
| makVre::DtBezierInterpolator< T >::DtBezierInterpolator | ( | makVrv::DtEaser | easer, |
| T | start, | ||
| T | stop, | ||
| double | period ) |
Constructor.
Constructor implementation.
Initializes the interpolator with an easing function, start and end values, and the time period.
| easer | The easing function to use for interpolation |
| start | The starting value |
| stop | The ending value |
| period | The time period over which to interpolate (in seconds) |
References myCurrentTime, myCurrentValue, myEaser, myEnd, myPeriod, myStart, start(), and stop().
| makVre::DtBezierInterpolator< T >::~DtBezierInterpolator | ( | ) |
Destructor.
Destructor implementation.
| void makVre::DtBezierInterpolator< T >::tick | ( | double | dt | ) |
Updates the interpolation based on elapsed time.
This function advances the interpolation by the given time step, recalculating the current value based on the elapsed time and easing function. Specialized implementations are provided for float, double, DtVector, and DtQuat.
| dt | The time step in seconds |
| T makVre::DtBezierInterpolator< T >::value | ( | ) | const |
Gets the current interpolated value.
Gets the current value of the interpolation.
References myCurrentValue.
| bool makVre::DtBezierInterpolator< T >::isDone | ( | ) | const |
Checks if the interpolation has completed.
References myCurrentTime, and myPeriod.
| void makVre::DtBezierInterpolator< T >::reset | ( | ) |
Resets the interpolation to the beginning.
Sets the current value back to the start value and resets the time to zero
References myCurrentTime, myCurrentValue, and myStart.
| void makVre::DtBezierInterpolator< T >::reset | ( | T | start, |
| T | stop, | ||
| double | period ) |
Resets the interpolation with new start, end, and period values.
Resets the interpolation with new parameters.
| start | The new starting value |
| stop | The new ending value |
| period | The new time period (in seconds) |
References myCurrentTime, myCurrentValue, myEnd, myPeriod, myStart, start(), and stop().
| void makVre::DtBezierInterpolator< T >::reset | ( | makVrv::DtEaser | easer, |
| T | start, | ||
| T | stop, | ||
| double | period ) |
Resets the interpolation with a new easer and parameters.
| easer | The new easing function |
| start | The new starting value |
| stop | The new ending value |
| period | The new time period (in seconds) |
References myCurrentTime, myCurrentValue, myEaser, myEnd, myPeriod, myStart, start(), and stop().
| T makVre::DtBezierInterpolator< T >::start | ( | ) | const |
Gets the start value.
Gets the start value of the interpolation.
References myStart.
Referenced by DtBezierInterpolator(), reset(), and reset().
| T makVre::DtBezierInterpolator< T >::stop | ( | ) | const |
Gets the end value.
Gets the end value of the interpolation.
References myEnd.
Referenced by DtBezierInterpolator(), reset(), and reset().
| double makVre::DtBezierInterpolator< T >::timeRemaining | ( | ) | const |
Gets the time remaining in the interpolation.
References myCurrentTime, and myPeriod.
|
protected |
The easing function to use.
Referenced by DtBezierInterpolator(), and reset().
|
protected |
The starting value.
Referenced by DtBezierInterpolator(), reset(), reset(), reset(), and start().
|
protected |
The ending value.
Referenced by DtBezierInterpolator(), reset(), reset(), and stop().
|
protected |
The current interpolated value.
Referenced by DtBezierInterpolator(), reset(), reset(), reset(), and value().
|
protected |
The total time period for the interpolation (in seconds)
Referenced by DtBezierInterpolator(), isDone(), reset(), reset(), and timeRemaining().
|
protected |
The current elapsed time (in seconds)
Referenced by DtBezierInterpolator(), isDone(), reset(), reset(), reset(), and timeRemaining().