22 #ifndef CAFU_INTERPOLATOR_HPP_INCLUDED
23 #define CAFU_INTERPOLATOR_HPP_INCLUDED
34 virtual void ReInit()=0;
35 virtual void NotifyOverwriteUpdate()=0;
36 virtual void Interpolate(
float Time)=0;
63 m_LastValue = m_Value;
71 const T NewRef = m_Value;
72 m_Value = m_LastValue;
80 const T DeltaY = Ref - m_Value;
82 if (m_ExtTime < 0.0001f || !CanContinue(DeltaY))
90 m_Gradient = DeltaY/m_ExtTime;
99 m_Value += m_Gradient*Time;
102 m_LastValue = m_Value;
108 bool CanContinue(
const T& DeltaY)
const {
return length(DeltaY) < 5000.0f; }
143 m_LastValue = m_Value;
152 const T NewRef = m_Value;
153 m_Value = m_LastValue;
168 const T DeltaY = Ref*2 - m_LastRef - m_Value;
170 if (m_ExtTime < 0.0001f || !CanContinue(DeltaY))
178 m_Gradient = DeltaY/m_ExtTime;
188 m_Value += m_Gradient*Time;
191 m_LastValue = m_Value;
197 bool CanContinue(
const T& DeltaY)
const {
return length(DeltaY) < 5000.0f; }
void NotifyOverwriteUpdate()
The user calls this method in order to let the interpolator know that the interpolated value was chan...
Definition: Interpolator.hpp:69
void ReInit()
Used to re-initialize this interpolator at the current value.
Definition: Interpolator.hpp:61
void UpdateRef(const T &Ref)
Sets a new reference value: the value that we should interpolate to.
Definition: Interpolator.hpp:78
Linearly interpolates a value over a period of time.
Definition: Interpolator.hpp:48
A common base class for "approximators" (interpolators and extrapolators), so that approximators of d...
Definition: Interpolator.hpp:30
void Interpolate(float Time)
Advances the interpolation over the given time.
Definition: Interpolator.hpp:97