Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
point-in-polygon-hao
Advanced tools
A point in polygon based on the paper Optimal Reliable Point-in-Polygon Test and Differential Coding Boolean Operations on Polygons
Based on the paper Optimal Reliable Point-in-Polygon Test and Differential Coding Boolean Operations on Polygons
Install via npm install point-in-polygon-hao
const inside = require('point-in-polygon-hao')
const polygon = [ [ [ 1, 1 ], [ 1, 2 ], [ 2, 2 ], [ 2, 1 ], [ 1, 1 ] ] ];
inside([ 1.5, 1.5 ], polygon)
// returns true
inside([ 4.9, 1.2 ], polygon)
// returns false
inside([1, 2], polygon)
// returns 0 to indicate on edge
Some rough comparisons to similar libraries.
While point-in-polygon
is slightly faster in most cases it does not support polygons with holes or degenerate polygons.
// For a point in bounding box check
point-in-poly-hao x 29,365,704 ops/sec ±1.30% (90 runs sampled)
turf-point-in-polygon x 7,142,567 ops/sec ±0.61% (93 runs sampled)
point-in-polygon x 42,339,450 ops/sec ±0.78% (95 runs sampled)
robust-point-in-polygon x 20,675,569 ops/sec ±0.65% (95 runs sampled)
// For a point in a much larger geometry (700+ vertices)
point-in-poly-hao x 474,180 ops/sec ±0.55% (93 runs sampled)
turf-point-in-polygon x 214,584 ops/sec ±0.74% (95 runs sampled)
point-in-polygon x 489,649 ops/sec ±0.75% (91 runs sampled)
robust-point-in-polygon x 376,268 ops/sec ±0.79% (89 runs sampled)
FAQs
A point in polygon based on the paper Optimal Reliable Point-in-Polygon Test and Differential Coding Boolean Operations on Polygons
The npm package point-in-polygon-hao receives a total of 165,098 weekly downloads. As such, point-in-polygon-hao popularity was classified as popular.
We found that point-in-polygon-hao demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.