An Explanation of Quaternion Rotation in Euclidean Space

 

by

Jason Shankel

 

Introduction

 

The purpose of this paper is to demonstrate how quaternion operations are used to perform rotation in Euclidean space. 

Rotation is demonstrated using nothing but simple vector operations (dot products, cross products and scalar multiplication). 

At no point will I rely on imaginary numbers, calculus or any other so-called “non-Euclidean” concepts.

 

Definitions

 

Quaternions are specified thusly:

q = (v,s), where v is a vector in ordinary 3-dimensional space and s is a real-valued scalar.

 

For a vector v, the equivalent quaternion is specified as:

v = (v,0)

 

Quaternion multiplication is performed thusly:

(v,s)(v’,s’) = (vÄv’ + sv’ + vs’, ss’ – v·v’) where Ä is the vector cross-product and · is the vector dot-product. 

Multiplication is associative but not commutative.

 

Scalar multiplication is performed thusly:

x(v,s) = (xv,xs) 

Scalar multiplication is both associative and commutative.

 

The conjugate of a quaternion is defined thusly:

(v,s)* = (-v,s)

 

These are the only definitions we need to demonstrate the rotation formula. 

 

Quaternion Rotation

 

Let v0, v1 and v2 be unit vectors in 3-dimensional space.  v0, v1 and v2 are coplanar such that v0Äv1 = v1Äv2 and v0·v1 = v1·v2. 

Let q  = cos-1(v0·v1) be the angle between v0 and v1.  It is clear from the diagram (fig 1) that v2 represents a rotation of v0 about v0Äv1 by angle 2q.

 

 

 

Theorem

 

Given the quaternion q = (v0Äv1, v0·v1), show that the operation qv0q* = v2.

 

Proof

 

First, we find some equivalent forms for q:

q = (v0Äv1, v0·v1)

v1v0* = (-v1Äv0,v1·v0) = (v0Äv1,v0·v1)

\ q = v1v0*

 

v1Äv2 = v0Äv1

v1·v2 = v0·v1

\ q = (v1Äv2,v1·v2) = v2v1*

 

Now, substituting q = v1v0* into qv0q* gives:

 

qv0q* = (v1v0*)v0q* = v1(v0*v0)q*

 

For unit a unit vector v, v*v = 1, so:

 

qv0q* = v1q*

 

Now we express q* in terms of v1 and v2:

q* = (v2v1*)* = v1v2*

 

Plugging this form of q* into v1q* gives:

 

qv0q* = v1q* = v12v2*

 

For a unit vector v, v2 = -1, so

 

qv0q* = -v2*

 

For a vector, v* = -v, so

 

qv0q* = v2

 

QED

 

Okay, so we’ve established that qv0q* = v2 for v0, v1 and v2 as unit vectors.  Generalizing this for all vectors is trivial.  Just multiply both sides of the equation by a scalar:

 

qv0q* = v2

\ qAv0q* = Av2 for some scalar A.

 

Matrices and Slerps

 

The basis for quaternion-matrix conversions is finding the matrix M such that Mv = qvq*.  Since qvq* is a linear operation, it stands to reason that the matrix M exists.

 

The basis for the much-touted spherical linear interpolation (slerp) is the fact that quaternions as rotations all have the form:

 

q = (vsin(q/2),cos(q/2))

 

where v is a unit vector in the direction of the axis of rotation and q is the angle of rotation.  These quaternions all have unit length.  Therefore we can apply spherical linear interpolation the way we would for any other collection of n-dimensional unit vectors and be sure that we a) always get a valid rotation b) always follow the shortest path from one rotation to another and c) the interpolation will be smooth.