/* Converts a quaternion to a rotation vector. A rotation vector is a method to represent a 4-element quaternion vector in 3-elements. To get the quaternion from the 3-elements, The last 3-elements of the quaternion will be the given rotation vector. The first element of the quaternion will be the positive value that will be required to make the magnitude of the quaternion 1.0 or 2^30 in fixed point units.  */
void inv_quaternion_to_rotation_vector(const long *quat, long *rot)
/* Converts a quaternion to a rotation vector. A rotation vector is a method to represent a 4-element quaternion vector in 3-elements. To get the quaternion from the 3-elements, The last 3-elements of the quaternion will be the given rotation vector. The first element of the quaternion will be the positive value that will be required to make the magnitude of the quaternion 1.0 or 2^30 in fixed point units.  */
void inv_quaternion_to_rotation_vector(const long *quat, long *rot)
{
    rot[0] = quat[1];
    rot[1] = quat[2];
    rot[2] = quat[3];
    if (quat[0] < 0.0) {
        rot[0] = -rot[0];
        rot[1] = -rot[1];
        rot[2] = -rot[2];
    }
}