Quaternions are like complex numbers.

The number of dimensions in a quaternion number is 4.

Multiplication over quaternions is NOT commutative.

Multiplication over quaternions is associative.

Representation for example:


Where i is the complex root, j is another basis root and k is yet another basis root.


If we have an axis angle representation consisting of an angle and an axis represented by a vector (a_x,a_y,a_z) of unit length, the equivilant quaternion representation is:


where the axis is normalized so that a_x²+a_y²+a_z²=1.

where the quaternion is normalised so that (\cos(÷{φ}{2}))²+a_x²⋅(\sin(÷{φ}{2}))²+a_y²⋅(\sin(÷{φ}{2}))²+a_z²⋅(\sin(÷{φ}{2}))²=1.

let's say that is: q_w²+q_x²+q_y²+q_z²=1.

Then follows by taking the square root:


Apply rotation to a point

To apply rotation to a point, represent the point as i, j and k factors (the real part is 0), then the new point P is, given the old point p and a rotation quaternion q:


... where conj is the conjugate operator, flipping the signs of all the non-real components of the quaternion.