pointcirclecollision
v1.0.5
Published
test for collision with a circle and point
Downloads
3
Readme
pointCircleCollision
Performs a point-circle collision test, returning true if they collide. Inspired from Matt Desl's point-circle-collision point-circle-collision node.
const collision = require('./pointCircleCollision.js');
let p = {
x: 100,
y: 100
}
let c = {
x: 120,
y: 120,
radius: 100
}
let hit = collision(p.x, p.y, c.x, c.y, c.radius);
console.log(hit);
Usage
pointCircleCollision(pointX, pointY, circleX, circleY, circleRadius)
Performs a collision test with the given parameters. Returns true if collision occurred.
Expects the x and y coordinates for the point and circle, and the circle's radius.
If the radius is zero, this test will return false.
License
MIT