Point.lua
314 Bytes
cc.exports.Point = {}
function Point.new(x, y)
x=x or 0
y=y or 0
local this = {}
this.x= x;
this.y= y;
return this
end
function Point.distance(p1,p2)
local dx = math.abs(p2.x - p1.x);
local dy = math.abs(p2.y - p1.y);
return math.sqrt(dx * dx + dy * dy)
end
return Point