UNPKG

277 BJavaScriptView Raw
1var pointInPolygon = require('../');
2var polygon = [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ] ];
3
4console.log(pointInPolygon([ 1.5, 1.5 ], polygon)); // true
5console.log(pointInPolygon([ 4.9, 1.2 ], polygon)); // false
6console.log(pointInPolygon([ 1.8, 1.1 ], polygon)); // true