Homogeneous transformation matrix (10)

Kinematics & Universal Numerics
September 19, 2019

From axis-angle form to quaternion.

We can express a rotation in terms of axis-angle form. One way to write it is a (rotation axis, rotation angle) pair, or

(𝐝;θ)=([dxdydz];θ), (1)

where 𝐝 is a 3D unit vector and θ∈[0,Ο€]. The other way is to write the product of the two:


If 𝐯 is not a zero vector, then the way to recover (1) is simply


Otherwise, if 𝐯=3Γ—1, then ΞΈ=0 and we let 𝐝=[0,0,1]T by convention.

There is a third way: we write it as a unit vector of size 4:

πͺ=(q0,q1,q2,q3)=(cΞΈ/2,sΞΈ/2⁒dx,sΞΈ/2⁒dy,sΞΈ/2⁒dz). (2)

To convert πͺ to (1) is also simple:

{ΞΈ=2⁒atan2⁒(sΞΈ/2,cΞΈ/2)=2⁒(1-q02,q0)∈[0,Ο€],𝐝=[q1,q2,q3]/sΞΈ/2⁒ ifΒ ΞΈβ‰ 0, andΒ [0,0,1]TΒ otherwise.

The vector πͺ here is a quaternion, a very powerful tool to study and analyze 3D rotation matrices. In this blog we do not give the complete mathematical definition of it nor enumerate all of its numerous useful properties. However, while we try to solve some interesting rotation problems, we will then mention some of those properties and give some derivations about them.

The first number q0 in πͺ is its scalar part, or real part. The last three numbers are πͺ’s imaginary partsβ€”there are three imaginary units for a quaternion: π’Š, 𝒋, and π’Œ, such that




Hence we can also write πͺ in (2) as

πͺ =q0+π’Šβ’q1+𝒋⁒q2+π’Œβ’q3