Cosine interpolation reverts to linear interpolation in higher dimensions

interpolationparametrictrigonometry

Paul Bourke's article on interpolation explains different types of interpolation including linear, cubic, Hermite spline and cosine. He goes on to state (emphasis mine):

In most cases the interpolation can be extended into higher dimensions simply by applying it to each of the x,y,z coordinates independently. This is shown on the right for 3 dimensions for all but the cosine interpolation. By a cute trick the cosine interpolation reverts to linear if applied independently to each coordinate.

I've implemented all of them in 2D and realized the truth in this. When I interpolate between 2D points by linearly interpolating X and cosine interpolating Y the output is curvy; however, if I interpolate both X and Y independently by cosine, it does revert to being a linear interpolation.

Looking at the equations, I guess it should be something to do with the same parameter t being used for both the equations, that makes this

$$
x(t) = x_1 + ((1 – \cos({t \pi})) / 2) (x_2 – x_1) \\
y(t) = y_1 + ((1 – \cos({t \pi})) / 2) (y_2 – y_1)
$$

into

$$
x(t) = x_1 + t (x_2 – x_1) \\
y(t) = y_1 + t (y_2 – y_1)
$$

I'm really interested in knowing what "cute trick" makes cosine interpolation linear.

Best Answer

The first of equations does not magically transform into the second set via some "cute trick".

But, from the first set of equations, you get: $$ \frac{x-x_1}{x_2-x_1} = \frac{y-y_1}{y_2-y_1} $$ which is obviously the equation of a straight line, $L$.

The first and second sets of equations both describe the same line, $L$, but, depending on which equations you use, the line is transversed by the point $(x(t), y(t))$ at different speeds.

Check the point at $t=\tfrac14$ using both sets of equations. Both equations will give you a point lying on the line $L$, but it won't be the same point.

Cosine interpolation gives you a linear shape, but not linear motion.