aimstil  5.0.5
keys_interpolation.tpp
Go to the documentation of this file.
1 #ifndef TIL_KEYS_INTERPOLATION_TPP_
2 #define TIL_KEYS_INTERPOLATION_TPP_
3 
4 namespace til
5 {
6  namespace
7  {
8  template < typename T >
9  static inline T lapl(T x1, T x2, T x3)
10  { return x1 + x3 - 2*x2; }
11 
12  template < typename T >
13  static inline T bilapl(T x1, T x2, T x3, T x4, T x5)
14  { return x1 + x5 + 6*x3 - 4*(x2+x4); }
15 
16  template < typename T >
17  static inline T keysPo1(T x)
18  { return x*(x*x-1)/T(6.0); }
19 
20  template < typename T >
21  static inline T keysPo2(T x)
22  { return -x*x*(x-1)/T(12.0);}
23  }
24 
25 
26  template < typename T >
27  T KeysInterpolation<T>::compute(T f1, T f2, T f3, T f4, T f5, T f6, T x)
28  {
29  return
30  x * f4 + keysPo1(x) * lapl(f3, f4, f5) + keysPo2(x) * bilapl(f2, f3, f4, f5, f6) +
31  (1-x) * f3 + keysPo1(1-x) * lapl(f2, f3, f4) + keysPo2(1-x) * bilapl(f1, f2, f3, f4, f5);
32  }
33 
34 } // namespace til
35 
36 
37 #endif /*KEYS_INTERPOLATION_TPP_*/