From Wake
Jump to: navigation, search

Class: Vector2

Type: native

Can Construct: yes


Provides a Vector2 class and mathematical functions.


Almost all Vector2 functions accept either an instance of a Vector2 or a table of length 2 as shorthand.


Vector2:applyCreate a new vector by applying a function to each element of the current vector.
Vector2:distanceCalculate the distance between two vectors.
Vector2:dotCalculate the dot product between two vectors.
Vector2:getGet an element from a vector.
Vector2:lengthCalculate the length of a vector.
Vector2:normalizeCalculate the normalized form of a vector.
Vector2:reflectCalculate the reflection direction.
Vector2:refractCalculate the refraction vector.
Vector2:setSet the value of an element in a vector.
Vector2:setAllSet all values contained in a vector.
Vector2:tableGet the table representation of a vector.