:right-sidebar: True Euler =================================================================== .. currentmodule:: gi.repository.Graphene .. versionadded:: 1.2 .. class:: Euler(*args, **kwargs) :no-contents-entry: Describe a rotation using Euler angles. The contents of the :obj:`~gi.repository.Graphene.Euler` structure are private and should never be accessed directly. Constructors ------------ .. rst-class:: interim-class .. class:: Euler :no-index: .. classmethod:: alloc() -> ~gi.repository.Graphene.Euler Allocates a new :obj:`~gi.repository.Graphene.Euler`\. The contents of the returned structure are undefined. .. versionadded:: 1.2 Methods ------- .. rst-class:: interim-class .. class:: Euler :no-index: .. method:: equal(b: ~gi.repository.Graphene.Euler) -> bool Checks if two :obj:`~gi.repository.Graphene.Euler` are equal. .. versionadded:: 1.2 :param b: a :obj:`~gi.repository.Graphene.Euler` .. method:: free() -> None Frees the resources allocated by :func:`~gi.repository.Graphene.Euler.alloc`. .. versionadded:: 1.2 .. method:: get_alpha() -> float Retrieves the first component of the Euler angle vector, depending on the order of rotation. See also: :func:`~gi.repository.Graphene.Euler.get_x` .. versionadded:: 1.10 .. method:: get_beta() -> float Retrieves the second component of the Euler angle vector, depending on the order of rotation. See also: :func:`~gi.repository.Graphene.Euler.get_y` .. versionadded:: 1.10 .. method:: get_gamma() -> float Retrieves the third component of the Euler angle vector, depending on the order of rotation. See also: :func:`~gi.repository.Graphene.Euler.get_z` .. versionadded:: 1.10 .. method:: get_order() -> ~gi.repository.Graphene.EulerOrder Retrieves the order used to apply the rotations described in the :obj:`~gi.repository.Graphene.Euler` structure, when converting to and from other structures, like :obj:`~gi.repository.Graphene.Quaternion` and :obj:`~gi.repository.Graphene.Matrix`\. This function does not return the :const:`~gi.repository.Graphene.EulerOrder.DEFAULT` enumeration value; it will return the effective order of rotation instead. .. versionadded:: 1.2 .. method:: get_x() -> float Retrieves the rotation angle on the X axis, in degrees. .. versionadded:: 1.2 .. method:: get_y() -> float Retrieves the rotation angle on the Y axis, in degrees. .. versionadded:: 1.2 .. method:: get_z() -> float Retrieves the rotation angle on the Z axis, in degrees. .. versionadded:: 1.2 .. method:: init(x: float, y: float, z: float) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the given angles. The order of the rotations is :const:`~gi.repository.Graphene.EulerOrder.DEFAULT`. .. versionadded:: 1.2 :param x: rotation angle on the X axis, in degrees :param y: rotation angle on the Y axis, in degrees :param z: rotation angle on the Z axis, in degrees .. method:: init_from_euler(src: ~gi.repository.Graphene.Euler | None = None) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the angles and order of another :obj:`~gi.repository.Graphene.Euler`\. If the :obj:`~gi.repository.Graphene.Euler` ``src`` is :const:`None`, this function is equivalent to calling :func:`~gi.repository.Graphene.Euler.init` with all angles set to 0. .. versionadded:: 1.2 :param src: a :obj:`~gi.repository.Graphene.Euler` .. method:: init_from_matrix(m: ~gi.repository.Graphene.Matrix | None, order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the given rotation matrix. If the :obj:`~gi.repository.Graphene.Matrix` ``m`` is :const:`None`, the :obj:`~gi.repository.Graphene.Euler` will be initialized with all angles set to 0. .. versionadded:: 1.2 :param m: a rotation matrix :param order: the order used to apply the rotations .. method:: init_from_quaternion(q: ~gi.repository.Graphene.Quaternion | None, order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the given normalized quaternion. If the :obj:`~gi.repository.Graphene.Quaternion` ``q`` is :const:`None`, the :obj:`~gi.repository.Graphene.Euler` will be initialized with all angles set to 0. .. versionadded:: 1.2 :param q: a normalized :obj:`~gi.repository.Graphene.Quaternion` :param order: the order used to apply the rotations .. method:: init_from_radians(x: float, y: float, z: float, order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the given angles and order of rotation. .. versionadded:: 1.10 :param x: rotation angle on the X axis, in radians :param y: rotation angle on the Y axis, in radians :param z: rotation angle on the Z axis, in radians :param order: order of rotations .. method:: init_from_vec3(v: ~gi.repository.Graphene.Vec3 | None, order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` using the angles contained in a :obj:`~gi.repository.Graphene.Vec3`\. If the :obj:`~gi.repository.Graphene.Vec3` ``v`` is :const:`None`, the :obj:`~gi.repository.Graphene.Euler` will be initialized with all angles set to 0. .. versionadded:: 1.2 :param v: a :obj:`~gi.repository.Graphene.Vec3` containing the rotation angles in degrees :param order: the order used to apply the rotations .. method:: init_with_order(x: float, y: float, z: float, order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Initializes a :obj:`~gi.repository.Graphene.Euler` with the given angles and ``order``\. .. versionadded:: 1.2 :param x: rotation angle on the X axis, in degrees :param y: rotation angle on the Y axis, in degrees :param z: rotation angle on the Z axis, in degrees :param order: the order used to apply the rotations .. method:: reorder(order: ~gi.repository.Graphene.EulerOrder) -> ~gi.repository.Graphene.Euler Reorders a :obj:`~gi.repository.Graphene.Euler` using ``order``\. This function is equivalent to creating a :obj:`~gi.repository.Graphene.Quaternion` from the given :obj:`~gi.repository.Graphene.Euler`\, and then converting the quaternion into another :obj:`~gi.repository.Graphene.Euler`\. .. versionadded:: 1.2 :param order: the new order .. method:: to_matrix() -> ~gi.repository.Graphene.Matrix Converts a :obj:`~gi.repository.Graphene.Euler` into a transformation matrix expressing the extrinsic composition of rotations described by the Euler angles. The rotations are applied over the reference frame axes in the order associated with the :obj:`~gi.repository.Graphene.Euler`\; for instance, if the order used to initialize ``e`` is :const:`~gi.repository.Graphene.EulerOrder.XYZ`: - the first rotation moves the body around the X axis with an angle φ - the second rotation moves the body around the Y axis with an angle of ϑ - the third rotation moves the body around the Z axis with an angle of ψ The rotation sign convention is right-handed, to preserve compatibility between Euler-based, quaternion-based, and angle-axis-based rotations. .. versionadded:: 1.2 .. method:: to_quaternion() -> ~gi.repository.Graphene.Quaternion Converts a :obj:`~gi.repository.Graphene.Euler` into a :obj:`~gi.repository.Graphene.Quaternion`\. .. versionadded:: 1.10 .. method:: to_vec3() -> ~gi.repository.Graphene.Vec3 Retrieves the angles of a :obj:`~gi.repository.Graphene.Euler` and initializes a :obj:`~gi.repository.Graphene.Vec3` with them. .. versionadded:: 1.2 Fields ------ .. rst-class:: interim-class .. class:: Euler :no-index: .. attribute:: angles .. attribute:: order