Quaternions and 3d rotations

Introduction

The quaternions were discovered by Hamilton in 1843. In the last few decades they have been used in the fields of spacecraft dynamics, robotics and computer games for animating rotating objects.

Demonstration program

qrot is an x86 PC program which demonstrates that the obvious method of interpolating Euler angles doesn't give good results in animations, but that quaternion interpolation and splining does. It runs under Linux or Windows and uses OpenGL.

Download:

Linux qrot Tested in various x86_64 versions of Ubuntu. You may have to install GtkGLExt with a command like sudo apt-get install libgtkglext1
Windows qrot.exe Works in versions XP, 7 and 8

Click here for operating instructions.

Maths

When I wrote this program more than ten years ago there was little on the web about quaternions and rotations (there was little on the web!) I wrote this paper qrotmath.pdf, which explains the mathematical connection between unit quaternions and 3d rotations, and how great circle interpolation of unit quaternions works.

There's now quite a lot of information available. Try some of these:

Wikipedia article on quaternions
Wikipedia article on quaternions and spatial rotations
Wikipedia article on slerps