You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Daniel Flassig edited this page Jun 24, 2026
·
1 revision
Multiplies two quaternions, composing the rotations they represent.
This function is located in the pymath module. See pymath for the quaternion representation.
q=pymath.multiply_quat(q1, q2)
Parameter
Type
Description
q1
quaternion
Left quaternion {x, y, z, w}.
q2
quaternion
Right quaternion {x, y, z, w}.
Return value
Type
Description
q
A new quaternion, the product q1 * q2.
Notes:
Quaternion multiplication is not commutative: q1 * q2 ≠ q2 * q1 in general.
As a composition of rotations, pymath.multiply_quat(q1, q2) applies q2 first and then q1 (the same order as multiplying rotation matrices).
If both operands are unit quaternions, the result is a unit quaternion.
Example:
-- Two successive 90° rotations about z give a 180° rotation about zlocalq90=pymath.quat_from_rotation({0, 0, 1}, 90)
localq180=pymath.multiply_quat(q90, q90)
-- q180 == {0, 0, 1, 0}