#### Archived

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

# cubic interpolation.

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

## 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 on other sites
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!!

1. 1
Rutin
63
2. 2
3. 3
4. 4
5. 5

• 15
• 10
• 29
• 20
• 9
• ### Forum Statistics

• Total Topics
633413
• Total Posts
3011757
• ### Who's Online (See full list)

There are no registered users currently online

×