{"name":"polyclip-ts","version":"0.16.3","keywords":["polygon","clipping","boolean","intersection","union","difference","xor","geometry","martinez"],"author":{"name":"Luiz Felipe Machado Barboza"},"license":"MIT","_id":"polyclip-ts@0.16.3","homepage":"https://github.com/luizbarboza/polyclip-ts#readme","bugs":{"url":"https://github.com/luizbarboza/polyclip-ts/issues"},"dist":{"shasum":"fcba6ad9cbf9ce0e859898e12d77783bab4c67a6","tarball":"http://registry-npm.ywwl.com/polyclip-ts/download/polyclip-ts-0.16.3.tgz","fileCount":35,"integrity":"sha512-qvmV7qhaP5P+OnFqBe+gQDPCQx/PuhfITQOIX9cEtgiyLRfgrXrCLi3SOg71UEQCeuVDaMYJ/08xvFTNneYxiA==","signatures":[{"sig":"MEUCIQD+jbSHqqFyAqRZubBMFAXv2zswO2JiuzCLgZelnM0fuwIgOj1KrzvJJEUs14IEqXoYhns70zrlFEjmp6CmySUycHM=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":281621,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkSh8DACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpIiA//du7ATeFQvmxb8EcBP58D+Ot4fQQtcVKC3jQYefaAL4EdlzAX\r\nSJA6HCoZcnNIQJDGXhCqH5yvLf4rUhOwyVr7w7ClhVvKqhmNFNRqqYIiSVup\r\nzCDYaD+zceDSldQola1z1+NZ0/NVnWl9BJXPdmM8VsUg9s2yWctT8iINlTWn\r\nJ8TUsLRXmy/Xn6Va3uhF07O7ofGV0lf5/r1jSRQU3he1T/hhmrZljoUVajen\r\ni3YvXVkn26jvJMP7LoMfTVi21Y4AyubmzX8yxXxlvSwrnWk7O6hEL7z76hGi\r\nVuouRwnRv5i/R6BVGeeRARWyD7m3RyEOzw5ZC+HSKNtXnorS2x74XBkA5DnH\r\nddvZRygzVFBy846Mi1E526bc5JQEG3Dr2EvSHawrnNutBU0mDllNrpSSOK9M\r\nFKdbZ1aoBzJcsK4uwR7LTrWDfFuO35GtM3NIouJCmLxTDdKyQRMA/NoiiXq+\r\nKH+ID76eoDLRk9L70y2mdbq5p4uQPR9Tncg42a0UunB8ptzQWNBS53PCsDOH\r\nyrnKIxAHaXhaxDVQgHqmUAX4zskmNPkJt810Xq4fvMdP7m8AzbSETxcwN3Sh\r\nDIRFT6AjEaHiL5Yk0jgwR0NXQQHTKt8oTPeRv86y9Bc17tOTs6SVua03PgsR\r\nrR/tjd8XlYtm8pyCNyS1v0LuMq52UheEUdU=\r\n=5Km/\r\n-----END PGP SIGNATURE-----\r\n","size":72229,"noattachment":false,"key":"/polyclip-ts/-/polyclip-ts-0.16.3.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":"461133372a531d7775c5648f0fb8998ad968a1f7","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","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":"luizbarboza","email":"contact@luizbarboza.com"},"jsdelivr":"dist/polyclip-ts.umd.min.js","repository":{"url":"git+https://github.com/luizbarboza/polyclip-ts.git","type":"git"},"_npmVersion":"8.19.3","description":"Apply boolean polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.","directories":{},"_nodeVersion":"19.1.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":"^0.4.1","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.3_1682579203110_0.6408279407610609","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":1682579203278,"maintainers":[{"name":"luizbarboza","email":"contact@luizbarboza.com"}],"_cnpm_publish_time":1682579203278,"dist-tags":{"latest":"0.16.8"}}