{"_id":"clean-pslg","_rev":"7-76ec163818765dfac6d5b96a97346ce5","name":"clean-pslg","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","dist-tags":{"latest":"1.1.2"},"versions":{"1.0.0":{"name":"clean-pslg","version":"1.0.0","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","main":"clean-pslg.js","directories":{"example":"example","test":"test"},"dependencies":{"big-rat":"^1.0.1","box-intersect":"^1.0.1","compare-cell":"^1.0.0","nextafter":"^1.0.0","rat-vec":"^1.1.0","robust-segment-intersect":"^1.0.1","union-find":"^1.0.2","uniq":"^1.0.1"},"devDependencies":{"mouse-change":"^1.2.1","canvas-fit":"^1.4.0","robust-orientation":"^1.1.3","tape":"^4.0.0","segment2":"^0.3.2","vec2":"^1.6.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"https://github.com/mikolalysenko/clean-pslg.git"},"keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"homepage":"https://github.com/mikolalysenko/clean-pslg","gitHead":"9b379b6d28d056af8b4c2065125775a1d3d0ca2c","_id":"clean-pslg@1.0.0","_shasum":"283b13d310fb74c2c334d201e4e05338ed6ac076","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"283b13d310fb74c2c334d201e4e05338ed6ac076","tarball":"https://registry.npmjs.org/clean-pslg/-/clean-pslg-1.0.0.tgz","integrity":"sha512-pkRItkVWoPipi3yu86FF6nTPD2USl+dC83ye5mtKDE6cC060i3aQjVQF8sZts+YmLpvanbdoLWQXZK3o5f2L1Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDNXuMKVhHGDZI9n6oZeTceXtoL1Lr6WpWzDCRghw19IQIhAMeEaH7FXkGB+qHgB1l+/zJAjRNuNX41vvQ992j4WZuk"}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.0.1":{"name":"clean-pslg","version":"1.0.1","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","main":"clean-pslg.js","directories":{"example":"example","test":"test"},"dependencies":{"big-rat":"^1.0.1","box-intersect":"^1.0.1","compare-cell":"^1.0.0","nextafter":"^1.0.0","rat-vec":"^1.1.0","robust-segment-intersect":"^1.0.1","union-find":"^1.0.2","uniq":"^1.0.1"},"devDependencies":{"mouse-change":"^1.2.1","canvas-fit":"^1.4.0","robust-orientation":"^1.1.3","tape":"^4.0.0","segment2":"^0.3.2","vec2":"^1.6.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"https://github.com/mikolalysenko/clean-pslg.git"},"keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"homepage":"https://github.com/mikolalysenko/clean-pslg","gitHead":"3f632b25799ed673e21158cc2734b3cf4bc87837","_id":"clean-pslg@1.0.1","_shasum":"a2786cd38f4fbe3054b523a260247406e9331b10","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"a2786cd38f4fbe3054b523a260247406e9331b10","tarball":"https://registry.npmjs.org/clean-pslg/-/clean-pslg-1.0.1.tgz","integrity":"sha512-jez3NJZV2TIwFNJgoXFVIv4lG+NctyP/b461NSg6UbF/0HCazVkSqF2mFxSVwHFf7uPa3h7e5o81a4/LcH+YnQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGGU2TYWsGDuy1AcMjHbXNguCFWtlJ2wDrlWvf/1r3gJAiEAxTvXrqKQrGktSaAQJKLQIuhqs7tnqJFU2WaITQOviK0="}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.1.0":{"name":"clean-pslg","version":"1.1.0","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","main":"clean-pslg.js","directories":{"example":"example","test":"test"},"dependencies":{"big-rat":"^1.0.1","box-intersect":"^1.0.1","compare-cell":"^1.0.0","nextafter":"^1.0.0","rat-vec":"^1.1.0","robust-segment-intersect":"^1.0.1","union-find":"^1.0.2","uniq":"^1.0.1"},"devDependencies":{"mouse-change":"^1.2.1","canvas-fit":"^1.4.0","robust-orientation":"^1.1.3","tape":"^4.0.0","segment2":"^0.3.2","vec2":"^1.6.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"https://github.com/mikolalysenko/clean-pslg.git"},"keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"homepage":"https://github.com/mikolalysenko/clean-pslg","gitHead":"5c45878fc9f4c6606259d3a56b24efe2d4e18293","_id":"clean-pslg@1.1.0","_shasum":"11ad7583afde3c27a00af9041d4a460256b3335b","_from":".","_npmVersion":"2.7.4","_nodeVersion":"0.12.2","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"11ad7583afde3c27a00af9041d4a460256b3335b","tarball":"https://registry.npmjs.org/clean-pslg/-/clean-pslg-1.1.0.tgz","integrity":"sha512-8Vr4UACRCiVzfQ6T9989e/ai09/ivJNykeyILPaXfzb1aQzB4+/d+WhNFTNYR+6N8sXFxK+WuqsEtCDci9aTTw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDuygQxdl1BwxYv2snZIyinxcwaXEnsBF8Kz8HMqdcUKwIhAOEsUyIYRgetjtYW2rW2OuQoPl5gLBUNNqRLn3CFL0G/"}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"1.1.1":{"name":"clean-pslg","version":"1.1.1","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","main":"clean-pslg.js","directories":{"example":"example","test":"test"},"dependencies":{"big-rat":"^1.0.3","box-intersect":"^1.0.1","nextafter":"^1.0.0","rat-vec":"^1.1.1","robust-segment-intersect":"^1.0.1","union-find":"^1.0.2","uniq":"^1.0.1"},"devDependencies":{"mouse-change":"^1.2.1","canvas-fit":"^1.4.0","robust-orientation":"^1.1.3","tape":"^4.0.0","segment2":"^0.3.2","vec2":"^1.6.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/clean-pslg.git"},"keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"homepage":"https://github.com/mikolalysenko/clean-pslg","gitHead":"00704bf9af4dc27411e6bf0ed2e736300a1271c2","_id":"clean-pslg@1.1.1","_shasum":"709e7054f3c4638a98f7ca4619edafa70890e2a7","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"709e7054f3c4638a98f7ca4619edafa70890e2a7","tarball":"https://registry.npmjs.org/clean-pslg/-/clean-pslg-1.1.1.tgz","integrity":"sha512-A0i3w/57GG4Q2lX/iZ8ZUqDRyz5HUiGWRb9GiZJFoephwWnRODChI3r73OCnNPpkC67oUeqlBOjfTjwQLBgsag==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC5hkdfOdBDSC388rXZGh0a8M7HbXjo1MrG/K7H9TnBfQIhANfyD6Vzoo40vtAFibm2iTkvwMDibGEUBhlriyyeIu4W"}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/clean-pslg-1.1.1.tgz_1483723680416_0.8894204238895327"}},"1.1.2":{"name":"clean-pslg","version":"1.1.2","description":"Remove self intersections, t-junctions and duplicate edges/vertices from a planar straight line graph","main":"clean-pslg.js","directories":{"example":"example","test":"test"},"dependencies":{"big-rat":"^1.0.3","box-intersect":"^1.0.1","nextafter":"^1.0.0","rat-vec":"^1.1.1","robust-segment-intersect":"^1.0.1","union-find":"^1.0.2","uniq":"^1.0.1"},"devDependencies":{"mouse-change":"^1.2.1","canvas-fit":"^1.4.0","robust-orientation":"^1.1.3","tape":"^4.0.0","segment2":"^0.3.2","vec2":"^1.6.0"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/clean-pslg.git"},"keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"homepage":"https://github.com/mikolalysenko/clean-pslg","gitHead":"c20e801e036bf2c8ebca6ea6c6631aa64fc334c7","_id":"clean-pslg@1.1.2","_shasum":"bd35c7460b7e8ab5a9f761a5ed51796aa3c86c11","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.7.0","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"dist":{"shasum":"bd35c7460b7e8ab5a9f761a5ed51796aa3c86c11","tarball":"https://registry.npmjs.org/clean-pslg/-/clean-pslg-1.1.2.tgz","integrity":"sha512-bJnEUR6gRiiNi2n4WSC6yrc0Hhn/oQDOTzs6evZfPwEF/VKVXM6xu0F4n/WSBz7TjTt/ZK6I5snRM9gVKMVAxA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZbJPdi56WmUgjDPLFNJzjnrlEBQsQaimvQemdZ+YV0QIgWV3qH8H0f0mHRUlhEBpQbOHn3h9zqnnnz6GleI+wnOk="}]},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/clean-pslg-1.1.2.tgz_1484252965612_0.5935238960664719"}}},"readme":"clean-pslg\n============\n<img src=\"img/logo.png\">\n\nResolves all self intersections, t-junctions, and removes duplicate vertices/edges from a [planar straight line graph](https://en.wikipedia.org/wiki/Planar_straight-line_graph) using [iterated snap rounding](http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.23.220).\n\n# [Demo](https://mikolalysenko.github.io/clean-pslg)\n\nClick on the following link to try out `clean-pslg` in your browser:\n\n[<img src=\"img/demo.png\">](https://mikolalysenko.github.io/clean-pslg)\n\n* [Demo link](https://mikolalysenko.github.io/clean-pslg)\n\n# Example\n\nThis module really only does one thing, which is clean up planar straight line graphs.  You invoke it by passing it an array of points and an array of edges like so:\n\n```javascript\nvar cleanPSLG = require('clean-pslg')\n\n//Create a planar straight line graph with many degenerate crossings\nvar points      = [\n  [ 0.25, 0.5  ],\n  [ 0.75, 0.5  ],\n  [ 0.5,  0.25 ],\n  [ 0.5,  0.75 ],\n  [ 0.25, 0.25 ],\n  [ 0.75, 0.75 ],\n  [ 0.25, 0.75 ],\n  [ 0.75, 0.25 ]\n]\n\n//These are the edges of the graph\n//They are defined by pairs of indices of vertices\nvar edges       = [\n  [0, 1],\n  [2, 3],\n  [4, 5],\n  [6, 7]\n]\n\n//Run clean up on the graph\nif(cleanPSLG(points, edges)) {\n  console.log('removed degeneracies from graph')\n}\n\n//clean-pslg operates on the graph in place, so after running it the points/edges will be modified\nconsole.log('points = \\n', points)\nconsole.log('edges = \\n', edges)\n```\n\n#### Output\n\nThe program will output the following text:\n\n```\nremoved degeneracies from graph\npoints =\n [ [ 0.25, 0.5 ],\n  [ 0.75, 0.5 ],\n  [ 0.5, 0.25 ],\n  [ 0.5, 0.75 ],\n  [ 0.25, 0.25 ],\n  [ 0.75, 0.75 ],\n  [ 0.25, 0.75 ],\n  [ 0.75, 0.25 ],\n  [ 0.5, 0.5 ] ]\nedges =\n [ [ 8, 0 ],\n  [ 1, 8 ],\n  [ 8, 2 ],\n  [ 3, 8 ],\n  [ 8, 4 ],\n  [ 5, 8 ],\n  [ 8, 6 ],\n  [ 7, 8 ],\n  [ 8, 8 ] ]\n```\n\nVisually, this corresponds to the following refinement of a planar graph:\n\n<img src=\"img/example.png\">\n\n# Install\n\n```\nnpm i clean-pslg\n```\n\n# API\n\n#### `require('clean-pslg')(points, edges[, colors])`\nProcesses an unoriented planar straight line graph defined by `points` and `edges` in place.\n\n* `points` is an array encoding the vertices of the planar straight line graph as pairs of numbers\n* `edges` is an array encoding the edges of the planar straight line graph as pairs of indices\n* `colors` is an optional array of edge colors.  If specified, only merge edges if they have the same color.  This can be used to implement orientation preservation or handle solid geometry.\n\nThe following degeneracies are handled:\n\n* Duplicate points are merged\n* Duplicate edges are merged\n* T-junctions are split\n* Edge crossings are split\n\nThe resulting graph meets all invariants required by `cdt2d`, so it may be triangulated.  Note that this procedure *does not preserve orientation*.\n\n**Returns** `true` if repairs were necessary, otherwise `false`\n\n**Note** This is a destructive procedure, which means that the contents of `points` and `edges` may change.  If you don't want this to happen, you should make a deep copy of `points` and `edges` before calling `clean-pslg`\n\n# License\n(c) 2015 Mikola Lysenko. MIT License\n","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2022-06-13T06:07:52.412Z","created":"2015-06-28T06:58:19.667Z","1.0.0":"2015-06-28T06:58:19.667Z","1.0.1":"2015-06-28T06:59:11.231Z","1.1.0":"2015-06-28T20:27:14.823Z","1.1.1":"2017-01-06T17:28:02.764Z","1.1.2":"2017-01-12T20:29:27.695Z"},"homepage":"https://github.com/mikolalysenko/clean-pslg","keywords":["planar","straight","line","graph","geometry","topology","polygon","snap","rounding","tjunction","crossing","junction","duplicate","vertex","edge","point","cell","complex","repair","clean","self","intersection"],"repository":{"type":"git","url":"git+https://github.com/mikolalysenko/clean-pslg.git"},"author":{"name":"Mikola Lysenko"},"bugs":{"url":"https://github.com/mikolalysenko/clean-pslg/issues"},"license":"MIT","readmeFilename":"README.md"}