Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

point-circle-collision

mattdesl1.5kMIT1.0.3

test for collision with a circle and point

circle, point, collision, hit, circle-point-collision, in, point in circle, hittest, test, collide, collisions, intersect, intersection, contains, inside

readme

point-circle-collision

stable

Performs a point-circle collision test, returning true if they intersect.

var collide = require('point-circle-collision')

var circle = [5, 5],
    radius = 25,
    point = [5, 6]

var hit = collide(point, circle, radius)
console.log(hit)

You may also be interested in:

Usage

NPM

collide(point, circle, radius)

Performs a collision test with the given parameters. Returns true if collision occurred.

Point and circle are expected to be 2D vectors in the form of an array.

If the radius is zero, this test will return false.

License

MIT, see LICENSE.md for details.