Class: Vector

Vector(…args)

The classical Vector class, with some extensions. Vector does it's best to convert this to something useable, but it may not always find success. In this case, it returns new Vector(0).

Constructor

new Vector(…args)

Constructs a new Vector instance

Parameters:
Name Type Attributes Description
args * <repeatable>

The coordinates of the vector.

Source:

Methods

(static) crossProduct(vector1, vector2) → {Vector}

Find the Cross Product of two vectors. The resulting vector is at 90 degree angles to the other two.

Parameters:
Name Type Description
vector1 Vector

The first vector.

vector2 Vector

The second vector.

Source:
Returns:

The resulting cross product.

Type
Vector

(static) dotProduct(vector1, vector2) → {number}

Find the Dot Product of two vectors.

Parameters:
Name Type Description
vector1 Vector

The first vector.

vector2 Vector

The second vector.

Source:
Returns:

The resulting dot product.

Type
number

(static) linearDistance(vector1opt, vector2opt) → {number}

Finds the Euclidean distance between two vectors.

Parameters:
Name Type Attributes Default Description
vector1 Vector <optional>
Vector(0)

The first vector in the distance calculation.

vector2 Vector <optional>
Vector(0)

The second vector in the distance calculation.

Source:
Returns:

The resulting distance.

Type
number

(static) taxicabDistance(vector1opt, vector2opt) → {number}

Finds the Taxicab Distance between two vectors.

Parameters:
Name Type Attributes Default Description
vector1 Vector <optional>
Vector(0)

The first vector in the distance calculation.

vector2 Vector <optional>
Vector(0)

The second vector in the distance calculation.

Source:
Returns:

The taxicab distance between the two vectors

Type
number

addVector(vector) → {Vector}

Add a vector to another vector

Parameters:
Name Type Description
vector Vector

The vector to add.

Source:
Returns:

The resulting vector.

Type
Vector