Table of contents |
2 Linear Interpolation as Approximation 3 Other Uses of Linear Interpolation |
How to do linear interpolation
You know the coordinates and . You want to pick points on this line by knowing either an x or y in the interval . For example you want to increase x by a constant factor from up to and get the corresponding y values. By inspecting the figure we see that:
In numerical analysis a linear interpolation of certain points that are in reality values of some function is typically used to approximate the function . In this case the in the formulas above is substituted for the linear interpolation polynomial of degree one, over the two known function values and thusly:
Linear Interpolation as Approximation
The truncation error of this approximation is defined as
and this error can for a function with 2 continuous derivatives be proven to be:
As you see, the approximation between two points on a given function gets worse with the second derivative of the function that is approximated. This is intuitively correct as well: the "curvier" the function is, the worse is the approximations made with simple linear interpolation. The proof for this error can be performed using Rolle's theorem.
The basic linear interpolation operation is so commonly used in computer graphics that it is known as a lerp. Lerp operations are built into the hardware of all modern computer graphics processors.
In more demanding approximation you will typically use polynomial interpolation see:
Other Uses of Linear Interpolation
Linear interpolatiom can also be extended to Bilinear interpolation, for example to interpolate a function z(x, y) where z can be written in terms of an α factor for the x-direction and a β factor for the y-direction. Bilinear interpolation is often used as a crude anti-aliasing filter.
....