mirror of
https://github.com/1bardesign/batteries.git
synced 2024-11-24 14:54:34 +00:00
added vec2.nearer (note: can be called as v:nearer(a, b))
This commit is contained in:
parent
3667975636
commit
d31d7425aa
5
vec2.lua
5
vec2.lua
@ -413,6 +413,11 @@ function vec2.winding_side(a, b, p)
|
||||
- (p.x - a.x) * (b.y - a.y)
|
||||
end
|
||||
|
||||
--return whether a is nearer to v than b
|
||||
function vec2.nearer(v, a, b)
|
||||
return v:distance_squared(a) < v:distance_squared(b)
|
||||
end
|
||||
|
||||
-----------------------------------------------------------
|
||||
-- vector extension methods for special purposes
|
||||
-- (any common vector ops worth naming)
|
||||
|
Loading…
Reference in New Issue
Block a user