Class: Vector

Vector()

new Vector()

A vector holds three integer values, x, y and z. By default if you want to use only x and y, z will be zero.
Properties:
Name Type Description
x Number x
y Number y
z Number z
Source:

Methods

(static) divide(scalar) → {Vector}

Divides a vector by a scalar
Parameters:
Name Type Description
scalar Number the value you want to divide the vector by
Source:
Returns:
A new vector with the vector scaled by division based on the number given
Type
Vector

(static) dot(other) → {Number}

Calculates the dot product between the two vectors
Parameters:
Name Type Description
other Vector the vector to perform the dot product with
Source:
Returns:
the dot product between the two vectors
Type
Number

(static) magnitude() → {Number}

Returns the magnitude of the vector
Source:
Returns:
The magnitude of the vector
Type
Number

(static) multiply(scalar) → {Vector}

Multiplies a vector by a scalar
Parameters:
Name Type Description
scalar Number the value you want to multiply to the vector
Source:
Returns:
A new vector with the vector scaled by multiplication based on the number given
Type
Vector

(static) normalize() → {Vector}

Normalizes the vector by dividing it by it's own magnitude.
Source:
Returns:
A new vector of normalized vector
Type
Vector

add(other) → {Vector}

Adds two Vectors together
Parameters:
Name Type Description
other Vector the vector you want to add
Source:
Returns:
A new vector with the two vectors added
Type
Vector

constructor()

Creates the Vector object
Source:

subtract(other) → {Vector}

Subtracts two Vectors
Parameters:
Name Type Description
other Vector the vector you want to subtract
Source:
Returns:
A new vector with the two vectors subtracted
Type
Vector