added vec2.nearer (note: can be called as v:nearer(a, b))

This commit is contained in:
Max Cahill 2024-05-08 15:09:59 +10:00
parent 3667975636
commit d31d7425aa

View File

@ -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)