ThreeVector

ThreeVector

A ThreeVector is a geometric object which is completely described by three values.

Constructor

new ThreeVector(x, y, z)

Creates an instance of a ThreeVector.

Parameters:
Name Type Description
x Number

first value

y Number

second value

z Number

second value

Source:

Methods

add(other) → {ThreeVector}

Add other vector to this vector

Parameters:
Name Type Description
other ThreeVector

the other vector

Source:
Returns:

returns self

Type
ThreeVector

copy(sourceObj) → {ThreeVector}

Copy values from another ThreeVector into this ThreeVector

Parameters:
Name Type Description
sourceObj ThreeVector

the other vector

Source:
Returns:

returns self

Type
ThreeVector

length() → {Number}

Get vector length

Source:
Returns:

length of this vector

Type
Number

lerp(target, p) → {ThreeVector}

Apply in-place lerp (linear interpolation) to this ThreeVector towards another ThreeVector

Parameters:
Name Type Description
target ThreeVector

the target vector

p Number

The percentage to interpolate

Source:
Returns:

returns self

Type
ThreeVector

multiplyScalar(s) → {ThreeVector}

Multiply this ThreeVector by a scalar

Parameters:
Name Type Description
s Number

the scale

Source:
Returns:

returns self

Type
ThreeVector

normalize() → {ThreeVector}

Normalize this vector, in-place

Source:
Returns:

returns self

Type
ThreeVector

set(x, y, z) → {ThreeVector}

Set ThreeVector values

Parameters:
Name Type Description
x Number

x-value

y Number

y-value

z Number

z-value

Source:
Returns:

returns self

Type
ThreeVector

subtract(other) → {ThreeVector}

Subtract other vector from this vector

Parameters:
Name Type Description
other ThreeVector

the other vector

Source:
Returns:

returns self

Type
ThreeVector

toString() → {String}

Formatted textual description of the ThreeVector.

Source:
Returns:

description

Type
String