Hilo3d API - v2.0.0
    Preparing search index...

    Class Quaternion

    Hierarchy (View Summary)

    Index
    • Creates a new identity quat

      Parameters

      • x: number = 0

        X component

      • y: number = 0

        Y component

      • z: number = 0

        Z component

      • w: number = 1

        W component

      Returns Quaternion

    className: string = 'Quaternion'

    类名

    elements: quat
    isQuaternion: boolean = true
    • Calculates the W component of a quat from the X, Y, and Z components. Assumes that quaternion is 1 unit in length. Any existing W component will be ignored.

      Returns this

      this

    • Calculates the conjugate of a quat If the quaternion is normalized, this function is faster than quat.inverse and produces the same result.

      Returns this

      this

    • Returns whether or not the quaternions have exactly the same elements in the same position (when compared with ===)

      Parameters

      Returns boolean

    • 从数组赋值

      Parameters

      • array: ArrayLike<number>

        数组

      • offset: number = 0

        数组偏移值

      Returns this

      this

    • Creates a quaternion from the given 3x3 rotation matrix.

      NOTE: The resultant quaternion is not normalized, so you should be sure to renormalize the quaternion yourself where necessary.

      Parameters

      Returns this

      this

    • Creates a quaternion from the given 3x3 rotation matrix.

      NOTE: The resultant quaternion is not normalized, so you should be sure to renormalize the quaternion yourself where necessary.

      Parameters

      Returns this

      this

    • Gets the rotation axis and angle for a given quaternion. If a quaternion is created with setAxisAngle, this method will return the same values as providied in the original parameter list OR functionally equivalent values. Example: The quaternion formed by axis [0, 0, 1] and angle -90 is the same as the quaternion formed by [0, 0, 1] and 270. This method favors the latter.

      Parameters

      • axis: Vector3

        Vector receiving the axis of rotation

      Returns number

      Angle, in radians, of the rotation

    • Calculates the length of a quat

      Returns number

      length of this

    • Performs a linear interpolation between two quat's

      Parameters

      • q: Quaternion
      • t: number

        interpolation amount between the two inputs

      Returns this

      this

    • Rotates a quaternion by the given angle about the X axis

      Parameters

      • rad: number

        angle (in radians) to rotate

      Returns this

      this

    • Rotates a quaternion by the given angle about the Y axis

      Parameters

      • rad: number

        angle (in radians) to rotate

      Returns this

      this

    • Rotates a quaternion by the given angle about the Z axis

      Parameters

      • rad: number

        angle (in radians) to rotate

      Returns this

      this

    • Sets a quaternion to represent the shortest rotation from one vector to another.

      Parameters

      Returns this

      this

    • Scales a quat by a scalar number

      Parameters

      • scale: number

        the vector to scale

      Returns this

      this

    • Set the components of a quat to the given values

      Parameters

      • x: number

        X component

      • y: number

        Y component

      • z: number

        Z component

      • w: number

        W component

      Returns this

      this

    • Sets the specified quaternion with values corresponding to the given axes. Each axis is a vec3 and is expected to be unit length and perpendicular to all other specified axes.

      Parameters

      • view: Vector3

        the vector representing the viewing direction

      • right: Vector3

        the vector representing the local "right" direction

      • up: Vector3

        the vector representing the local "up" direction

      Returns this

      this

    • Sets a quat from the given angle and rotation axis, then returns it.

      Parameters

      • axis: Vector3

        the axis around which to rotate

      • rad: number

        the angle in radians

      Returns this

      this

    • Performs a spherical linear interpolation between two quat

      Parameters

      • q: Quaternion
      • t: number

        interpolation amount between the two inputs

      Returns this

      this

    • Calculates the squared length of a quat

      Returns number

      squared length of this