Little refactoring
This commit is contained in:
parent
d2308917b4
commit
8a8db93ac1
7 changed files with 67 additions and 53 deletions
11
point.lua
11
point.lua
|
@ -29,3 +29,14 @@ end
|
|||
function Point:coords()
|
||||
return self.x, self.y
|
||||
end
|
||||
|
||||
-- Return vector length between points
|
||||
---@param point Point
|
||||
---@return number
|
||||
function Point:distanceTo( point )
|
||||
return math.sqrt(
|
||||
( self.x - point.x ) ^ 2 +
|
||||
( self.y - point.y ) ^ 2
|
||||
)
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue