Interface Vector

Abstract interface of https://github.com/mrdoob/three.js/blob/master/src/math/Vector2.js|Vector2, https://github.com/mrdoob/three.js/blob/master/src/math/Vector3.js|Vector3 and https://github.com/mrdoob/three.js/blob/master/src/math/Vector4.js|Vector4.

Currently the members of Vector is NOT type safe because it accepts different typed vectors.

Those definitions will be changed when TypeScript innovates Generics to be type safe.

Example

const v:Vector = new Vector3();
v.addVectors(new Vector2(0, 1), new Vector2(2, 3)); // invalid but compiled successfully

Hierarchy

  • Vector

Implemented by

Properties

isVector: boolean

Read-only flag to check if a given object is of type Vector.

Methods

  • Adds the scalar value s to this vector's values.

    Parameters

    • scalar: number

    Returns Vector

  • NOTE: Vector4 doesn't have the property.

    distanceTo(v:T):number;

    Parameters

    Returns number

  • NOTE: Vector4 doesn't have the property.

    distanceToSquared(v:T):number;

    Parameters

    Returns number

  • Parameters

    • index: number

    Returns number

  • length():number;

    Returns number

  • lengthSq():number;

    Returns number

  • Parameters

    • index: number
    • value: number

    Returns Vector