Package Exports
- robust-point-in-polygon
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (robust-point-in-polygon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
robust-point-in-polygon
Exactly determines if a point is contained in a 2D polygon.
Example
var classifyPoint = require("robust-point-in-polygon")
var polygon = [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ] ]
console.log(
classifyPoint(polygon, [1.5, 1.5]),
classifyPoint(polygon, [1, 2]),
classifyPoint(polygom, [100000, 10000]))Output:
-1 0 1Install
npm install robust-point-in-polygonAPI
require("robust-point-in-polygon")(loop, point)
Tests if a point is contained in the interior of a simple polygon
loopis an array of vertices for the polygonpointis a 2D point which is classified against the polygon
Returns An integer which determines the position of point relative to polygon. This has the following interpretation:
-1ifpointis contained insideloop0ifpointis on the boundary ofloop1ifpointis outsideloop
Credits
(c) 2014 Mikola Lysenko. MIT License