Skip to content

cf_quat_from_m4

Category: math
GitHub: cute_math3d.h


Extracts the rotation from a transform matrix.

CF_Quat cf_quat_from_m4(CF_M4x4 m)
Parameters Description
m A transform whose upper 3x3 is a rotation, optionally with positive scale.

Remarks

Scale is divided out per column, so this reads the rotation off a composed translate-rotate-scale transform. A mirrored (negative determinant) transform has no rotation to extract and produces garbage -- see cf_m4_decompose, which reports the flip in its scale.

CF_Quat
CF_M4x4
cf_quat_to_m4
cf_quat_from_basis
cf_m4_decompose