This package has been deprecated

Author message:

DEPRECATED: use line-circle-collision instead

circle-line-collision

1.0.1 • Public • Published

browser support

line-circle-collision

stable

Performs a line-circle collision test, returning true if they intersect. Algorithm from 2D Game Collision by Thomas Schwarzl.

var collide = require('line-circle-collision')
 
var circle = [5, 5],
    radius = 25,
    a = [5, 6],
    b = [10, 10]
 
var hit = collide(a, b, circle, radius)
console.log(hit)

Usage

NPM

collide(a, b, circle, radius)

Performs a collision test with the line a-b and the given circle. Returns true if collision occurred.

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

License

MIT, see LICENSE.md for details.

Package Sidebar

Install

npm i circle-line-collision

Weekly Downloads

2

Version

1.0.1

License

MIT

Last publish

Collaborators

  • mattdesl