A quaternion.

Methods that manipulate values are generally destructive. To preserve the original values, explicitly call clone() to create a duplicate instance.

Hierarchy

  • Quaternion

Constructors

Properties

w: number
x: number
y: number
z: number

Methods

  • Returns a value that represents the current rotation in Euler angles.

    Returns Vector3

  • Returns the dot product of the quaternion and v.

    Parameters

    Returns number

  • Compares the quaternion to v, and returns true if they are approximately equal.

    Parameters

    Returns boolean

  • Updates the quaternion's value to the identity rotation. This is the state of having no rotation.

    Returns Quaternion

  • Returns the quaternion's length when viewed as a 4-dimensional vector.

    Returns number

  • Returns the quaternion's squared length when viewed as a 4-dimensional vector.

    Returns number

  • Sets the quaternion's component values to those specified in x, y, z, and w.

    Parameters

    • x: number
    • y: number
    • z: number
    • w: number

    Returns Quaternion

  • Updates the quaternion to a value that represents a rotation of degree degrees around the axis.

    Example

    new Quaternion().setFromAxisAngle(new Vector3(0, 1, 0), 90);
    

    Parameters

    Returns Quaternion

  • Updates the quaternion to a value that represents a rotation in Euler angles. Axes are applied in the order of ZXY.

    Example

    new Quaternion().setFromEulerAngles(new Vector3(90, 0, 0));
    

    Parameters

    Returns Quaternion

  • Calculates the spherical linear interpolation (slerp) between the current value and v, using a as the interpolation factor, then updates the quaternion's value to the result.

    Example

    let min = new Quaternion().identity();
    let max = new Quaternion().setFromEulerAngles(0, 45, 0);
    min.clone().slerp(max, 0.5);

    Parameters

    • v: Quaternion
    • a: number

      The interpolation factor, specified as a number between [0, 1].

    Returns Quaternion

Generated using TypeDoc