CHermiteSplineInterpolator.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionMath.h>
5 #include "ISplineInterpolator.h"
6 
7 
8 namespace ion
9 {
10  namespace Animation
11  {
12 
13  template <typename T>
15  {
16 
17  public:
18 
19  virtual T Interpolate(ISpline<T> const & Path, int const Index, float const Mu);
20 
21  };
22 
23  template <typename T>
24  T CHermiteSplineInterpolator<T>::Interpolate(ISpline<T> const & Path, int const Index, float const Mu)
25  {
26  T const P0 = Path.GetNode(Index + 0);
27  T const P1 = Path.GetNode(Index + 1);
28 
29  vec3f const m0 = P0.Tangent;
30  vec3f const m1 = P1.Tangent;
31  float const t = Mu;
32  float const t2 = t * t;
33  float const t3 = t * t * t;
34 
35  return
36  P0 * (2 * t3 - 3 * t2 + 1) +
37  m0 * (t3 - 2 * t2 + t) +
38  P1 * (-2 * t3 + 3 * t2) +
39  m1 * (t3 - t2);
40  }
41 
42  }
43 }
virtual T Interpolate(ISpline< T > const &Path, int const Index, float const Mu)
Definition: CHermiteSplineInterpolator.h:24
Definition: ISplineInterpolator.h:14
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
Definition: CHermiteSplineInterpolator.h:14
Definition: ISpline.h:13
virtual TSplineNode const & GetNode(int const Index) const =0