Skip to content

cf_quat_from_to

Category: math
GitHub: cute_math3d.h


Returns the shortest rotation taking direction from onto direction to.

CF_Quat cf_quat_from_to(CF_V3 from, CF_V3 to)
Parameters Description
from The starting direction. Need not be unit length.
to The ending direction. Need not be unit length.

Remarks

The workhorse of aiming: point a turret at a target, align a decal to a surface normal, tilt a character to a slope. Exactly-opposed directions have no unique answer, so a perpendicular axis is chosen arbitrarily.

CF_Quat
cf_quat_from_axis_angle
cf_quat_slerp
cf_quat_from_basis