TwoVector

TwoVector

A TwoVector is a geometric object which is completely described by two values.

Constructor

new TwoVector(x, y) → {TwoVector}

Creates an instance of a TwoVector.

Parameters:
Name Type Description
x Number

first value

y Number

second value

Source:
Returns:

v - the new TwoVector

Type
TwoVector

Methods

add(other) → {TwoVector}

Add other vector to this vector

Parameters:
Name Type Description
other TwoVector

the other vector

Source:
Returns:

returns self

Type
TwoVector

clone() → {TwoVector}

Create a clone of this vector

Source:
Returns:

returns clone

Type
TwoVector

copy(sourceObj) → {TwoVector}

Copy values from another TwoVector into this TwoVector

Parameters:
Name Type Description
sourceObj TwoVector

the other vector

Source:
Returns:

returns self

Type
TwoVector

getBendingDelta(target, options) → {TwoVector}

Get bending Delta Vector towards another TwoVector

Parameters:
Name Type Description
target TwoVector

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
TwoVector

length() → {Number}

Get vector length

Source:
Returns:

length of this vector

Type
Number

lerp(target, p) → {TwoVector}

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

Parameters:
Name Type Description
target TwoVector

the target vector

p Number

The percentage to interpolate

Source:
Returns:

returns self

Type
TwoVector

multiplyScalar(s) → {TwoVector}

Multiply this TwoVector by a scalar

Parameters:
Name Type Description
s Number

the scale

Source:
Returns:

returns self

Type
TwoVector

normalize() → {TwoVector}

Normalize this vector, in-place

Source:
Returns:

returns self

Type
TwoVector

set(x, y) → {TwoVector}

Set TwoVector values

Parameters:
Name Type Description
x Number

x-value

y Number

y-value

Source:
Returns:

returns self

Type
TwoVector

subtract(other) → {TwoVector}

Subtract other vector to this vector

Parameters:
Name Type Description
other TwoVector

the other vector

Source:
Returns:

returns self

Type
TwoVector

toString() → {String}

Formatted textual description of the TwoVector.

Source:
Returns:

description

Type
String