Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
@labelbox/polygon-clipping
Advanced tools
Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.
Apply boolean Polygon clipping operations (intersection
, union
, difference
, xor
) to your Polygons & MultiPolygons.
const polygonClipping = require('polygon-clipping')
const poly1 = [[[0,0],[2,0],[0,2],[0,0]]]
const poly2 = [[[-1,0],[1,0],[0,1],[-1,0]]]
polygonClipping.union (poly1, poly2 /* , poly3, ... */)
polygonClipping.intersection(poly1, poly2 /* , poly3, ... */)
polygonClipping.xor (poly1, poly2 /* , poly3, ... */)
polygonClipping.difference (poly1, poly2 /* , poly3, ... */)
/* All functions take one or more [multi]polygon(s) as input */
polygonClipping.union (<geom>, ...<geoms>)
polygonClipping.intersection(<geom>, ...<geoms>)
polygonClipping.xor (<geom>, ...<geoms>)
/* The clipGeoms will be subtracted from the subjectGeom */
polygonClipping.difference(<subjectGeom>, ...<clipGeoms>)
Each positional argument (<geom>
) may be either a Polygon or a MultiPolygon. The GeoJSON spec is followed, with the following notes/modifications:
For non-empty results, output will always be a MultiPolygon containing one or more non-overlapping, non-edge-sharing Polygons. The GeoJSON spec is followed, with the following notes/modifications:
In the event that the result of the operation is the empty set, output will be a MultiPolygon with no Polygons: []
.
Run: npm test
The tests are broken up into unit tests and end-to-end tests. The end-to-end tests are organized as GeoJSON files, to make them easy to visualize thanks to GitHub's helpful rendering of GeoJSON files. Browse those tests here.
The Martinez-Rueda-Feito polygon clipping algorithm is used to compute the result in O((n+k)*log(n))
time, where n
is the total number of edges in all polygons involved and k
is the number of intersections between edges.
Global settings are set via environment variables.
This project adheres to Semantic Versioning.
The full changelog is available at CHANGELOG.md.
Please contact Mike Fogel if you or your company is interested in sponsoring work on specific bug fixes or feature requests.
FAQs
Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.
The npm package @labelbox/polygon-clipping receives a total of 112 weekly downloads. As such, @labelbox/polygon-clipping popularity was classified as not popular.
We found that @labelbox/polygon-clipping demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 36 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.