Graphics Reference
In-Depth Information
8
Interpolation
Interpolation is not a branch of mathematics but rather a collection of tech-
niques the reader will find useful when solving computer graphics problems.
Basically, an interpolant is a way of changing one number into another. For
example, to change 2 into 4 we simply add 2, which is not very useful. The real
function of an interpolant is to change one number into another in, perhaps,
10 equal steps. Thus if we start with 2 and repeatedly add 0.2, this generates
the sequence 2.2, 2.4, 2.6, 2.8, 3.0, 3.2, 3.4, 3.6, 3.8 and 4. These numbers could
then be used to translate, scale, rotate an object, move a virtual camera, or
change the position, colour or brightness of a virtual light source.
In order to repeat the above interpolant for different numbers we require
a formula, which is one of the first exercises of this chapter. We also need
to explore ways of controlling the spacing between the interpolated values.
In animation, for example, we often need to move an object very slowly and
gradually increase its speed. Conversely, we may want to bring an object to a
halt, making its speed less and less.
We start with the simplest of all interpolants: the linear interpolant.
8.1 Linear Interpolant
A linear interpolant generates equal spacing between the interpolated values
for equal changes in the interpolating parameter. In the introductory example
the increment 0.2 is calculated by subtracting the first number from the second
and dividing the result by 10, i.e. (4
2) / 10 = 0 . 2. Although this works, it
is not in a very flexible form, so let's express the problem differently. Given
two numbers n 1 and n 2 , which represent the start and final values of the
Search WWH ::




Custom Search