Table of Contents

  1. TimeInterp


View this file in the source browser: trunk/src/lol/math/interp.h

Various interpolation classes.


template<typename T, int N> TimeInterp;

This interpolator stores a timestamped history of N values of type T and allows to interpolate or extrapolate values. The two major methods are Set() and Get().

For example, declare a timed interpolator storing a history of 16 vec3 values, and only keep about two values per second:

TimeInterp<vec3, 100> ti;

At each frame, record the new position using the current delta time:

ti.Set(seconds, m_position);

Now you can query the interpolator for the value it had 1.5 seconds ago:

vec3 old_position = ti.Get(-1.5f);
Last modified 5 years ago Last modified on Feb 19, 2013, 5:53:15 PM