Vector2¶
Reference¶
- class Vector2¶
- module:
- x: number¶
- y: number¶
- static new(x, y)¶
Create a new Vector2
- Parameters:¶
x (
number
) – x componenty (
number
) – y component
- sqrMagnitude()¶
Return the squared magnitude of the vector
- normalized()¶
Return the normalized version of this vector
- normalize()¶
Normalize the vector
- static dot(lhs, rhs)¶
Calculate dot product of 2 vectors
- static angle(from, to)¶
Calculate angle between 2 vectors
- div(d)¶
Divide this vector by another one. Result is stored in this vector.
- mul(d)¶
Multiply this vector with another one. Result is stored in this vector.
- add(b)¶
Adds another vector to this vector. Result is stored in this vector