intersects
Version:
a simple collection of 2d collision/intersects functions, supporting points, circles, circle outlines (circumference), lines, axis-aligned boxes, and polygons (convex)
17 lines (14 loc) • 465 B
JavaScript
var polygonCircle = require('./polygon-circle')
/**
* circle-polygon collision
* from http://stackoverflow.com/a/402019/1955997
* @param {number} xc center of circle
* @param {number} yc center of circle
* @param {radius} rc radius of circle
* @param {number[]} points [x1, y1, x2, y2, ... xn, yn] of polygon
*/
module.exports = function circlePolygon(xc, yc, rc, points, tolerance)
{
return polygonCircle(points, xc, yc, rc, tolerance)
}