2d-polygon-contains-polygon
Version:
test if a polygon completely contains another polygon
46 lines (29 loc) • 835 B
Markdown
test if a polygon completely contains another polygon
this can useful when computing whether or not a polygon is a hole or island.
This library is not highly optimized, but should suit your needs for the general case. Hit me up if it's not fast enough and I'll see what we can do.
`npm install 2d-plolygon-contains-polygon`
```javascript
var a = [
[],
[],
[],
[]
];
var b = [
[],
[],
[],
[]
];
console.log(contains(a, b));
// output: true
```
__contains__(`container`, `contained`)
`container` and `container` are polygons represented by a 2d array (i.e. `[[x, y], [x, y], ]`)
returns `true` if `contained` is contained in `container`, and `false` otherwise.
## license
[MIT](LICENSE.txt)