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

    Constructors

    Properties

    _v: TypedArray = ...

    Internal typed array storage for vector components

    Accessors

    • 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 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

    Methods

    • 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

    • 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 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 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

    • 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