diff options
Diffstat (limited to 'city/geometry.lua')
-rw-r--r-- | city/geometry.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/city/geometry.lua b/city/geometry.lua index a775213..1632393 100644 --- a/city/geometry.lua +++ b/city/geometry.lua @@ -46,6 +46,18 @@ geom.square = class{ end, axis_range = function(c, r) return {min=c-r, max=c+r} end, + + contains = function(self, point) + local x_overlap = + (point.x > self.x.min) and (point.x <= self.x.max) + local y_overlap = + (point.y > self.y.min) and (point.y <= self.y.max) + + if x_overlap and y_overlap then + return true + end + return false + end } return geom |