There are several ways to represent the orientation of an object in 3-dimensional space. Some important methods include Euler angles, coordinate frames, and quaternions.
Euler angles are values that represent the pitch, yaw, and roll of an object. These are angles that the object is rotated around on its local axes, as opposed to global axes. The yaw represents the angle than an object is rotated about its y-axis, the pitch is the angle it is rotated about its x-axis, and the roll is the angle it is rotated about its z-axis. This system has the advantage of being intuitive and easy to implement, but has the disadvantage of being susceptible to gimbal lock. Gimbal lock is the loss of one degree of freedom when two axes of rotation align in a parallel orientation, causing the object to only be able to rotate in two dimensions.
Coordinate frames are an important tool for defining the position and orientation of an object in 3-dimensional space. They work by defining an object’s direction vector (), up vector (
), and right vector (
). These vectors are all fairly self-explanatory; the direction vector points forward in the direction the object is facing, the up vector points up from the object, and the right vector points towards the right side of the object. By combining these three vectors into a 3×3 matrix, [
], we can fully define the orientation of the object. This can then combined with a vector that represents the object’s position in space (called
), creating a matrix which fully represents the object’s coordinate frame: [
]. We add an extra row ([0 0 0 1]) at the bottom to make it into a 4×4 matrix.
I will discuss quaternions in a later blog entry, but an extra topic I wanted to discuss this week is the Frenet frame. The Frenet frame, also known as TNB frame, is a method used in animation to determine the correct orientation of an object that is moving along a predetermined path, so that it will always be looking in the direction it is moving. This is done by looking ahead on the path by a small amount to find a point P2 that the object is moving towards, and subtracting the objects current position P1 from it. The result is then normalized, which produces a vector for the object. The
vector is then created by calculating the cross product of
and the global up vector,
. Finally,
is calculated by taking the cross product of
and
. We then have all of the information needed to orientate the object correctly while it follows its path.
![](https://i0.wp.com/upload.wikimedia.org/wikipedia/commons/1/14/Frenet-Serret-frame_along_Vivani-curve.gif)
Object rotating according to the path it is following using a TNB frame. T stands for Tangent, and corresponds to the Direction vector (D). N stands for Normal, which corresponds to the Up vector (U). B stands for Bi-normal, which corresponds to the Right vector (R).