{"name":"polyclip-ts","version":"0.16.0","keywords":["polygon","clipping","boolean","intersection","union","difference","xor","geometry","martinez"],"author":{"name":"Luiz Felipe Machado Barboza"},"license":"MIT","_id":"polyclip-ts@0.16.0","homepage":"https://github.com/SBanksX/polyclip-ts#readme","bugs":{"url":"https://github.com/SBanksX/polyclip-ts/issues"},"dist":{"shasum":"f80a5ba304386eb57c3c31c45321fb068a71a00d","tarball":"http://registry-npm.ywwl.com/polyclip-ts/download/polyclip-ts-0.16.0.tgz","fileCount":50,"integrity":"sha512-/tY0ORcONJev61AkGIjCosO+obMh/E2Ze+Ukly3tFwHXYgx/7jB6bgOmJquZxVh4BlNnC6a19U9UYod1GJ71dA==","signatures":[{"sig":"MEYCIQClpvQin6iar45hsLVzF/t75tD9DxRty4dDjQIobEWrTQIhAI9wNkbphTlEhw1ypKTlxdLIsOBFtc5//DYhxTuqhmM6","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":339286,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjSGd6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrdQg//Wg3jGlqMh2bgHmo4iTm/nPNBUaX/PK/ah6OjB1jSmaeM7O8Y\r\n+eIdZiSkXkhp2W9OReCg1HFgoMcIF+udRMxZTjt25crVJ3dIZ4HEzlnCWUBX\r\nqHij0MRl5AZhx8JcrP/kk33lVdkXq/X5ZM4eAaBo5d6uFwEGRrbn90ERvhTT\r\nqZTcyLNq0gQJ5Tk1E1WG8oA/5WBaXB6AsO/YrGVMhvhpkwBPtIST6mJmyjoB\r\niMHEGaSQvzh6yseinP08LMeD8R7k8feKQ+ZIlutPB0sJ2ZXOpkYKTb/QyPZ/\r\nPcdmkCIAFV2Wcct9CLyz2qKXgjsk2Z9NqC/l5+GUu6fNpBzj/O9e1wS3m7uw\r\nfBRV6UUD8Ho/C9ZxprvblsC3XDsxeWVCeaSyUG6wNTJCJBvvACbn4+ayWmlb\r\nUWpUDor+UqSKCpY0SmTbErrrpEvXkAUS24JWzo1lmy7qWRoQzwFAYs/knCrj\r\nXZG2TB1LBLFyfW/a/hmzzl2Vwc7PCh0gbHjLWyQUgo/3lJfMbIaax1Rs3yCD\r\nUo99B8RBgtXjCjpww39Dd88GC7uWDn3UbwE6u2w82o8pCb/H5qy3TlOy8OLe\r\ndEkXvJ38X++hRWWriiyRH26uLHIu+aBq9RZvsiid+ew/ZmSDh2cPvya2dH+x\r\nzWB6cRgsZ13EblUINiCjdbhn0Y/9a26+y10=\r\n=SeZ9\r\n-----END PGP SIGNATURE-----\r\n","size":85398,"noattachment":false,"key":"/polyclip-ts/-/polyclip-ts-0.16.0.tgz"},"main":"dist/index.js","type":"module","types":"types/index.d.ts","unpkg":"dist/polyclip-ts.umd.js","module":"dist/index.js","exports":{"umd":"./dist/polyclip-ts.umd.js","default":"./dist/index.js"},"gitHead":"e81b8e92d46293e0edfea1080950d1911a999779","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","test:jest":"jest","test:lint":"eslint src","prepublishOnly":"npm run test && npm run build","test:typecheck":"tsc --noEmit"},"_npmUser":{"name":"sbanksx","email":"luiz.barboza2002@gmail.com"},"jsdelivr":"dist/polyclip-ts.umd.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.0"},"_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.0_1665689466192_0.9345473110329445","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":1665689466363,"maintainers":[{"name":"luizbarboza","email":"contact@luizbarboza.com"}],"_cnpm_publish_time":1665689466363,"dist-tags":{"latest":"0.16.8"}}