JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 154
  • Score
    100M100P100Q137823F
  • License MIT

line-circle collision test

Package Exports

  • line-circle-collision

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (line-circle-collision) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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.