Skip to main content
gamedev.net
🔒 Locked

Interpolation

Started by big grinder Jan 15, 2008 at 12:42 AM 2 replies 1.1k views
Original Post
big grinder
big grinder
Hi I know the forumla for basic linear interpolation is: x0 + (s * (x1 - x0)). I cannot for the life of me remember how to extend the function to include the y space and then the y/z space. I know it involves y0, y1, t, z0, z1, u. Any help with this would be appreciated. Thanks
kolrabi
kolrabi
It's the same:

x = x0 + (s * (x1 - x0))y = y0 + (s * (y1 - y0))z = z0 + (s * (z1 - z0))


Or just let x0 and x1 be vectors.
blah :)
big grinder
big grinder
I realize that much...so say you have all the values for:

x = x0 + (s * (x1 - x0))

and

y = y0 + (t * (y1 - y0))

Isn't there a way to combine the two in some sort of formula to do quadratic interpolation?
spacerat
spacerat
do you mean a spline by quadratic interpolation?
In this case you have 3 control points: p1,p2,p3
( each point contains x,y,z like p1.x of course )

The basic formula is f(x)= p1 * (1-x)^2+p2*(2*x*(1-x))+p3*x^2 , x = 0..1
Another way to write it is f(x) = lerp (lerp (p1,p2,x),p3,x) , x = 0..1

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.