Interface IVector3

Interface for immutable 3D vectors. Provides operations specific to 3-component vectors with homogeneous coordinate support.

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

Hierarchy (view full)

Implemented by

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

w: number

The w component (homogeneous coordinate, typically 1.0 for points, 0.0 for vectors)

wgslStrAsFloat: string

WGSL string representation for float type

wgslStrAsInt: string

WGSL string representation for integer type

x: number

The x component

y: number

The y component

z: number

The z component

Methods

  • Checks equality with another Vector3 within tolerance.

    Parameters

    • vec: IVector3

      Vector to compare with

    • Optionaldelta: number

      Optional tolerance

    Returns boolean

    True if approximately 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

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

    Parameters

    • i: number

      The component index

    Returns number

    The component value