Skip to content

cf_quat_from_basis

Category: math
GitHub: cute_math3d.h


Builds a rotation from three orthonormal basis vectors (the rotation's columns).

CF_Quat cf_quat_from_basis(CF_V3 x, CF_V3 y, CF_V3 z)
Parameters Description
x The direction the +x axis maps to.
y The direction the +y axis maps to.
z The direction the +z axis maps to.

Remarks

Assumes a right-handed orthonormal basis; a mirrored (negative determinant) basis has no quaternion and produces garbage. Use cf_quat_from_m4 to pull the rotation out of a full transform instead.

CF_Quat
cf_quat_from_m4
cf_quat_from_to
cf_quat_to_m4