you’re welcome

to do cubic interpolation (i call it cerp) i use this function:

float cerp( float a, float b, float c, float d, float x ) {

float p=(d-c)-(a-b);

float q=(a-b)-p;

float r=c-a;

return x*(x*(x*p+q)+r)+b;

}

where:

a,b,c,d values to be interpolated.

x interpolation parameter 0…1

when x=0, the function returns b.

when x=1, the function returns c.

winamp, for instance, uses a piecewise cubic for the equalizer… i use cerp as a primitive to generate 3D perlin noise for plasmas, landscapes, automatic movements ratios or smooth paths… almost everything!

oh, this is 1D.

in 2D, you should:

a=cerp( v[0][0], v[1][0], v[2][0], v[3][0], x );

b=cerp( v[0][1], v[1][1], v[2][1], v[3][1], x );

c=cerp( v[0][2], v[1][2], v[2][2], v[3][2], x );

d=cerp( v[0][3], v[1][3], v[2][3], v[3][3], x );

v=cerp( a, b, c, d, y );

quite many calcs!

v holds the interpolated value.

Dolo//\ightY

[This message has been edited by dmy (edited 05-28-2000).]