diff options
Diffstat (limited to 'math.lua')
| -rw-r--r-- | math.lua | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -14,6 +14,10 @@ Vec2.__div = function(a, b) end Vec2.__tostring = function(a) return "(" .. fmt(a.x) .. "," .. fmt(a.y) .. ")" end +function Vec2:in_bounds(low, hi) + return self.x >= low.x and self.x <= hi.x and self.y >= low.y and self.y <= hi.y +end + function Vec2:magnitude() return sqrt(self.x * self.x + self.y * self.y) end |
