Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

laeuchli

cubic interpolation.

This topic is 6276 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!