Vector2D Class
2D vector object with support functions for performing vector arithmetic.
Constructor
Vector2D
()
Item Index
Methods
add
-
vector2D
Adds the specified vector to this vector.
Parameters:
-
vector2D
Vector2DVector to be added.
Returns:
added
-
vector2D
-
output
Adds the specified vector to this vector and stores the result in the output vector. Doesn't modify this vector.
Returns:
divide
-
value
Divides this vector by the value.
Parameters:
-
value
Number
Returns:
divided
-
value
-
output
Divides this vector by the value and stores the result in the output vector. Doesn't modify this vector.
Parameters:
-
value
Number -
output
Vector2DVector that will hold the result.
Returns:
dot
-
vector2D
Parameters:
-
vector2D
Vector2DThe other vector the dot product will be performed with.
Returns:
invert
()
Vector2D
Inverts this vector.
Returns:
inverted
-
output
Inverts this vector and stores the result in the output vector. Doesn't modify this vector.
Parameters:
-
output
Vector2DVector that will hold the result.
Returns:
magnitude
()
Number
Returns:
magnitudeSquared
()
Number
Returns:
multiplied
-
value
-
output
Multiplies this vector by the value and stores the result in the output vector. Doesn't modify this vector.
Parameters:
-
value
Number -
output
Vector2DVector that will hold the result.
Returns:
multiply
-
value
Multiplies this vector by the value.
Parameters:
-
value
Number
Returns:
normalize
()
Vector2D
Normalizes this vector.
Returns:
normalized
-
output
Normalizes this vector and stores the result in the output vector. Doesn't modify this vector.
Parameters:
-
output
Vector2DVector that will hold the result.
Returns:
subtract
-
vector2D
Subtracts the specified vector from this vector.
Parameters:
-
vector2D
Vector2DVector to be subtracted.