A quaternion q is defined as the sum of a scalar q0 and a vector q = (q1, q2, q3); namely,
Addition and Multiplication



The complex conjugate of q, denoted q∗, is defined as

The norm of a quaternion q, denoted by |q|, is the scalar

A quaternion is called a unit quaternion if its norm is 1.
The norm of the product of two quaternions p and q

The inverse of a quaternion q is defined as

In the case q is a unit quaternion, the inverse is its conjugate q∗



rotate an angle, such as \theta = 90 degree, around unit 3d vector u, such as u=(0i, 0j, 1k), i.e. z axis.
note: q∗ = q0 − q = q0 − q1i − q2j − q3k. Here use -\theta.
