Skip to content

Commit

Permalink
added vec2.nearer (note: can be called as v:nearer(a, b))
Browse files Browse the repository at this point in the history
  • Loading branch information
1bardesign committed May 8, 2024
1 parent 3667975 commit d31d742
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions vec2.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit d31d742

Please sign in to comment.