Cubic interpollation

Type : interpollation
References : Posted by Olli Niemitalo
Linked file : other001.gif
(this linked file is included below)
Notes :
(see linkfile)
finpos is the fractional, inpos the integer part.

Code :
xm1 = x [inpos - 1];
x0  = x [inpos + 0];
x1  = x [inpos + 1];
x2  = x [inpos + 2];
a = (3 * (x0-x1) - xm1 + x2) / 2;
b = 2*x1 + xm1 - (5*x0 + x2) / 2;
c = (x1 - xm1) / 2;
y [outpos] = (((a * finpos) + b) * finpos + c) * finpos + x0;

Linked files