GBB Logo         
GBB Services
GBB Services : Resources : Mathematics : Quaternions in 3d

Quaternions in 3d computer graphics

by Walter Vannini

Linear Interpolation


This short note is about how and why quaternions are sometimes used in 3d computer graphics. Sadly, the "why" doesn't seem to be documented anywhere that I can find.

In short, the main reason is that it becomes computationally easy to interpolate between two 3d rotations. This is often needed to smoothly animate between two orientations of a rigid object. Here are some of the details:

Linear Interpolation

A 3d rotation can be represented by a 3 by 3 square matrix M that operates on a column 3 vector v = (a,b,c)T via matrix multiplication. If there are two rotations M0 and M1, then the linear interpolation M(t)=M0(1-t)+M1t will typically lead to matrices that are not rotations. If you stay in the world of 3 by 3 matrices, the standard way to fix this kind of thing is by Gram-Schmidt orthogonalization. Some people aren't happy with that (two reasons that come to mind are computational efficiency, and weird artifacts created by the fact that the path in the space of rotations isn't well controlled). This is where quaternions come in.

Firstly, represent the 3 vector as the "pure" quaternion p = ai+bj+ck. Secondly, a quaternion q defines a rotation via qp(1/q).Now linear interpolation q(t) = q0(1-t)+q1t just works. No post processing to correct the results is needed.

What we have here is a mapping from the invertible quaternions to the 3d rotations. It's clearly not one to one, since for any non-zero real number r, both q and rq result in the same rotation. However, the map does define an isomorphism from RP3=(R4-{0}/R-{0}) to SO(3). If you are familiar with these kinds of spaces, you probably know that RP3 is double covered by the simply connected space S3 (just like the projective plane RP2 is double covered by the two sphere S2), and that SO(3) is double covered by the simply connected SU(2). As a consistency check, it's well known that S3 and SU(2) are isomorphic.


If you have corrections, additions, modifications, etc please let me know

April 4 2003 Posted
April 8 2003 Last Updated

Back to top of page