{"name":"polygon-clipping","version":"0.13.0","description":"Apply boolean Polygon clipping operations (intersection, union, difference, xor) to your Polygons & MultiPolygons.","main":"dist/polygon-clipping.cjs.js","module":"dist/polygon-clipping.esm.js","browser":"dist/polygon-clipping.umd.js","scripts":{"build":"rollup -c","docs:build":"cd docs && rollup -c --environment NODE_ENV:production","docs:watch":"cd docs && rollup -c -w","docs:start":"cd docs && serve .","docs:dev":"npm-run-all --parallel docs:start docs:watch","docs:lint":"cd docs && eslint --ext .js --ext .vue *config.js src/","lint":"eslint *.config.js src/ test/ bench/","test":"jest","test:debug":"node --inspect-brk node_modules/.bin/jest --runInBand","bench":"node bench/bench.js","prepublishOnly":"npm-run-all --serial lint docs:lint test build docs:build bench"},"browserslist":["> 0.25% or not dead"],"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":{"@babel/cli":"^7.2.3","@babel/core":"^7.2.2","@babel/preset-env":"^7.3.1","@turf/difference":"^5.1.5","@turf/intersect":"^5.1.6","@turf/union":"^5.1.5","babel-jest":"^24.0.0","benchmark":"^2.1.4","coveralls":"^3.0.2","eslint":"^5.12.1","eslint-plugin-vue-libs":"^3.0.0","jest":"^24.0.0","load-json-file":"^5.1.0","martinez-polygon-clipping":"^0.5.0","npm-run-all":"^4.1.5","rollup":"^1.1.2","rollup-plugin-babel":"^4.3.2","rollup-plugin-commonjs":"^9.2.0","rollup-plugin-json":"^3.1.0","rollup-plugin-node-resolve":"^4.0.0","rollup-plugin-terser":"^4.0.3","rollup-plugin-vue":"^4.6.2","serve":"^10.1.1","vue-template-compiler":"^2.5.22"},"dependencies":{"splaytree":"^2.0.3"},"gitHead":"a99b4da532573fed85787051ed91586aaea90f61","bugs":{"url":"https://github.com/mfogel/polygon-clipping/issues"},"homepage":"https://github.com/mfogel/polygon-clipping#readme","_id":"polygon-clipping@0.13.0","_nodeVersion":"11.8.0","_npmVersion":"6.7.0","dist":{"integrity":"sha512-QBO0HZHUuC//0GX5HiNbMTpxdEoi+zIMVX5AiUDJXtYXNo80o9GAidFajkL8kjGSe150SbQyZnXLHI8gQfDaBw==","shasum":"07a27cbd457b95c1f8d77e218609b4df9839e8c2","tarball":"http://registry-npm.ywwl.com/polygon-clipping/download/polygon-clipping-0.13.0.tgz","fileCount":9,"unpackedSize":360102,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcdUq+CRA9TVsSAnZWagAASxUP+gI+31Kl7m0UGM9MnEhY\nvrPwXdQfXKKwgr/EN9rRQ40la4QdytLL7ThnBLyppFtdw99QMY5CBygM71wX\nhvxvCrlw5TmOAtIoQ67CxW50k/HSclj5GrPZ89DgsONoTw84rJUJLW9FZkb9\nwTapExpZwh7LVqzqxT3qipCb6U4k5+zald0JXKvWV1lYgLxeQv8kfeiaiFKk\n+5+hvfA/WF97L+LQk8e17HYwPUYlEiyA+KhbQR/FT04TiYmHiwxksxG8xect\n7GGpRENwuJqMyITeXOSKUgvUK0y3BfK3GATnfngAgnB7mTVvL8GgYxVnu2dw\nPBmwyZ6lxCGMU7VEUnSuMRGxwC5ndM0oYVzhHOenZiGyvbIp2KoImqD5VkEI\ns2KANhwRdMoSNQtopTKd64ou6T6estfRpyVvNuR9/gkiP9ue9A01sQJPkqCD\nYP5l4EcLW5h+V5WyfLsVI+qcD9C83BH0hTCFcbHjNcswps20bScfpTohafRf\nre+EIki2OG+nU4STz/B+AoRpHR8oejsfKzt4e3ShkW+qAk1alugJM9taLmsf\nGK+jAGQQuKNSEDh0ycmsKrpOkaovclLBLJ+8QFB8D6WD5rsM1NcAXPee/M8m\nLGdOhHuMCcUImySPVveZus3ZkGZYHhiQVaB5qXXiT8QPyLvTXwsF/hx6I3zL\n5zxw\r\n=Tay2\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIBCQLcmaT7Rx34ZgwNM86MZG/79Kjhotz1hNYpYyahkwAiEA1VzSL6qFJGuImJMkC77A5g3Zw05jgosewT3FRe9OcgU="}],"size":93150,"noattachment":false,"key":"/polygon-clipping/-/polygon-clipping-0.13.0.tgz"},"maintainers":[{"name":"mfogel","email":"mike@fogel.ca"}],"_npmUser":{"name":"mfogel","email":"mike@fogel.ca"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/polygon-clipping_0.13.0_1551190717556_0.6455577644589148"},"_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":1551190717651,"_cnpm_publish_time":1551190717651,"dist-tags":{"latest":"0.15.7"}}