Performs a line-circle collision test, returning true if they intersect. Algorithm from 2D Game Collision by Thomas Schwarzl.
var collide =var circle = 5 5radius = 25a = 5 6b = 10 10var hit =console
You may also be interested in:
collide(a, b, circle, radius[, nearest])
Performs a collision test with the line
a-b and the given circle. Returns true if collision occurred.
circle are expected to be 2D vectors in the form of an array.
nearest is passed, the nearest point found during the intersection test will be stored into that vector. This is useful if you need to find the nearest point along the line for the intersection test. If the hit returns false, you should not expect the value of
nearest to have changed.
MIT, see LICENSE.md for details.