Adds the two vectors.
Optional
A new vector of vectorA and vectorB added
add
Returns the angle in radians between the two vectors relative to the x-axis.
The angle in radians
angle
Returns a new vector with x and y copied from the given vector.
x
y
vector
A new cloned vector
clone
Creates a new vector.
A new vector
create
Returns the cross-product of two vectors.
The cross product of the two vectors
cross
Returns the cross-product of three vectors.
The cross product of the three vectors
cross3
Divides a vector and a scalar.
A new vector divided by scalar
div
Returns the dot-product of two vectors.
The dot product of the two vectors
dot
Returns the magnitude (length) of a vector.
The magnitude of the vector
magnitude
Returns the magnitude (length) of a vector (therefore saving a sqrt operation).
sqrt
The squared magnitude of the vector
magnitudeSquared
Multiplies a vector and a scalar.
A new vector multiplied by scalar
mult
Negates both components of a vector such that it points in the opposite direction.
The negated vector
neg
Normalises a vector (such that its magnitude is 1).
1
A new vector normalised
normalise
Returns the perpendicular vector. Set negate to true for the perpendicular in the opposite direction.
negate
The perpendicular vector
perp
Rotates the vector about (0, 0) by specified angle.
A new vector rotated about (0, 0)
rotate
Rotates the vector about a specified point by specified angle.
A new vector rotated about the point
rotateAbout
Subtracts the two vectors.
A new vector of vectorA and vectorB subtracted
sub
Adds the two vectors.