Skip to content

cf_m4_decompose

Category: math
GitHub: cute_math3d.h


Splits a transform matrix into translation, rotation, and scale.

void cf_m4_decompose(CF_M4x4 m, CF_V3* translation, CF_Quat* rotation, CF_V3* scale)
Parameters Description
m The transform to decompose.
translation Written with the translation. May be NULL.
rotation Written with the rotation. May be NULL.
scale Written with the per-axis scale. May be NULL.

Remarks

Assumes m is a translate-rotate-scale composition with no shear (skew silently folds into the rotation). A mirrored transform reports a negative x scale, since a flip cannot live in the quaternion. The inverse of cf_m4_from_trs -- useful for pulling a bone's pose out of a world matrix, or blending between authored transforms.

CF_M4x4
CF_Quat
cf_m4_from_trs
cf_quat_from_m4
cf_quat_to_m4
cf_m4_translate
cf_m4_scale