Next: , Previous: , Up: Math   [Contents][Index]


2.2.5 Quaternions

In game development, the quaternion is most often used to represent rotations. Why not use a matrix for that, you may ask. Unlike matrices, quaternions can be interpolated (animated) and produce a meaningful result. When interpolating two quaternions, there is a smooth transition from one rotation to another, whereas interpolating two matrices would yield garbage.

Procedure: quaternion x y z w

Return a new quaternion with values x, y, z, and w.

Procedure: quaternion? obj

Return #t if obj is a quaternion.

Procedure: quaternion-w q

Return the W component of the quaternion q.

Procedure: quaternion-x q

Return the X component of the quaternion q.

Procedure: quaternion-y q

Return the Y component of the quaternion q.

Procedure: quaternion-z q

Return the Z component of the quaternion q.

Procedure: make-identity-quaternion

Return the identity quaternion.