Determine if an x y coordinate exists in a polygon.
npm install polygon-points
npm install polygon-points --save
`
$3
`javascript
const PP = require('polygon-points');const polygonPoints = new PP([{x: 0, y: 0}, {x: 0, y: 100}, {x: 100, y: 100}, {x: 100, y: 0}]);
//public methods
//check if a point exists in the polygon
polygonPoints.containsPoint(1, 1);//returns true
//get bounding box of polygon
polygonPoints.boundingBox;//returns an array of 4 x y coordinates
//get total number of points that exist in polygon
polygonPoints.pointsLength;//returns 10000
//set vertexes after creating polygonPoints object
polygonPoints.vertexes = [{x: 0, y: 0}, {x: 0, y: 100}, {x: 100, y: 100}, {x: 100, y: 0}];
//get minX, maxX, minY, and maxY unsigned integers of bounding box
polygonPoints.minX, polygonPoints.maxX, polygonPoints.minY, polygonPoints.maxY;
``