rhodonite
    Preparing search index...

    Class AbstractVectorAbstract

    Abstract base class for vector implementations. Provides common functionality and defines the interface that all vector classes must implement. This class handles basic vector operations and serves as a foundation for specific vector types.

    Hierarchy (View Summary)

    Implements

    Index
    _v: TypedArray = ...

    Internal typed array storage for vector components

    • get bytesPerComponent(): number

      Gets the number of bytes per component in the underlying typed array.

      Returns number

      Bytes per component

      Error - Must be implemented by subclasses

    • get className(): string

      Gets the class name of this vector instance.

      Returns string

      The constructor name of the class

    • get glslStrAsFloat(): string

      Gets the GLSL string representation of the vector as float values.

      Returns string

      GLSL-formatted string for float values

      Error - Must be implemented by subclasses

    • get glslStrAsInt(): string

      Gets the GLSL string representation of the vector as integer values.

      Returns string

      GLSL-formatted string for integer values

      Error - Must be implemented by subclasses

    • get glslStrAsUint(): string

      Gets the GLSL string representation of the vector as unsigned integer values.

      Returns string

      GLSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get wgslStrAsFloat(): string

      Gets the WGSL string representation of the vector as float values.

      Returns string

      WGSL-formatted string for float values

      Error - Must be implemented by subclasses

    • get wgslStrAsInt(): string

      Gets the WGSL string representation of the vector as integer values.

      Returns string

      WGSL-formatted string for integer values

      Error - Must be implemented by subclasses

    • get wgslStrAsUint(): string

      Gets the WGSL string representation of the vector as unsigned integer values.

      Returns string

      WGSL-formatted string for unsigned integer values with 'u' suffix

      Error - Must be implemented by subclasses

    • get x(): number

      Gets the x-component (first component) of the vector.

      Returns number

      The x-component value

    • Gets the component value at the specified index.

      Parameters

      • i: number

        The index of the component to retrieve

      Returns number

      The component value at the given index

    • Calculates the dot product between this vector and another vector.

      Parameters

      Returns number

      The dot product result

      Error - Must be implemented by subclasses

    • Converts the vector to a flat array of numbers.

      Returns number[]

      Array containing all vector components

      Error - Must be implemented by subclasses

    • Checks if this vector is a dummy (empty) vector. A dummy vector has no components and is typically used as a placeholder.

      Returns boolean

      True if the vector is dummy, false otherwise

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

      Parameters

      • _vec: IVector
      • Optional_delta: number

      Returns boolean

      True if vectors are approximately equal, false otherwise

      Error - Must be implemented by subclasses

    • Checks if this vector is strictly equal to another vector (exact equality).

      Parameters

      Returns boolean

      True if vectors are exactly equal, false otherwise

      Error - Must be implemented by subclasses

    • Checks if the internal storage shares the same ArrayBuffer as the provided one. Useful for determining if vectors share underlying memory.

      Parameters

      • arrayBuffer: ArrayBuffer

        The ArrayBuffer to compare against

      Returns boolean

      True if the same ArrayBuffer is used, false otherwise

    • Calculates the length (magnitude) of the vector.

      Returns number

      The length of the vector

      Error - Must be implemented by subclasses

    • Calculates the squared length of the vector. This is more efficient than length() when only relative comparisons are needed.

      Returns number

      The squared length of the vector

      Error - Must be implemented by subclasses

    • Calculates the distance from this vector to another vector.

      Parameters

      Returns number

      The distance between the vectors

      Error - Must be implemented by subclasses

    • Converts the vector to its string representation.

      Returns string

      String representation of the vector

      Error - Must be implemented by subclasses

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

      Returns string

      Approximate string representation of the vector

      Error - Must be implemented by subclasses

    • Gets the component value at the specified index. Alias for the at() method for convenience.

      Parameters

      • i: number

        The index of the component to retrieve

      Returns number

      The component value at the given index