Linear Interpolation
From GPWikiTutorial by Nicholas Gorski GMan This tutorial will discuss linear interpolation. [edit] Linear Interpolation[edit] What is it?Linear interpolation is the process of determining an unknown point that lies between two known points. If the unknown point lies outside of the two known points, then it is call exterpolation. The linear interpolation is commonly expressed in the form:
Where p0 and p1 are the points that you are interpolating between, and u is a number between 0 and 1 representing the part of the distance between p0 and p1 at which pu lies. [edit] How do you use it?[edit] Sample 1Let's say you have two numbers and you want to find the number 1/4 of the way inbetween (u = 1/4). For example, let p0 be 5.3 and p1 be 24.9. Plugging this into our equation we get:
[edit] Sample 2Linear interpolation can also be used for predicting. As with the previous example, let p0 be 5.3 and p1 be 24.9. To find values between these two points u has to be between 0 and 1. If u is bigger than 1 pu lies beyond p1. [edit] Sample 3To interpolate in more than one dimension you can use the same method. Let us look at a two dimensional square, where we know the values at the corners. 10 ----- 15 | x | | | 00 ----- 20 Say x lies halfway the horizontal width of this square, and 1/3 down the vertical height. To get the value at point x you first determine the values halfway the top and bottom edges of the square, let's call those points ptop and pbottom:
To get the value at x you interpolate along a vertical line between ptop and pbottom:
[edit] UsesTry this: Make a point. Then make another point. Interpolate the points position, so the point moves from its starting position to the other point. More interesting, use a line. Linear interpolation can also be used to animate things. [edit] DoneI hope that helps explain Linear Interpolation. If you find an error, feel free to fix it. |


