{"_id":"split-polygon","_rev":"15-022487e7bd0b046020ae68b0e25c913c","name":"split-polygon","description":"Splits a convex polygon by a plane","dist-tags":{"latest":"1.0.0"},"versions":{"0.0.0":{"name":"split-polygon","version":"0.0.0","description":"Splits a polygon by a plane","main":"clip-poly.js","directories":{"test":"test"},"dependencies":{"robust-dot-product":"~0.0.0","robust-sum":"~0.0.2"},"devDependencies":{"tap":"~0.4.4","tape":"~1.1.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"_id":"split-polygon@0.0.0","dist":{"shasum":"db69889f3870cf588e169db61cb8aa2c08bbea89","tarball":"https://registry.npmjs.org/split-polygon/-/split-polygon-0.0.0.tgz","integrity":"sha512-w1BKyhr8Com80m35gbHK+U/3hbL1R+fvxdxD2F0gqqJ9jNby6cSbmTFtgD0PxXvdokUTt2lEf9kmZEO6/WgsMg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH5GY0CxcD8kdNCcJLVGEAmjWlxNc4EVbZyq98eJ3HeTAiA71oIHCLRRNYpwxZPDqq3KHmgbM2bkUcIHJJ9z4VpY2A=="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"0.0.1":{"name":"split-polygon","version":"0.0.1","description":"Splits a polygon by a plane","main":"clip-poly.js","directories":{"test":"test"},"dependencies":{"robust-dot-product":"~0.0.0","robust-sum":"~0.0.2"},"devDependencies":{"tap":"~0.4.4","tape":"~1.1.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"_id":"split-polygon@0.0.1","dist":{"shasum":"07da7793a2554f86ec3724e92981332f74ebf972","tarball":"https://registry.npmjs.org/split-polygon/-/split-polygon-0.0.1.tgz","integrity":"sha512-21g5lC/DrhiXq2iJaExZ+FZLaYoON+970qNS/Xfby783pcMaP6NqiQj49yYQdz8coLe8+BMYEHLy99l7Rv40sA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCiR/oOWt0zxiPijEd7lsVsWaCoMiSAZ+RVPCryGoTDxQIgDsX2Z2w2mqUOcHrb8LDfC/GGNyLlafk2tiRwv2JqjAg="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"0.0.2":{"name":"split-polygon","version":"0.0.2","description":"Splits a polygon by a plane","main":"clip-poly.js","directories":{"test":"test"},"dependencies":{"robust-dot-product":"~0.0.0","robust-sum":"~0.0.2"},"devDependencies":{"tap":"~0.4.4","tape":"~1.1.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"_id":"split-polygon@0.0.2","dist":{"shasum":"9e5d5d08b45b46ad1d3e26694804da054a235c93","tarball":"https://registry.npmjs.org/split-polygon/-/split-polygon-0.0.2.tgz","integrity":"sha512-9XeE1XUlgD9Wdo1Gz/IKpcAt413ck6IPNKYocqIQRBhf8g+8MVwXw6WiLFWPSNr8pFbTINzJbou2bAO0UtV8aA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICwkGJTJDWktYrV4lGvs8ONuxDTVlVmNHUv5aQgf+N/zAiEA5WstygoXZvag51Dlet9UZTmGReectyswmIv6SoyIVDs="}]},"_from":".","_npmVersion":"1.3.8","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"0.0.3":{"name":"split-polygon","version":"0.0.3","description":"Splits a convex polygon by a plane","main":"clip-poly.js","directories":{"test":"test"},"dependencies":{"robust-dot-product":"~0.0.0","robust-sum":"~0.0.2"},"devDependencies":{"tap":"~0.4.4","tape":"~1.1.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"homepage":"https://github.com/mikolalysenko/split-polygon","_id":"split-polygon@0.0.3","dist":{"shasum":"27b6be72c8c6afa8f6eca7bdfa8d5ee6e7d21bb0","tarball":"https://registry.npmjs.org/split-polygon/-/split-polygon-0.0.3.tgz","integrity":"sha512-77LwD4AlV17/9TnbSeIEhm3xHvxZIsl86DJSjnt81YXrCGhFPt5kYQa/1ZyzNRgfBYzpN2blu0tZralU56xvwA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD6F0xa1dJZ14eQOfFgHep458ko4ZuhTqqStTp2AnATDwIhANNwZAHTZTYYh61ECwdHYGkCuJGUZApqiJUcFvqj/1iA"}]},"_from":".","_npmVersion":"1.3.14","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.0.0":{"name":"split-polygon","version":"1.0.0","description":"Splits a convex polygon by a plane","main":"clip-poly.js","directories":{"test":"test"},"dependencies":{"robust-dot-product":"^1.0.0","robust-sum":"^1.0.0"},"devDependencies":{"tap":"~0.4.4","tape":"~1.1.1"},"scripts":{"test":"tap test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"homepage":"https://github.com/mikolalysenko/split-polygon","_id":"split-polygon@1.0.0","dist":{"shasum":"0eacc8a136a76b12a3d95256ea7da45db0c2d247","tarball":"https://registry.npmjs.org/split-polygon/-/split-polygon-1.0.0.tgz","integrity":"sha512-nBFcgQUVEE8dcOjuKaRdlM53k8RxUYpRxZ//n0pHJQGhbVscrsti+gllJI3pK3y7fgFwGWgt7NFhAX5sz0UoWQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCP/Ecjxu9F4Y4rkhI5j9wgplFgGRAwKc5KsaCxBE5kpAIgLqFZET7AulVe6v3g8D2/TFK9uNSiZdGy5nG0VhMwGMI="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]}},"readme":"split-polygon\n=============\nSplits a *convex* polygon by a plane into two parts (or optionally clips the polygon against a single plane) using the Sutherland-Hodgman algorithm.  Works in arbitrary dimensions, both in the server and the browser\n\n## Install\n\n    npm install split-polygon\n\n## Example\n\n```javascript\nvar splitPolygon = require(\"split-polygon\")\n\nvar poly = [[1,2], [3,4], [0,0]]\n\nvar parts = splitPolygon(poly, [0, 1, 3])\n\nconsole.log(parts.positive)\nconsole.log(parts.negative)\n```\n\n## API\n\n```javascript\nvar splitPolygon = require(\"split-polygon\")\n```\n\n### `splitPolygon(poly, plane)`\nSplits the *convex* polygon `poly` against plane into two parts, one above the plane and the other below it.  The equation for the plane is determined by:\n\n```javascript\nfunction planeDistance(x) {\n  return plane[0] * x[0] + plane[1] * x[1] + ... + plane[n-1] * x[n-1] + plane[n]\n}\n```\n\nPoints above the plane are those where `planeDistance(x) >= 0` and below are those with `planeDistance(x) <= 0`\n\n* `poly` is a *convex* polygon\n* `plane` is the plane\n\n**Returns** An object with two properties:\n\n* `positive` is the portion of the polygon above the plane\n* `negative` is the portion of the polygon below the plane\n\n### `splitPolygon.positive(poly, plane)`\nSame result as splitPolygon, except only returns the positive part.  This saves a bit of memory if you only need one side.\n\n### `splitPolygon.negative(poly, plane)`\nDitto, except returns only the negative part.\n\n## Credits\n(c) 2013 Mikola Lysenko. MIT License","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2022-06-26T22:57:51.938Z","created":"2013-10-10T04:55:38.081Z","0.0.0":"2013-10-10T04:55:39.522Z","0.0.1":"2013-10-10T06:45:17.042Z","0.0.2":"2013-10-10T06:47:09.812Z","0.0.3":"2014-02-28T20:53:33.632Z","1.0.0":"2014-06-19T15:20:06.810Z"},"author":{"name":"Mikola Lysenko"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/split-polygon.git"},"keywords":["split","polygon","clip","sutherland-hodgman","3d","2d","graphics"],"bugs":{"url":"https://github.com/mikolalysenko/split-polygon/issues"},"license":"MIT","readmeFilename":"README.md","homepage":"https://github.com/mikolalysenko/split-polygon"}