An adaptation of the original pointinpolygon algorithm developed in php at assemblysys.com
npm install assemblysys-point-in-polygonnpm install assemblysys-point-in-polygonassemblysys-point-in-polygon into any files that depend on the functionjs
import * as pointInPolygon from 'assemblysys-point-in-polygon';`Call the function anywhere you want to use it
`jsimport * as pointInPolygon from 'assemblysys-point-in-polygon';
let polygon = [[0,0],[4,0],[4,4],[0,4]];
let result1 = pointInPolygon([1,1],polygon);//Should return inside
let result2 = pointInPolygon([1,5],polygon);//Should return outside
let result3 = pointInPolygon([0,3],polygon);//should return boundary
let result4 = pointInPolygon([0,0],polygon);//Should return vertex
let result4 = pointInPolygon([0,0],polygon,false);//Should return outside
`You can also optionally specify the minimum and maximum x and y coordinates for the polygon to speed up mass processing
`js
let polygon = [[0,0],[4,0],[4,4],[0,4]];
let result4 = pointInPolygon([5,5],polygon,true,0,4,0,4);//Should return outside
``