19 Mar

Author: Kevin Gildea 

The 3D rotation group

This post requires some background theoretical knowledge of the 3D rotation group, or the special orthogonal group in three dimensions (SO(3)). This is an area of Linear Algebra in which special orthogonal matrices are used in three-dimensional Euclidean space. This group is widely used for representing object orientations.For this task, basis vectors are used to describe the directions of the cardinal axes of the object’s local coordinate system. For example, for object ‘0’ the local coordinate system can be described as follows using basis vectors; in this case the object is alligned with the global coordinate system, so the basis vector system is equal to the identity matrix (I), and each of the basis vectors ({e1}0, {e2}0, and {e3}0) extend 1 unit from the origin along each of the cardinal axes. 

Furthermore, the orientation of one coordinate system represented using basis vector e2 can be represented wrt. another coordinate system e1 by multiplying the latter by a 3x3 rotation matrix [A21]. If we know the orientations of both of these coordinate systems wrt. a 3rd coordinate system e0, i.e. the global coordinate system, then we can find [A21]. 

Euler’s rotation theorem states that, in three-dimensional space, any displacement of a rigid body such that a point on the rigid body remains fixed, is equivalent to a single rotation about some axis that runs through the origin of the coordinate system. This axis is called the Euler axis, or the Screw axis. 

Mapping of two vectors

Now, consider the case where instead of having two complete coordinate systems represented by basis vectors, we only have two vectors a and b, which we want to use to represent a rotation between the two coordinate systems. Clearly, there will not be a unique solution to this problem so we need to define the Screw axis about which we rotate.Two obvious candidate axes that can be chosen for this are:

  1. the cross product of the vectors, which will be mutually perpindicular to both a and b, or
  2. the sum of the normalised vectors a and b, which symmetrically bisects a and b.



Implementation of cross product approach (axb): 

Implementation of bisecting vector approach (norm(a)+norm(b)): 

Now, we can use the two points obtained from the a+b approach and the axb approach along with the origin to define the plane that contains all possible rotation axes. Or, more appropriately, we can define the Euler axis space as all unit vectors on the plane. 

The axis-angle combination can be visualised by looking down the chosen axis to the origin - with the projection of the vectors a and b onto this plane the required angle becomes clear. This rotation can be visualised as a rotation of a right circular cone about its axis, where projections of vectors norm(a) and norm(b) lay on the surface of the base pointing outwards from the centre (i.e. the origin) to the directrix, and n points outwards from the centre of the base to the apex. 

More formally, first choose two points which we know are on the Euler axis space. 

Use these points to define the Euler axis space.

Project vectors norm(a) and norm(b) to lay on the base of a cone with the Euler axis as the cone’s axis. 

The angle between these projected vectors is the Euler/Screw angle.

Now, we can formulate the all possible rotation matrices representing all possible Euler axis-angle combinations, i.e. the Euler axis-angle solution space (EAS). 




With a lack of complete basis vector representation for the two coordinate systems, there are an infinite number of rotation matrices, or axis-angle combinations that can be applied to achieve a desired vector mapping. However, here we demonstrate that candidate Euler/Screw axes are constrained to be on the plane that bisects the vectors, such that the normalised vectors are symmetric to the plane. With this knowledge we can programmatically solve for all possible vector mapping solutions.

The full code is available here.

* The email will not be published on the website.