JSPM

bounding-box-overlap-test

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 25
  • Score
    100M100P100Q87085F
  • License BSD

test if two n-dimensional bounding boxes overlap

Package Exports

  • bounding-box-overlap-test

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 (bounding-box-overlap-test) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

bounding-box-overlap-test

test if two n-dimensional bounding boxes overlap

example

var overlap = require('bounding-box-overlap-test')
var a = [ [3,8], [-15,-11], [100,110] ]
var b = [ [1,5], [-12,-5], [80,140] ]
var c = [ [-4,6], [-10,0], [70,90] ]
console.log(overlap(a, b)) // true
console.log(overlap(a, c)) // false
console.log(overlap(b, c)) // true

api

var overlap = require('bounding-box-overlap-test')

overlap(a, b, opts={})

Return whether the bounding box a intersects the bounding box b.

Bounding boxes are arrays of 2-element [min,max] array pairs, one for each coordinate.

  • opts.cmp(a, b) - provide your own custom comparison function or array of comparison functions

Comparison functions should return -1, 0, or 1 for less than, equal to, and greater than cases, respectively.

If opts.cmp is an array, each item in the array should be a comparison function for the respective dimension.

install

npm install bounding-box-overlap-test

license

BSD