{"name":"polygon-clipping","version":"0.8.0","description":"Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.","main":"dist/polygon-clipping.js","module":"main.js","scripts":{"build:docs":"cross-env NODE_ENV=production webpack --config docs/webpack.config.js --mode production --progress --hide-modules","build:lib":"webpack --mode development --progress --hide-modules","build:min":"webpack --mode production --output-filename polygon-clipping.min.js --progress --hide-modules","dev:docs":"cross-env webpack-dev-server --config docs/webpack.config.js --mode development --open --hot","test":"jest","test:debug":"node --inspect-brk node_modules/.bin/jest --runInBand","bench":"node bench/bench.js","prepublishOnly":"npm test && npm run build:docs && npm run build:lib && npm run build:min"},"jest":{"collectCoverage":true,"testEnvironment":"node"},"keywords":["polygon","clipping","boolean","intersection","union","difference","xor","geometry","martinez"],"repository":{"type":"git","url":"git+https://github.com/mfogel/polygon-clipping.git"},"author":{"name":"Mike Fogel","email":"mike@fogel.ca"},"license":"MIT","devDependencies":{"@turf/union":"^4.6.0","babel-jest":"^23.0.0","babel-loader":"^7.1.4","babel-preset-env":"^1.6.1","benchmark":"^2.1.4","coveralls":"^3.0.0","cross-env":"^5.1.4","css-loader":"^0.28.11","eslint":"^4.19.1","eslint-plugin-vue-libs":"^2.1.0","file-loader":"^1.1.11","jest":"^22.1.4","load-json-file":"^2.0.0","martinez-polygon-clipping":"^0.3.3","raw-loader":"^0.5.1","vue":"^2.5.16","vue-loader":"^14.2.2","vue-template-compiler":"^2.5.16","webpack":"^4.10.2","webpack-cli":"^2.1.4","webpack-dev-server":"^3.1.4"},"dependencies":{"babel-plugin-add-module-exports":"^0.2.1","splaytree":"^2.0.2","tinyqueue":"^1.2.3"},"gitHead":"435a2e75c722c86d7b4d3ad1c5a7d76073048475","bugs":{"url":"https://github.com/mfogel/polygon-clipping/issues"},"homepage":"https://github.com/mfogel/polygon-clipping#readme","_id":"polygon-clipping@0.8.0","_npmVersion":"6.2.0","_nodeVersion":"10.9.0","_npmUser":{"name":"mfogel","email":"mike@fogel.ca"},"dist":{"integrity":"sha512-OF+PT2Mhv3HbOa1oM6ewDQ8Ke0MxDYA4YHQIOY2/Pldv6SXKENwgL1i1yn0CVk7MqxLs8vAgvjmYDIiWOI5Ctg==","shasum":"89d8f6721be6b37a4f5d2964fcaa68a18abefb29","tarball":"http://registry-npm.ywwl.com/polygon-clipping/download/polygon-clipping-0.8.0.tgz","fileCount":187,"unpackedSize":6548371,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbiHLtCRA9TVsSAnZWagAAWCIP/3yYZONCsVuO61he/It3\nZPM52neevAWfuDjND94kIYS7dmlS4+sH1Bj7D7KrNXEzE5dRtGMTu5FGRn+A\n1QZ5XPb++vEVRVcbsnQoY5dAlkD67gKnznNZ4D+mz31kkdoLR/1CpW7ohk7/\nbSZUXO1W/tip4Ehg6NTFq+bTdkUrts80l9PEYQMelAzkVll3q23ycXdtASjd\nIzn3yfGeaN05LAqgFexz0KsOB04eie0uSctmja0BRVp2Zr/+5SrOhrNia9jl\nEScc6sQOEUIuPhvWfJjgkDbR8khVtRa/BXki2DVniRflSgcW/u4uCN8Yw6nT\n+SkzDugVDUi3LXN/vkKsxxGNb7aCD+dFBrDlXHQiPAEF+7b78pmdkcuSzvLT\nJdePGyBHmE56XtZizEHXKR12NvcXCa4UsK6VgNxbMSVnakcZzsod+kYPwob+\nKpfsGPEPfOQsZNeLpvqBmerAkeBt3KVB5wvNzNy3ey6h2baAhVeVqnOIOFf/\nqtJDMqI+MtgbjCfhugUXBOhANo3wmMLbEKyct/6GGw+/HJACNbDkrjvz46ZA\nIQfHo72hURvNSmxQioSa2AuO8YzUQ4FC7v2thEE+Sskx3lrCHXOOv/WYjNHT\nWqaw45Ca76o4zUAQjPlixDtX8WUJpdqruFGHwLHEfirTLYhA7vUktJZ938rt\n0bto\r\n=4f1K\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDD7V+3rJWxWw1J29pNsRACqRfVf26j5KX7JYEH9opERAIhANpLORi6ZHpoUgBeXFj3Y/y3PxaVFj0/yfY31NlTo3/2"}],"size":1973000,"noattachment":false,"key":"/polygon-clipping/-/polygon-clipping-0.8.0.tgz"},"maintainers":[{"name":"mfogel","email":"mike@fogel.ca"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polygon-clipping_0.8.0_1535668973156_0.6493125382287708"},"_hasShrinkwrap":false,"readme":"# polygon-clipping\n\nApply boolean Polygon clipping operations (`intersection`, `union`, `difference`, `xor`) to your Polygons & MultiPolygons.\n\n[![CI](https://github.com/mfogel/polygon-clipping/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/mfogel/polygon-clipping/actions) [![codecov](https://codecov.io/gh/mfogel/polygon-clipping/branch/main/graph/badge.svg?token=is93inDQiJ)](https://codecov.io/gh/mfogel/polygon-clipping) [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT) [![npm](https://img.shields.io/npm/v/polygon-clipping.svg)](https://www.npmjs.com/package/polygon-clipping)\n\n## Quickstart\n\n<!-- prettier-ignore-start -->\n```javascript\nconst polygonClipping = require('polygon-clipping')\n\nconst poly1 = [[[0,0],[2,0],[0,2],[0,0]]]\nconst poly2 = [[[-1,0],[1,0],[0,1],[-1,0]]]\n\npolygonClipping.union       (poly1, poly2 /* , poly3, ... */)\npolygonClipping.intersection(poly1, poly2 /* , poly3, ... */)\npolygonClipping.xor         (poly1, poly2 /* , poly3, ... */)\npolygonClipping.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\npolygonClipping.union       (<geom>, ...<geoms>)\npolygonClipping.intersection(<geom>, ...<geoms>)\npolygonClipping.xor         (<geom>, ...<geoms>)\n\n/* The clipGeoms will be subtracted from the subjectGeom */\npolygonClipping.difference(<subjectGeom>, ...<clipGeoms>)\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## Settings\n\nGlobal settings are set via environment variables.\n\n- **POLYGON_CLIPPING_MAX_QUEUE_SIZE** and **POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS**: Aims to prevent infinite loops - usually caused by floating-point math round-off errors. Defaults are 1,000,000.\n\n## Changelog\n\nThis project adheres to [Semantic Versioning](https://semver.org/).\n\n<!-- prettier-ignore-end -->\n\nThe full changelog is available at [CHANGELOG.md](https://github.com/mfogel/polygon-clipping/blob/master/CHANGELOG.md).\n\n## Authors\n\n- [Mike Fogel](https://github.com/mfogel)\n- [Alexander Milevski](https://github.com/w8r)\n- [Vladimir Ovsyannikov](https://github.com/sh1ng)\n\n## Sponsors\n\n- [Alantgeo](https://www.alantgeo.com.au/)\n- [EasyTerritory](https://www.easyterritory.com/)\n\nPlease contact [Mike Fogel](https://github.com/mfogel) if you or your company is interested in sponsoring work on specific bug fixes or feature requests.\n\n## Based on\n\n- [A new algorithm for computing Boolean operations on polygons](paper.pdf) by Francisco Martinez, Antonio Jesus Rueda, Francisco Ramon Feito (2009)\n","publish_time":1535668973381,"_cnpm_publish_time":1535668973381,"dist-tags":{"latest":"0.15.7"}}