Constructor
new Vector(…args)
Constructs a new Vector instance
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
args |
* |
<repeatable> |
The coordinates of the vector. |
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. |
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. |
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. |
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. |
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. |
Returns:
The resulting vector.
- Type
- Vector