Orientations and rotations of objects in 3D are represented by Unit quaternions. For this orientation Euler angles are not suitable since they are not easier as compared to unit quaternions in formulating problem of gimbal lock.
Unit quaternions are more efficient and stable as compared to that of rotation matrices.
Unit quaternions has use in field of computer graphics, robotics molecular dynamics and orbital mechanics of satellites. If we want to represent the rotation then unit quaternions can be called rotation quaternions. Rotation quaternions are also known as versors.
Let’s try to understand Rotation Matrix to quaternion conversion and vice versa. When unit quaternions are used to show an structure or orientation, they can be called as orientation quaternions. Orientation quaternions can also be stated as attitude quaternions. If we want to represent any rotation in 3D space then there are two parameters mainly required which are: 1) Axis vector and 2) Angle of rotation.
Quaternion rotation can be constructed using the formula:
q = exp 1/2 (θ) (pxi + pyi + pzi) = cos (½) θ + (pxi + pyj + pzj) sin (½) θ,
Where 'θ' is defined as angle of rotation and (px, py, pz ) is the rotation vector that represents the Axis of Rotation. Here for unit quaternion q = (m, a, b, c), equivalent left handed 3×3 rotation matrix will be:
Above matrix is showing a conversion from quaternion to a 3×3 rotation matrix.