Really basic quaternion class used for 3D rotation calculations

Constructors

Properties

type: string

The type of the Quat

elements: Float32Array

Our quaternion array

axisOrder: AxisOrder

Rotation axis order

Methods

  • Sets the Quat axis order

    Parameters

    • axisOrder: string = 'XYZ'

      axis order to use

    Returns Quat

    • this Quat after axis order has been set
  • 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
  • Calculate the spherical linear interpolation of this Quat by given Quat and alpha, where alpha is the percent distance.

    Parameters

    • quat: Quat = ...

      Quat to interpolate towards.

    • alpha: number = 0

      spherical interpolation factor in the [0, 1] interval.

    Returns Quat

    • this Quat after spherical linear interpolation.