Interface IMutableScalar

Interface for mutable scalar values.

interface IMutableScalar {
    _v: TypedArray;
    bytesPerComponent: number;
    className: string;
    glslStrAsFloat: string;
    glslStrAsInt: string;
    wgslStrAsFloat: string;
    wgslStrAsInt: string;
    x: number;
    add(vec: any): IMutableVector;
    at(i: number): number;
    copyComponents(vec: any): IMutableVector;
    divide(value: number): IMutableVector;
    divideVector(vec: any): IMutableVector;
    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;
    multiply(value: number): IMutableVector;
    multiplyVector(vec: any): IMutableVector;
    normalize(): IMutableVector;
    one(): IMutableVector;
    raw(): TypedArray;
    setAt(i: number, value: number): IMutableVector;
    setComponents(...num: number[]): IMutableVector;
    subtract(vec: any): IMutableVector;
    toString(): string;
    toStringApproximately(): string;
    v(i: number): number;
    zero(): IMutableVector;
}

Hierarchy (view full)

Properties

The underlying typed array containing vector components (mutable)

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

wgslStrAsFloat: string

WGSL string representation for float type

wgslStrAsInt: string

WGSL string representation for integer type

x: number

The scalar value (x component)

Methods

  • 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

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

    Parameters

    • i: number

      The component index

    Returns number

    The component value