starry-math
    Preparing search index...

    Class Euler

    Represents Euler angles for 3D rotations using a specified order of rotation axes. Euler angles are three angles that describe the orientation of an object in 3D space. Each angle represents a rotation around one of the coordinate axes (x, y, z).

    Index

    Constructors

    • Creates a new Euler instance with the specified rotation angles and order.

      Parameters

      • x: number = 0

        Rotation angle around x-axis in radians. Default is 0.

      • y: number = 0

        Rotation angle around y-axis in radians. Default is 0.

      • z: number = 0

        Rotation angle around z-axis in radians. Default is 0.

      • order: EulerOrder = EulerOrder.XYZ

        The order in which rotations are applied. Default is EulerOrder.XYZ.

      Returns Euler

    Properties

    order: EulerOrder = EulerOrder.XYZ

    The order in which rotations are applied around the axes. Default is EulerOrder.XYZ.

    x: number = 0

    Rotation angle around the x-axis in radians.

    y: number = 0

    Rotation angle around the y-axis in radians.

    z: number = 0

    Rotation angle around the z-axis in radians.

    Methods

    • Creates a new Euler instance with the same rotation angles and order as this one.

      Returns Euler

      A new Euler instance with copied values.

    • Copies rotation angles and order from another Euler instance.

      Parameters

      • source: Euler

        The Euler instance to copy from.

      Returns this

      This Euler instance for method chaining.

    • Determines if this Euler angle set is equal to another.

      Parameters

      • euler: Euler

        The Euler angle set to compare with.

      Returns boolean

      True if all angles and the rotation order are equal, false otherwise.

    • Sets the rotation angles and order for this Euler instance.

      Parameters

      • x: number

        New rotation angle around x-axis in radians.

      • y: number

        New rotation angle around y-axis in radians.

      • z: number

        New rotation angle around z-axis in radians.

      • order: EulerOrder = ...

        New rotation order. If not provided, the current order is preserved.

      Returns this

      This Euler instance for method chaining.

    • Sets the Euler angles based on a rotation matrix. Assumes the upper 3x3 of the matrix is a pure rotation matrix (unscaled).

      Parameters

      • m: IMatrix4

        The rotation matrix to decompose into Euler angles. assumes the upper 3x3 of m is a pure rotation matrix (i.e, unscaled).

      Returns this

      This Euler instance for method chaining.

      The decomposition handles the gimbal lock case by setting the third angle to 0 when the middle rotation approaches ±90 degrees.

    • Returns the Euler angles as a three-element array [x, y, z].

      Returns [number, number, number]

      An array containing the rotation angles in radians.