Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Vector

( interface Vector )

Abstract interface of Vector2, Vector3 and 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. See the ngx3js docs page for details.

example

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

Hierarchy

Index

Constructors

constructor

Methods

add

addScalar

  • addScalar(scalar: number): Vector

addScaledVector

addVectors

clone

copy

Optional distanceTo

Optional distanceToSquared

  • distanceToSquared(v: Vector): number
  • Computes the squared distance from this vector to v. If you are just comparing the distance with another distance, you should compare the distance squared instead as it is slightly more efficient to calculate.

    Parameters

    Returns number

divideScalar

  • divideScalar(s: number): Vector

dot

equals

getComponent

  • getComponent(index: number): number

length

  • length(): number

lengthSq

  • lengthSq(): number

lerp

  • Linearly interpolates between this vector and v, where alpha is the percent distance along the line - alpha = 0 will be this vector, and alpha = 1 will be v.

    Parameters

    • v: Vector

      Vector to interpolate towards.

    • alpha: number

    Returns Vector

multiplyScalar

  • multiplyScalar(s: number): Vector

negate

normalize

set

  • set(...args: number[]): Vector

setComponent

  • setComponent(index: number, value: number): Vector

setLength

setScalar

  • setScalar(scalar: number): Vector

sub

subVectors

Generated using TypeDoc