The orientation of a body in 3D can also be described by a unit-Quaternion, an unusual but very useful mathematical object.

 

In the MATLAB example starting at 3:48 I use the Quaternion class.  For Toolbox version 10 (2017) please use UnitQuaternion instead.