rhodonite
    Preparing search index...

    Interface IVector

    Base interface for immutable vector types. Provides common read-only operations for vector mathematics.

    interface IVector {
        _v: TypedArray;
        bytesPerComponent: number;
        className: string;
        glslStrAsFloat: string;
        glslStrAsInt: string;
        glslStrAsUint: string;
        wgslStrAsFloat: string;
        wgslStrAsInt: string;
        wgslStrAsUint: string;
        x: number;
        at(i: number): number;
        dot(vec: IVector): number;
        flattenAsArray(): number[];
        isDummy(): boolean;
        isEqual(vec: IVector, delta?: number): boolean;
        isStrictEqual(vec: IVector): boolean;
        isTheSourceSame(arrayBuffer: ArrayBuffer): boolean;
        length(): number;
        lengthSquared(): number;
        lengthTo(vec: IVector): number;
        toString(): string;
        toStringApproximately(): string;
        v(i: number): number;
    }

    Hierarchy (View Summary)

    Implemented by

    Index

    Properties

    The underlying typed array containing vector components

    bytesPerComponent: number

    Number of bytes per component in the underlying array

    className: string

    The class name identifier

    glslStrAsFloat: string

    GLSL string representation for float type

    glslStrAsInt: string

    GLSL string representation for integer type

    glslStrAsUint: string

    GLSL string representation for unsigned integer type

    wgslStrAsFloat: string

    WGSL string representation for float type

    wgslStrAsInt: string

    WGSL string representation for integer type

    wgslStrAsUint: string

    WGSL string representation for unsigned integer type

    x: number

    The x component of the vector

    Methods

    • Gets the component value at the specified index.

      Parameters

      • i: number

        The component index

      Returns number

      The component value

    • Converts the vector to a flat array of numbers.

      Returns number[]

      Array containing all vector components

    • Checks if this is a dummy/placeholder vector.

      Returns boolean

      True if this is a dummy vector

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

      Parameters

      • vec: IVector

        The vector to compare with

      • Optionaldelta: number

        Optional tolerance value (default: small epsilon)

      Returns boolean

      True if vectors are approximately equal

    • Checks if this vector is strictly equal to another vector.

      Parameters

      • vec: IVector

        The vector to compare with

      Returns boolean

      True if vectors are exactly equal

    • Checks if this vector shares the same source array buffer.

      Parameters

      • arrayBuffer: ArrayBuffer

        The array buffer to check

      Returns boolean

      True if using the same source buffer

    • Calculates the squared length of the vector (faster than length).

      Returns number

      The squared vector length

    • Returns a string representation of the vector.

      Returns string

      String representation of the vector

    • Returns an approximate string representation of the vector with rounded values.

      Returns string

      Approximate string representation

    • Gets the component value at the specified index (alias for at).

      Parameters

      • i: number

        The component index

      Returns number

      The component value