Class AbstractQuaternionAbstract

Abstract base class for quaternion implementations.

Quaternions are a mathematical system that extends complex numbers and are commonly used in 3D graphics for representing rotations. A quaternion consists of four components (x, y, z, w) where (x, y, z) represents the vector part and w represents the scalar part.

This abstract class provides common functionality and interface for all quaternion implementations while leaving specific operations to be implemented by concrete subclasses.

Hierarchy (view full)

Implements

Constructors

Properties

_v: Float32Array = ...

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

Accessors

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

    • vec: IQuaternion

      The quaternion to compare against

    • Optionaldelta: number

      Optional tolerance value for comparison

    Returns boolean

    True if quaternions are approximately equal, false otherwise

    Error - Method must be implemented by subclass

  • Converts the quaternion to an approximate string representation. Useful for debugging when exact precision is not required.

    Returns string

    Approximate string representation of the quaternion

    Error - Method must be implemented by subclass