GBB Services  
GBB Services : Resources : Mathematics : Quaternions in 3d 
Quaternions in 3d computer graphicsby Walter VanniniLinear Interpolation Feedback IntroductionThis 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 InterpolationA 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 M_{0} and M_{1}, then the linear interpolation M(t)=M_{0}(1t)+M_{1}t 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 GramSchmidt 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) = q_{0}(1t)+q_{1}t 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 nonzero real number r, both q and rq result in the same rotation. However, the map does define an isomorphism from RP^{3}=(R^{4}{0}/R{0}) to SO(3). If you are familiar with these kinds of spaces, you probably know that RP^{3} is double covered by the simply connected space S^{3} (just like the projective plane RP^{2} is double covered by the two sphere S^{2}), and that SO(3) is double covered by the simply connected SU(2). As a consistency check, it's well known that S^{3} and SU(2) are isomorphic. FeedbackIf you have corrections, additions, modifications, etc please let me know mailto:walterv@gbbservices.com
