title: C++ Spline interpolation from an array of points
body: <p>I am writing a bit of code to animate a point using a sequence of positions. In order to have a decent result, I'd like to add some spline interpolation
  to smoothen the transitions between positions. All the positions are separated by the same amount of time (let's say 500ms).</p>
  
  <pre><code>int delay = 500;
  vector&lt;Point&gt; positions={ (0, 0) , (50, 20), (150, 100), (30, 120) };
  </code></pre>
  
  <p>Here is what i have done to make a linear interpolation (which seems to work properly), juste to give you an idea of what I'm looking for later on :</p>
  
  <pre><code>Point getPositionAt(int currentTime){
      Point before, after, result;
  
      int currentIndex = (currentTime / delay) % positions.size();
      before = positions[currentIndex];
      after  = positions[(currentIndex + 1) % positions.size()];
  
      // progress between [before] and [after]
      double progress = fmod((((double)currentTime) / (double)delay), (double)positions.size()) - currentIndex;
  
      result.x = before.x + (int)progress*(after.x - before.x);
      result.y = before.y + (int)progress*(after.y - before.y);
  
      return result;
  }
  </code></pre>
  
  <p>So that was simple, but now what I would like to do is spline interpolation. Thanks !</p>