**Generic
Matrix Interpolation**

**A
white paper**

**Kees
van Prooijen**

**ABSTRACT**

**In computer graphics it is in general difficult to combine totally free
(affine) transformation possibilities for modeling purposes, with automatic
in-betweening for animation. The problem is that automatic in-betweening is
only possible for certain types of parameters. The transformations at the key
time-instances must be reduced to values of these types. The decomposition of
a general transformation matrix to such values is difficult. A new approach
is suggested here, which makes in-betweening interpolation directly applicable
to the matrix-type of transformations.**

**1. Introduction**

The first problem at hand is to be able to interpolate between two matrices, probably 4x4 homogeneous matrices. These matrices are the result of modeling operations like translating, rotating, (non-uniform) scaling and possibly skewing. Several of these operations could have been performed in any order. In general it will not be possible to determine these actions in retrospect, just from the value of the matrix. The solution is to devise an algorithm that can do this interpolation by numerical algebraic methods, purely manipulating the matrix.

Suppose this algorithm is written (which it is), the second problem is to smoothly interpolate between more than two key-values. We will see that several possibilities exist for this purpose.

**2. The linear problem**

In programming terms we want to implement the function:

Matrix pow( Matrix m, double x );

Then we can interpolate between two matrices m1 and m2 at a value x between 0 and 1 (if we have a matrix inversion function and a matrix multiplication operator):

m1 * pow( inv( m1 ) * m2, x );

or

pow( m2 * inv( m1 ), x ) * m1;

which will result in m1 for x==0, and m2 for x==1. Due to the non-commutativity of matrix multiplication, the two outcomes will generally be distinct.

This function pow is implemented, the algorithm comprising more than 1000 lines of C++ source code. The basic functionality is implemented for a special form of complex-valued matrices, and any matrix can be brought in this form by dedicated normalization operations.

**3. Smooth interpolation**

With the linear interpolation problem solved, there are straightforward possibilities to do smooth interpolation, for instance via successive linear interpolations according to bezier-spline techniques.

Combined with above-mentioned linear interpolation algorithm, an implementation of a smooth interpolation scheme is written, directly based on the definition of derivative of matrix valued functions. This solution is actually interesting because of the existence of different possibilities to define this derivative, again caused by above-mentioned non-commutativity.

**4. Other applications**

With the matrix pow function implemented, several other possibilities come to mind.

- The N-times multiplication of a matrix with itself can be performed in constant time.
- An object can be multiplied in an array, interpolating between two transformations.
- A transformation ‘field’ can be defined in space, determining the transformation depending on the position of an object.