Quaternions are an alternate way to represent the rotation part of a transformation, and can be easier to manipulate than matrices. As with a matrix, you can encode a geometric transformations in one, concatenate several of them to merge multiple transformations, and apply them to a vector, but they can only store pure rotations. The big advantage is that you can accurately interpolate between two quaternions to get a part-way rotation, avoiding the gimbal problems of the more conventional Euler angle interpolation.
Quaternions only have floating point versions, without any _f suffix. Other than that, most of the quaternion functions correspond with a matrix function that performs a similar operation.
Quaternion means 'of four parts', and that's exactly what it is. Here is the structure:
You will have lots of fun figuring out what these numbers actually mean, but that is beyond the scope of this documentation. Quaternions do work -- trust me.typedef struct QUAT { float w, x, y, z; }
Examples using this: exquat.
Examples using this: exquat.
Examples using this: exquat.
QUAT_SHORT - like quat_interpolate(), use shortest path QUAT_LONG - rotation will be greater than 180 degrees QUAT_CW - rotate clockwise when viewed from above QUAT_CCW - rotate counterclockwise when viewed from above QUAT_USER - the quaternions are interpolated exactly as given