iv::Interpolator< Type, Enabled > Struct Template Reference

#include <Interpolator.hpp>

Public Member Functions

Interpolator_float Distance (Type const &from, Type const &to) const
 
std::pair< Type, Interpolator_floatInterpolate (Type const &from, Type const &to, Interpolator_float distance) const
 

Detailed Description

template<typename Type, typename Enabled = void>
struct iv::Interpolator< Type, Enabled >

Definition at line 36 of file Interpolator.hpp.

Member Function Documentation

◆ Distance()

template<typename Type , typename Enabled = void>
Interpolator_float iv::Interpolator< Type, Enabled >::Distance ( Type const &  from,
Type const &  to 
) const
inline

Returns distance when traveling from value from to value to. As distance, it is expected to be positive but I will not say that negative values can't make sense in any context.

Definition at line 42 of file Interpolator.hpp.

◆ Interpolate()

template<typename Type , typename Enabled = void>
std::pair< Type, Interpolator_float > iv::Interpolator< Type, Enabled >::Interpolate ( Type const &  from,
Type const &  to,
Interpolator_float  distance 
) const
inline

Interpolates between values from and to. This will never go outside of this range (so infinite distance should return to, not infinite value). Parameter distance is distance corresponding to value returned from Interpolator::Distance, it is not mixing factor as in Mix functions (that use values from 0.0 to 1.0).

Returns
First value is the resulting interpolated value. Second value is remainder - when interpolating integer values, we might not need whole distance to travel to the resulting value. So the remainder is computed, stored for future used and in next interpolation (if the target is the same) will be added to new interpolation distance. This allows us to animate integer values even with low speed and small animation steps.

Definition at line 58 of file Interpolator.hpp.


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