1- Less Computational Overhead:

Quaternions have two parts, a scalar part known as 'w' and an imaginary part known as (x,y,z). So Quaternions can be represented as a four elements vector, (w,x,y,z). Euler angles has a 3x3 matrix representation. Quaternion production makes less computational overhead in comparison to Euler angles because of it's vector representation. Also Quaternions need less memory space in comparison to Euler angles.

2- No Gimbal Lock:

Euler angles rotation system can lead the application to a problem named Gimbal Lock. Gimbal lock occurs when we lose one of the degrees of freedom. This occurs because Euler angles work with two coordination systems, a reference and a destination. Unit Quaternions has no similar problem for rotation in 3D space. This is the main reason that makes unit Quaternions to be the preferred system to being used in computer graphics.

3- Better keyframe interpolation:

You know that keyframes in 3D animations mostly contain 3D rotations. Interpolating between these keyframes is very important. Using Slerp Quaternion interpolation causes good results in interpolating between two key frames. Actually Slerp selects the shortest arc in all possible paths in the rotation space (a 3D sphere with a radius equal to the magnitude of the difference of the source and destination points) to rotate one point to another and this is what we need most of the times, specially in character animation. I've provided a video which shows the difference between two interpolations. The box on the left side uses Euler XYZ and the one on the right side uses Quaternion selrp for rotation interpolation. Both of them use 2 similar key frames. You can see the differences in interpolations:

In the next post i will talk more about the important features of the unit Quaternions, as understanding them is very important for animation programming.

## No comments:

## Post a Comment