v1.0.0
·
39 commits
to master
since this release
Major version. Add the Vector2D class.
Change Log
- Add the
Vector2Dclass
Features
- Classes:
Vector2D:- Constants:
ZERO— (0, 0)BASIS_X— (1, 0)BASIS_Y— (0, 1)
- Operations:
equals(other)— check exact equalityalmost_equals(other, [epsilon])— check approximate equality within a given epsilonlength_squared()— compute the squared lengthlength()— compute the lengthnormalized()— return the normalized vectoradd(other)— add another vectorsub(other)— subtract another vectormul(value)— multiply by a scalar or perform component-wise multiplication with another vectorneg()— unary minusdot(other)— compute the dot productdiv(value)— divide by a scalar or perform component-wise division by another vector
- Operators (via metamethods):
==— check exact equality (__eq())#vector— compute the length (__len()); supported only since Lua 5.2+— add two vectors (__add())-— subtract two vectors (__sub())*— multiply by a scalar (vector * scalarorscalar * vector) or perform component-wise multiplication (vector * vector) (__mul())-vector— unary minus (__unm())/— divide by a scalar (vector / scalar) or perform component-wise division (vector / vector) (__div())
- Constants: