local geom = {} -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -- -- point -- -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ local point = { __call = function(_, x, y) local pt = {} pt.x = x pt.y = y setmetatable(pt, {__index=_}) return pt end, distance_to = function(self, pt) local d_x = self.x - pt.x local d_y = self.y - pt.y return math.sqrt(d_x*d_x + d_y*d_y) end, } setmetatable(point, point) geom.point = point return geom