All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Nimble::RampT< T, N > Class Template Reference

Linear interpolation. More...

#include <Nimble/Ramp.hpp>

Public Member Functions

unsigned left () const
 The number of steps left to reach the target value. More...
 
 operator const T & () const
 Typecast operator that returns the current value of the interpolator. More...
 
 RampT ()
 Construct a new ramp.
 
 RampT (const T &val)
 Construct a new ramp. More...
 
void reset (const T &val)
 Resets this interpolator to the given value. More...
 
void setTarget (const T &target, N n)
 Sets the interpolation target. More...
 
const T & target () const
 Gets the target value. More...
 
void toTarget ()
 Jumps directly to the target value, bypassing interpolation.
 
void update ()
 Updates the interpolator.
 
void update (N n)
 Updates the interpolator with given amount of time. More...
 
const T & value () const
 Gets the current value. More...
 
 ~RampT ()
 Destructor.
 

Detailed Description

template<class T, class N>
class Nimble::RampT< T, N >

Linear interpolation.

This class is used to interpolate between key-point values. The stepping/time value N van be an integer or floating point number.

Constructor & Destructor Documentation

template<class T , class N >
Nimble::RampT< T, N >::RampT ( const T &  val)
inline

Construct a new ramp.

Parameters
valinitial value

Member Function Documentation

template<class T , class N >
unsigned Nimble::RampT< T, N >::left ( ) const
inline

The number of steps left to reach the target value.

Returns
steps left to reach the target
template<class T , class N >
Nimble::RampT< T, N >::operator const T & ( ) const
inline

Typecast operator that returns the current value of the interpolator.

Returns
current value of the ramp
template<class T , class N >
void Nimble::RampT< T, N >::reset ( const T &  val)
inline

Resets this interpolator to the given value.

Parameters
valvalue to reset to
template<class T , class N >
void Nimble::RampT< T, N >::setTarget ( const T &  target,
n 
)
inline

Sets the interpolation target.

Parameters
targetThe target value for interpolation
nThe number of updates required to reach the target value
template<class T , class N >
const T& Nimble::RampT< T, N >::target ( ) const
inline

Gets the target value.

Returns
target value of the ramp
template<class T , class N >
void Nimble::RampT< T, N >::update ( n)
inline

Updates the interpolator with given amount of time.

Parameters
nsteps to interpolate
template<class T , class N >
const T& Nimble::RampT< T, N >::value ( ) const
inline

Gets the current value.

Returns
current value of the ramp