Skip to content

pymath.invert_quat

Daniel Flassig edited this page Jun 24, 2026 · 1 revision

Computes the inverse of a quaternion, i.e. the inverse rotation.

This function is located in the pymath module. See pymath for the quaternion representation.

q_inv = pymath.invert_quat(q)
Parameter Type Description
q quaternion A quaternion {x, y, z, w}.

Return value

Type Description
q_inv A new quaternion, the inverse of q.

Notes:

  • This is the general inverse and is valid for non-unit quaternions. For a unit quaternion it equals the conjugate {-x, -y, -z, w}.
  • pymath.multiply_quat(q, q_inv) yields the identity quaternion {0, 0, 0, 1}.
  • q itself is not modified.

Example:

local q     = pymath.quat_from_rotation({0, 0, 1}, 90)
local q_inv = pymath.invert_quat(q)
-- q_inv == {0, 0, -0.70710678, 0.70710678}

Version Support:

Minimum PYTHA Version: V27

See also:

pymath, pymath.multiply_quat, pymath.rotate_by_quat

Clone this wiki locally