# Quaternion Rotation

** Published:**

Quaternions are a number system that extends complex numbers. A quaternion provides a convenient mathematical notation for representing orientations and rotations of an object in three dimensions. This section discusses some of the useful properties and operations which are used in quaternion rotation.

Let there be two coordinate frames in a 3-dimensional space, \(A\) and \(B\). There is a vector \(r^{A}\) defined in Frame \(A\) as shown in figure below.

\[r^{A} = (r^{A}_{x}, r^{A}_{y}, r^{A}_{z})\]Using **Quaternions** we can rotate from frame \(A\) to \(B\) by angle \(\theta\) around vector \(r^{A}\).

**Quaternion describing this orientation is \(q^{A}_{B}\)**:

\(q^{A}_{B}\) describes the orientation of frame \(B\) relative to frame \(A\).

**Quaternion arithmetic requires the quaternion describing orientation to be of unit length.**

Therefore, quaternions are first normalized to have a magnitude of 1.

**Conjugate quaternion**:

**Compound orientations using quaternions**: Let \(q^{A}_{B}\) and \(q^{B}_{C}\) be two quaternions. \(q^{A}_{B}\) - orientation of \(B\) w.r.t. \(A\).

\(q^{B}_{C}\) - orientation of \(C\) w.r.t. \(B\).

The compound orientation \(q^{A}_{C}\) is defined as:

\[q^{A}_{C} = q^{B}_{C} \bigotimes q^{A}_{B}\]\(q^{A}_{C}\) - orientation of \(C\) w.r.t. \(A\).

\(\bigotimes\) represents quaternion product.

**Quaternion Product**:

Let \(p\) and \(q\) be two quaternions. Then the product of these two quaternions is:

Quaternion product is not commutative, i.e., \(p \bigotimes q \ne q \bigotimes p\).

**NOTE: I know there may be a lot of confusion in Quaternion mathematics. The blogpost by Fan Zheng provides an excellent overview of conventions used in Quaternion representations. [2]**

## Leave a Comment