Core code:
//////////////////////////////////////// //// // ///////////Hermit equi-distance interpolation ///// //////////////////////////////////////// //// // static float getvaluehermite (const void * valuesptr, int stride, int N, float T, float DC) {int I, j; float Z, S, P, Q, V, D; // Initial Value z = 0.0; // special case processing if (n <1) {return (z);} If (n = 1) {z = yfgetfloatvalue (valuesptr, stride, 0 ); return (z);} float xste P = 1.0f/(n-1); // cyclic interpolation for (I = 1; I <= N; I ++) {S = 1.0f; q = (I-1) * xstep; For (j = 1; j <= N; j ++) {P = (J-1) * xstep; If (J! = I) {S = S * (t-P)/(Q-p) ;}} S = S * s; P = 0.0f; For (j = 1; j <= N; j ++) {If (J! = I) {P = P + 1.0f/(Q-(J-1) * xstep);} v = yfgetfloatvalue (valuesptr, stride, I-1 ); if (I <n) {d = yfgetfloatvalue (valuesptr, stride, I)-V;} else {d = V-yfgetfloatvalue (valuesptr, stride, I-2 );} Q = V + (t-q) * (D * dc-2.0f * V * P); Z = z + Q * s;} return (z );}
Cut graph:
Related Software: http://files.cnblogs.com/WhyEngine/TestSpline.zip
Spline hermit (Hermite) interpolation function