{"name":"polyclip-ts","version":"0.16.2","keywords":["polygon","clipping","boolean","intersection","union","difference","xor","geometry","martinez"],"author":{"name":"Luiz Felipe Machado Barboza"},"license":"MIT","_id":"polyclip-ts@0.16.2","homepage":"https://github.com/SBanksX/polyclip-ts#readme","bugs":{"url":"https://github.com/SBanksX/polyclip-ts/issues"},"dist":{"shasum":"0b1274e0b9f8331286ff79f266e6f6b0fec44b73","tarball":"http://registry-npm.ywwl.com/polyclip-ts/download/polyclip-ts-0.16.2.tgz","fileCount":50,"integrity":"sha512-Nixz21flaVUhIw8gvThbKHW22xjjkqcocF1zT0B1MOJ+AvJVUtZyg4FKy3G+Ant73VVxpTHPc3AdxiE+YCKVfQ==","signatures":[{"sig":"MEUCIQDY+OK18RNsWvHn8cXd1EnhR1GgkWKl8XpOem2ONYHflgIgdUFGtUSarqknRdLY8VdAxNM141huD933Mb5kgnonP+0=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":339025,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSJcJACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoeFA/+IrKttuOZamQciiOQqVgRvLMcVTL5BgrsGQ1Xv/Dipm+9Z41E\r\nylRCTJciLXwSx03FfnJrh+6C9quuW/VUXRnGTvJNp5r+dsj682NHfr7pDCPm\r\nvpcUOXuGIVGxTBYEjVe2SS7ap4fcwT2Po1OQPKP1cJJf+SP6tPkB5phQnPqs\r\nUoS9astNiTvnJpZaJwgETUfA/IaBeAN0lbosIOQuO2g18BkeWTcZToNF0JiT\r\nkzlAda9CGbnz0syyaLS4quDi+8WR1WebApBCadKsvFEFUJK51P8q3vXm3Sq5\r\ndgOxkLMufJdAdGMWRU/fbde+bfqG/Y9KUxO86AqaGJzpXQMga7pb6lw/HVmt\r\nAtm6xa+hXccStaRJKcJAqeWDD6OXwyrHwoNnVPEN/ECrfzTr2BY2SWRNWmdi\r\nW9YPpNnj8SC8ef/JrWgRwf0aDgVB5yRPlS43vP82gkUmwxv8QdNEFGJSqdM8\r\nxGw7NEnzFDm800sNy2tSEEtUm0X8FY2dKzN3Me5SmFXldp6XBGYz1+ntkNKe\r\nTFETgpXLwA57Pl+J98xxw/zaugcNfTZi6q6WNDS5kX96qlQdK15fcMXtBMI5\r\nV2vz14XKUwh88z4ODNILqYzyFZD+waL4iD+lxOjc4oY9YppvHsHZ1JWCIXRa\r\nCSI35Y7tEYawJ2nUtwPtQXzjn8vL8qj2ga8=\r\n=sTMq\r\n-----END PGP SIGNATURE-----\r\n","size":85379,"noattachment":false,"key":"/polyclip-ts/-/polyclip-ts-0.16.2.tgz"},"main":"dist/index.js","type":"module","types":"types/index.d.ts","unpkg":"dist/polyclip-ts.umd.min.js","module":"dist/index.js","exports":{"umd":"./dist/polyclip-ts.umd.min.js","default":"./dist/index.js"},"gitHead":"c110b7a4ed6c5db5271e626318afd1cedde31c55","scripts":{"test":"npm run test:typecheck && npm run test:lint && npm run test:jest","bench":"node bench/bench.js","build":"rollup -c && tsc --declaration true --declarationDir types","version":"npm run build && git add -A dist","test:jest":"jest","test:lint":"eslint src","preversion":"npm run test","postversion":"git push && git push --tags && npm publish","test:typecheck":"tsc --noEmit"},"_npmUser":{"name":"sbanksx","email":"luiz.barboza2002@gmail.com"},"jsdelivr":"dist/polyclip-ts.umd.min.js","repository":{"url":"git+https://github.com/SBanksX/polyclip-ts.git","type":"git"},"_npmVersion":"8.15.0","description":"Apply boolean polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.","directories":{},"_nodeVersion":"18.7.0","dependencies":{"bignumber.js":"^9.1.0","splaytree-ts":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^27.5.1","eslint":"^8.16.0","benchmark":"^2.1.4","@turf/union":"^5.1.5","@types/node":"^18.8.5","@turf/intersect":"^5.1.6","@turf/difference":"^5.1.5","@babel/preset-env":"^7.19.0","@rollup/plugin-json":"4","rollup-plugin-terser":"7","eslint-config-prettier":"^8.5.0","@babel/preset-typescript":"^7.18.6","@rollup/plugin-typescript":"^8.5.0","@typescript-eslint/parser":"^5.25.0","martinez-polygon-clipping":"^0.7.1","@rollup/plugin-node-resolve":"13","@typescript-eslint/eslint-plugin":"^5.25.0"},"_npmOperationalInternal":{"tmp":"tmp/polyclip-ts_0.16.2_1665701641352_0.8582406986311375","host":"s3://npm-registry-packages"},"readme":"# polyclip-ts\n\nApply boolean polygon clipping operations (`intersection`, `union`, `difference`, `xor`) to your Polygons & MultiPolygons.\n\n## Installing\n\nIf you use npm, `npm install polyclip-ts`. You can also download the [latest release on GitHub](https://github.com/luizbarboza/polyclip-ts/tags). For vanilla HTML in modern browsers, import polyclip-ts from Skypack:\n\n```html\n<script type=\"module\">\nimport * as polyclip from \"https://cdn.skypack.dev/polyclip-ts\";\n\npolyclip.intersection(…)\n</script>\n```\n\nFor legacy environments, you can load polyclip-ts’s UMD bundle from an npm-based CDN such as jsDelivr; a polyclip global is exported:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/polyclip-ts/dist/polyclip-ts.umd.min.js\"></script>\n<script>\npolyclip.intersection(…)\n</script>\n```\n\n## Quickstart\n\n<!-- prettier-ignore-start -->\n```javascript\nimport * as polyclip from \"polyclip-ts\"\n\nconst poly1 = [[[0,0],[2,0],[0,2],[0,0]]]\nconst poly2 = [[[-1,0],[1,0],[0,1],[-1,0]]]\n\npolyclip.union       (poly1, poly2 /* , poly3, ... */)\npolyclip.intersection(poly1, poly2 /* , poly3, ... */)\npolyclip.xor         (poly1, poly2 /* , poly3, ... */)\npolyclip.difference  (poly1, poly2 /* , poly3, ... */)\n```\n<!-- prettier-ignore-end -->\n\n## API\n\n```javascript\n/* All functions take one or more [multi]polygon(s) as input */\n\npolyclip.union       (geom, ...moreGeoms)\npolyclip.intersection(geom, ...moreGeoms)\npolyclip.xor         (geom, ...moreGeoms)\n\n/* The moreGeoms will be subtracted from the geom */\npolyclip.difference  (geom, ...moreGeoms)\n```\n\n### Input\n\nEach positional argument (`geom`) may be either a Polygon or a MultiPolygon. The [GeoJSON spec](https://tools.ietf.org/html/rfc7946#section-3.1) is followed, with the following notes/modifications:\n\n- MultiPolygons may contain touching or overlapping Polygons.\n- rings are not required to be self-closing.\n- rings may contain repeated points, which are ignored.\n- rings may be self-touching and/or self-crossing. Self-crossing rings will be interpreted using the [non-zero rule](https://en.wikipedia.org/wiki/Nonzero-rule).\n- winding order of rings does not matter.\n- inner rings may extend outside their outer ring. The portion of inner rings outside their outer ring is dropped.\n- inner rings may touch or overlap each other.\n\n### Output\n\nFor non-empty results, output will always be a MultiPolygon containing one or more non-overlapping, non-edge-sharing Polygons. The [GeoJSON spec](https://tools.ietf.org/html/rfc7946#section-3.1) is followed, with the following notes/modifications:\n\n- outer rings will be wound counter-clockwise, and inner rings clockwise.\n- inner rings will not extend outside their outer ring.\n- rings will not overlap, nor share an edge with each other.\n- rings will be self-closing.\n- rings will not contain repeated points.\n- rings will not contain superfluous points (intermediate points along a straight line).\n- rings will not be self-touching nor self-crossing.\n- rings _may_ touch each other, but _may not_ cross each other.\n\nIn the event that the result of the operation is the empty set, output will be a MultiPolygon with no Polygons: `[]`.\n\n## Correctness\n\nRun: `npm test`\n\nThe 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](https://help.github.com/articles/mapping-geojson-files-on-github/). Browse those tests [here](test/end-to-end).\n\n## Performance\n\nThe 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.\n\n## Authors\n\n- [Luiz F. M. Barboza](https://github.com/SBanksX)\n- [Mike Fogel](https://github.com/mfogel)\n- [Alexander Milevski](https://github.com/w8r)\n- [Vladimir Ovsyannikov](https://github.com/sh1ng)\n\n## Based on\n\n- [A simple algorithm for Boolean operations on polygons](https://www.sciencedirect.com/science/article/abs/pii/S0965997813000379) by Francisco Martinez, Antonio Jesus Rueda, Francisco Ramon Feito (2009)\n","publish_time":1665701641575,"maintainers":[{"name":"luizbarboza","email":"contact@luizbarboza.com"}],"_cnpm_publish_time":1665701641575,"dist-tags":{"latest":"0.16.8"}}