Next: Miscellaneous, Previous: Tweens, Up: Math [Contents][Index]
(use-modules (sly math quaternion))
Quaternions are used to express rotations about an arbitrary axis in a way that avoids “gimbal lock” and allows for useful interpolation, unlike matrices or Euler angles.
Quaternions can be used in rotation transformations (see Transforms), as well as converted to and from Vectors.
Data type with 4 fields: w
, x
, y
, z
, in
that order. This type descriptor has been exposed for destructuring
via Guile’s (ice-9 match)
module.
Create a new quaternion from an axis angle (a 3D vector v plus an angle theta) or from individual coordinates w, x, y, and z.
Alternate spelling of make-quaternion
.
Return #t
if obj is a quaternion.
Return the w coordinate of the quaternion q.
Return the x coordinate of the quaternion q.
Return the y coordinate of the quaternion q.
Return the z coordinate of the quaternion q.
The multiplicative identity quaternion.
A quaternion with all fields set to zero.
Return the product of all quaternions. Return
identity-quaternion
if called without arguments.
Perform a spherical linear interpolation of the quaternions q1 and q2 and blending factor delta.
Return the magnitude of the quaternion q.
Return the normalized form of the quaternion q.
Convert the 4D vector v to a quaternion.
Convert the quaternion q to a 4D vector.
Next: Miscellaneous, Previous: Tweens, Up: Math [Contents][Index]