Class MutableQuaternion

A mutable quaternion class that extends the immutable Quaternion class. Provides methods for quaternion operations that modify the instance in place. Quaternions are used to represent rotations in 3D space and are particularly useful for avoiding gimbal lock and providing smooth interpolations.

Hierarchy (view full)

Implements

Constructors

Properties

_v: Float32Array = ...

Internal typed array storage for quaternion components [x, y, z, w].

Accessors

  • get compositionType(): CompositionTypeClass<"VEC4">
  • Gets the composition type for this quaternion class.

    Returns CompositionTypeClass<"VEC4">

    CompositionType.Vec4 indicating this is a 4-component vector

Methods

  • Calculates the dot product between this quaternion and another quaternion. The dot product of two quaternions gives a scalar value that represents the cosine of half the angle between them when both quaternions are unit quaternions.

    Parameters

    • quat: IQuaternion

      The quaternion to compute the dot product with

    Returns number

    The dot product result

  • Checks if this quaternion is approximately equal to another quaternion within a tolerance.

    Parameters

    • quat: IQuaternion

      The quaternion to compare with

    • delta: number = Number.EPSILON

      The tolerance value (default: Number.EPSILON)

    Returns boolean

    True if all components are within the tolerance, false otherwise

  • Clamps the rotation angle of a quaternion to a maximum value. If the quaternion's rotation angle exceeds thetaMax, it scales the rotation down.

    Parameters

    • quat: IQuaternion

      The quaternion to clamp

    • thetaMax: number

      The maximum allowed rotation angle in radians

    Returns IQuaternion

    A quaternion with rotation angle clamped to thetaMax