from_euler#

classmethod Quaternion.from_euler(angles, sequence, extrinsic=False)#

Creates a normalized rotation quaternion from the Euler angles using the specified rotation sequence.

Parameters:
angleslist, tuple of 3 floats

The Euler angles in radians.

sequencestr

A three-character string indicating the rotation axis sequence (e.g., “xyz” or “ZYX”). It is case-insensitive and must contain only the characters ‘x’, ‘y’, or ‘z’.

extrinsicbool, optional

If True, the rotation is treated as extrinsic. If False (default), it is treated as intrinsic.

Returns:
Quaternion

A unit quaternion representing the rotation defined by the Euler angles in the given sequence.

Examples

>>> from ansys.aedt.core.generic.quaternion import Quaternion
>>> from math import pi
>>> q = Quaternion.from_euler([pi / 2, 0, 0], "xyz")
>>> q
Quaternion(0.7071067811865476, 0.7071067811865476, 0, 0)
>>> q = Quaternion.from_euler([0, pi / 2, pi], "zyz", extrinsic=True)
>>> q
Quaternion(0, -0.7071067811865476, 0, 0.7071067811865476)
>>> q = Quaternion.from_euler([0, pi / 2, pi], "zyz")
>>> q
Quaternion(0, 0.7071067811865476, 0, 0.7071067811865476)