Quaternions.Q
val create : float -> Owl.Mat.mat -> ([ `unit ], _) t
create theta u
creates a unit quaternion correponsing to a rotation of angle theta
around axis u
. Note that u
is first normalised so only its direction matters.
val create_real : float -> (_, [ `real ]) t
val create_imag : Owl.Mat.mat -> (_, [ `imaginary ]) t
val unpack : (_, _) t -> float * Owl.Mat.mat
Extracts the real (scalar) and imaginary (vector) part of a quaternion
val unpack_flt : (_, _) t -> float * (float * float * float)
val of_ypr : (float * float * float) -> ([ `unit ], _) t
Create a unit quaternion from the yaw, pitch, and roll angles.
val to_ypr : ([ `unit ], _) t -> float * float * float
Extract (yaw, pitch, roll) from a quaternion; these are the conventions used by J Wilson et al 2018, corresponding to the intrinsic Tait-Bryan angles following the (x'' - y' - z) convention -- cf wikipedia.
val to_vec : (_, _) t -> Owl.Mat.mat
Packs a quaternion as a 4D vector.
val of_vec : Owl.Mat.mat -> (_, _) t
Unpacks a 4D vector into a quaternion.
Renormalises a quaternion (so it becomes a unit quaternion)
val sqr_norm : (_, _) t -> float
Squared norm of a quaternion
val to3D : ([ `unit ], _) t -> Owl.Mat.mat
place a quaternion inside the 3D ball used to visualise them
val sample : unit -> ([ `unit ], _) t
sample quaternions from a geodesic-uniform distribution on SO(3)