9 Cubic (T x0, T x1, T x2, T x3, T y0, T y1, T y2, T y3, T x)
14 double m0 = (y2-y0)/(x2-x0);
15 double m1 = (y3-y1)/(x3-x1);
17 double t = (x - x1)/(x2 - x1);
20 double h00 = 2*t3 -3*t2 +1;
21 double h10 = t3 -2*t2 +t;
22 double h01 = -2*t3 + 3*t2;
25 return h00*p0 + h10*m0*(x2 - x1) + h01*p1 + h11*m1*(x2 - x1);
32 double x0, x1, x2, x3, y0, y1, y2, y3;
35 outputVect.push_back(0);
36 double value = step + inputVect.front();
38 while (value < inputVect.back())
40 while(inputVect[i] <= value)
62 if (i == inputVect.size() - 1)
73 outputVect.push_back(
Cubic(-y3, -y2, -y1, -y0, x3, x2, x1, x0, -value));
76 outputVect.push_back(inputVect.size() - 1);
81 CubicInterpolator(std::vector <T> &transfVect, std::vector <T> &scale, std::vector <T> &outputVect, T LengthLine)
83 double x0, x1, x2, x3, y0, y1, y2, y3;
87 outputVect.push_back(transfVect[0]);
89 while(i < LengthLine -1)
98 y1 = transfVect[it-1];
109 y0 = transfVect[it-2];
112 if (it == scale.size() -1)
120 y3 = transfVect[it+1];
123 outputVect.push_back(Cubic<double>(x0, x1, x2, x3, y0, y1, y2, y3, i));
127 outputVect.push_back(transfVect.back());
void CubicInterpolator(std::vector< T > &transfVect, std::vector< T > &scale, std::vector< T > &outputVect, T LengthLine)
void InverseCubicInterpolator(std::vector< T > &inputVect, std::vector< T > &outputVect, T step)
T Cubic(T x0, T x1, T x2, T x3, T y0, T y1, T y2, T y3, T x)