Skip to content

pymath.rotation_from_quat

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

Extracts the rotation axis and angle from a quaternion.

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

axis, angle = pymath.rotation_from_quat(q)
Parameter Type Description
q quaternion A quaternion {x, y, z, w}. It is normalized internally, so it need not be a unit quaternion.

Return value

Type Description
axis A new unit 3-vector, the rotation axis.
angle The rotation angle in degrees.

Notes:

Example:

local axis, angle = pymath.rotation_from_quat({0, 0, 0.70710678, 0.70710678})
-- axis  == {0, 0, 1}
-- angle == 90

Version Support:

Minimum PYTHA Version: V27

See also:

pymath, pymath.quat_from_rotation, pymath.matrix_from_quat

Clone this wiki locally