If the polygon is given by 3D points, set the flag hasZ to true. The z component will be discarded.
hasZ
Usage:
const polygon = [1, 1, 1, 2, 2, 2, 2, 1]console.log( pointInPolygon(1.5, 1.5, polygon)) // trueconsole.log( pointInPolygon(4.9, 1.2, polygon)) // falseconsole.log( pointInPolygon(1.8, 1.1, polygon)) // true
based on https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html
If the polygon is given by 3D points, set the flag
hasZ
to true. The z component will be discarded.Usage:
Note
based on https://wrf.ecse.rpi.edu/Research/Short_Notes/pnpoly.html