VR-Engage  2.2
Loading...
Searching...
No Matches
makVre::DtLinearInterpolator< T > Class Template Reference

Detailed Description

template<typename T>
class makVre::DtLinearInterpolator< T >

This template class provides linear interpolation between a start and end value over a specified time period. Specializations are provided for float, double, and DtVector types.

Template Parameters
TThe type of value to interpolate

#include <linearInterpolator.h>

Inheritance diagram for makVre::DtLinearInterpolator< T >:
[legend]

Public Member Functions

 DtLinearInterpolator (T start, T stop, double period)
 
 ~DtLinearInterpolator ()
 
void tick (double dt)
 
value () const
 
bool isDone () const
 
void reset ()
 
void reset (T start, T stop, double period)
 
start () const
 
stop () const
 
double timeRemaining () const
 

Protected Attributes

myStart
 
myEnd
 
myCurrentValue
 
double myPeriod
 
double myCurrentTime
 

Constructor & Destructor Documentation

◆ DtLinearInterpolator()

template<typename T>
makVre::DtLinearInterpolator< T >::DtLinearInterpolator ( T start,
T stop,
double period )
inline

Constructor.

Initializes the interpolator with start and end values and the time period

Parameters
startThe starting value
stopThe ending value
periodThe time period over which to interpolate (in seconds)

References myCurrentTime, myCurrentValue, myEnd, myPeriod, myStart, start(), and stop().

◆ ~DtLinearInterpolator()

template<typename T>
makVre::DtLinearInterpolator< T >::~DtLinearInterpolator ( )
inline

Destructor.

Member Function Documentation

◆ tick()

template<typename T>
void makVre::DtLinearInterpolator< 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. Specialized implementations are provided for float, double, and DtVector.

Parameters
dtThe time step in seconds

◆ value()

template<typename T>
T makVre::DtLinearInterpolator< T >::value ( ) const
inline

Gets the current interpolated value.

Returns
The current value of the interpolation

References myCurrentValue.

◆ isDone()

template<typename T>
bool makVre::DtLinearInterpolator< T >::isDone ( ) const

Checks if the interpolation has completed.

Returns
true if the current time has reached or exceeded the period

References myCurrentTime, and myPeriod.

◆ reset() [1/2]

template<typename T>
void makVre::DtLinearInterpolator< 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.

◆ reset() [2/2]

template<typename T>
void makVre::DtLinearInterpolator< T >::reset ( T start,
T stop,
double period )

Resets the interpolation with new parameters.

Parameters
startThe new starting value
stopThe new ending value
periodThe new time period (in seconds)

References myCurrentTime, myCurrentValue, myEnd, myPeriod, myStart, start(), and stop().

◆ start()

template<typename T>
T makVre::DtLinearInterpolator< T >::start ( ) const
inline

Gets the start value.

Returns
The start value of the interpolation

References myStart.

Referenced by DtLinearInterpolator(), and reset().

◆ stop()

template<typename T>
T makVre::DtLinearInterpolator< T >::stop ( ) const
inline

Gets the end value.

Returns
The end value of the interpolation

References myEnd.

Referenced by DtLinearInterpolator(), and reset().

◆ timeRemaining()

template<typename T>
double makVre::DtLinearInterpolator< T >::timeRemaining ( ) const
inline

Gets the time remaining in the interpolation.

Returns
The remaining time in seconds

References myCurrentTime, and myPeriod.

Member Data Documentation

◆ myStart

template<typename T>
T makVre::DtLinearInterpolator< T >::myStart
protected

The starting value.

Referenced by DtLinearInterpolator(), reset(), reset(), and start().

◆ myEnd

template<typename T>
T makVre::DtLinearInterpolator< T >::myEnd
protected

The ending value.

Referenced by DtLinearInterpolator(), reset(), and stop().

◆ myCurrentValue

template<typename T>
T makVre::DtLinearInterpolator< T >::myCurrentValue
protected

The current interpolated value.

Referenced by DtLinearInterpolator(), reset(), reset(), and value().

◆ myPeriod

template<typename T>
double makVre::DtLinearInterpolator< T >::myPeriod
protected

The total time period for the interpolation (in seconds)

Referenced by DtLinearInterpolator(), isDone(), reset(), and timeRemaining().

◆ myCurrentTime

template<typename T>
double makVre::DtLinearInterpolator< T >::myCurrentTime
protected

The current elapsed time (in seconds)

Referenced by DtLinearInterpolator(), isDone(), reset(), reset(), and timeRemaining().


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