Module Gg.Quat

module Quat: sig .. end

type t = Gg.quat 
The type for quaternions.

Constructors, accessors and constants


val v : float -> float -> float -> float -> Gg.quat
v x y z w is the quaternion xi+ yj + zk + w.
val zero : Gg.quat
zero is the zero quaternion.
val id : Gg.quat
id is the identity quaternion 1.

Functions


val mul : Gg.quat -> Gg.quat -> Gg.quat
mul q r is the quaternion multiplication q * r.
val conj : Gg.quat -> Gg.quat
conj q is the quaternion conjugate q*.
val unit : Gg.quat -> Gg.quat
unit q is the unit vector q/|q| (same as Gg.V4.unit).
val inv : Gg.quat -> Gg.quat
inv q is the quaternion inverse q-1.
val slerp : Gg.quat -> Gg.quat -> float -> Gg.quat
slerp q r t is the spherical linear interpolation between q and r at t. Non commutative, torque minimal and constant velocity.
val squad : Gg.quat -> Gg.quat -> Gg.quat -> Gg.quat -> float -> Gg.quat
squad q cq cr r t is the spherical cubic interpolation between q and r at t. cq and cr indicate the tangent orientations at q and r.
val nlerp : Gg.quat -> Gg.quat -> float -> Gg.quat
nlerp q r t is the normalized linear interpolation between q and r at t. Commutative, torque minimal and inconstant velocity.

3D space transformations


val of_m3 : Gg.m3 -> Gg.quat
of_m3 m is the unit quaternion for the rotation in m.
val of_m4 : Gg.m4 -> Gg.quat
of_m4 m is the unit quaternion for the rotation in the 3x3 top left matrix in m.
val rot3_map : Gg.v3 -> Gg.v3 -> Gg.quat
Unit quaternion for the rotation, see Gg.M3.rot3_map.
val rot3_axis : Gg.v3 -> float -> Gg.quat
Unit quaternion for the rotation, see Gg.M3.rot3_axis.
val rot3_zyx : Gg.v3 -> Gg.quat
Unit quaternion for the rotation, see Gg.M3.rot3_zyx.
val to_rot3_axis : Gg.quat -> Gg.v3 * float
to_rot3_axis q is the rotation axis and angle in radians of the unit quaternion q.
val to_rot3_zyx : Gg.quat -> Gg.v3
to_rot_zyx q is the x, y, z axis angles in radians of the unit quaternion q.
val apply3 : Gg.quat -> Gg.v3 -> Gg.v3
apply3 q v applies the 3D rotation of the unit quaternion q to the vector (or point) v.
val apply4 : Gg.quat -> Gg.v4 -> Gg.v4
apply4 q v apply the 3D rotation of the unit quaternion q to the homogenous vector (or point) v.