warp.quat_between_vectors#

warp.quat_between_vectors(a: vec3f, b: vec3f) → quatf[source]#
  • Kernel: true

Return the rotation quaternion that rotates the direction of a onto the direction of b.

Currently, opposite directions are not handled. This condition is not checked, and such inputs can produce an incorrect rotation.

For opposite directions, use warp.quat_from_axis_angle() instead, with any unit axis perpendicular to a and an angle of pi radians. The resulting 180-degree rotation maps normalize(a) onto normalize(b).

Parameters:
  • a – Source direction, of any nonzero length.

  • b – Target direction, of any nonzero length.

Returns:

Shortest-arc unit rotation quaternion q such that quat_rotate(q, normalize(a)) equals normalize(b).

Return type:

warp.quat