Really basic quaternion class used for 3D rotation calculations

Constructors

  • Quat constructor

    Parameters

    • Optional elements: Float32Array = ...

      initial array to use

    • Optional axisOrder: AxisOrder = 'XYZ'

      axis order to use

    Returns Quat

Properties

type: string

The type of the Quat

elements: Float32Array

Our quaternion array

axisOrder: AxisOrder

Rotation axis order

Methods

  • Sets the Quat values from an array

    Parameters

    • array: number[] | Float32Array = ...

      an array of at least 4 elements

    Returns Quat

    • this Quat after being set
  • Sets the Quat axis order

    Parameters

    • axisOrder: string = 'XYZ'

      axis order to use

    Returns Quat

    • this Quat after axis order has been set
  • Check if 2 Quat are equal

    Parameters

    • quaternion: Quat = ...

      Quat to check against

    Returns boolean

    • whether the Quat are equal or not
  • Set a Quat from a rotation axis vector and an angle

    Parameters

    • axis: Vec3

      normalized vector around which to rotate

    • angle: number = 0

      angle (in radians) to rotate

    Returns Quat

    • Quat after having applied the rotation