npm install
npm test
Algorithms for reporting intersections between bounding boxes.
Use like:
var alg = intersectionAlgorithm(),
S = [bbox_1, bbox_2, ... bbox_n],
reportPair = function (i, j) {
// do something with i and j, the indices of the intersecting bounding boxes
// note that duplicates may be reported
};
// Report the intersecting bounding boxes
alg(S, reportPair);
The naive algorithm, with run-time O(n^2).
var naive = naive();
A tile-based algorithm, that first breaks the space into tiles, before running the naive algorithm on each tile.
// Subdivide the x-space twice, into 4 partitions of equal width
// Subdivide the y-space four times, into 16 partitions of equal height.
var tiled = tiled().xdepth(2).ydepth(4);
A theoretically optimal algorithm
var neudev = neudev();