cubic interpolation.

Started by
0 comments, last by laeuchli 23 years, 1 month ago
I have a cubic interpolation function here: float splineinterp(float number1,float afternumber1, float number2, float afternumber2,float x) { float P=(afternumber2-number2)-(number1-afternumber1); float Q=(number1-afternumber1)-P; float R=(number2-number1); float S=afternumber1; float ret=P*(x*x*x)+Q*(x*x)+(R*x)+S; return ret; } before I was using cosine interpolation, and doing this: int xi=x; float fractionx=x-xi; int yi=y; float fractiony=y-yi; float v1,v2,v3,v4,i1,i2; float ret; v1=smoothnoise(xi, yi); v2=smoothnoise(xi + 1, yi); v3=smoothnoise(xi, yi + 1); v4=smoothnoise(xi + 1, yi + 1); i1=cosinterp(v1,v2,fractiony); i2=cosinterp(v3,v4,fractionx); ret=cosinterp(i1,i2,fractiony); How can I change and use cubic interpolation? My main problem is figuring out what to use for X.
Advertisement
I''m not sure if this will help you much, but it really helped me out with curves (in other words, steal the source )

http://freespace.virgin.net/hugo.elias/graphics/x_bezier.htm

---------------------------------------------

Hatten something something something!!

This topic is closed to new replies.

Advertisement