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) • 401 B
JavaScript
var polygonBox = require('./polygon-box')
/**
* box-polygon collision
* @param {number} xb top-left corner of box
* @param {number} yb top-left corner of box
* @param {number} wb width of box
* @param {number} hb height of box
* @param {number[]} points of polygon
*/
module.exports = function boxPolygon(xb, yb, wb, hb, points)
{
return polygonBox(points, xb, yb, wb, hb)
}