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

clone() → {ThreeVector}

Create a clone of this vector

Source:
Returns:

returns clone

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

getBendingDelta(target, options) → {ThreeVector}

Get bending Delta Vector towards another ThreeVector

Parameters:
Name Type Description
target ThreeVector

the target vector

options Object

bending options

Properties
Name Type Description
increments Number

number of increments

percent Number

The percentage to bend

min Number

No less than this value

max Number

No more than this value

Source:
Returns:

returns new Incremental Vector

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