{"_id":"simplify-planar-graph","_rev":"8-b43bf9071d5f5cdc79e16f6b97e88812","name":"simplify-planar-graph","description":"Simplifies a planar graph","dist-tags":{"latest":"2.0.1"},"versions":{"1.0.0":{"name":"simplify-planar-graph","version":"1.0.0","description":"Simplifies a planar graph","main":"simplify.js","directories":{"test":"test"},"dependencies":{"robust-orientation":"^1.0.1","simplicial-complex":"^0.3.3"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/simplify-planar-graph.git"},"keywords":["polygon","simplify","region","vertex","collapse","planar","graph","planar graph","edge","cell","complex","polyline"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/simplify-planar-graph/issues"},"homepage":"https://github.com/mikolalysenko/simplify-planar-graph","_id":"simplify-planar-graph@1.0.0","dist":{"shasum":"99b2cff5655e152f6f70734364fa2ba1a21398dc","tarball":"https://registry.npmjs.org/simplify-planar-graph/-/simplify-planar-graph-1.0.0.tgz","integrity":"sha512-WaO86O2Wic887izExlX95BNLJnb+RK/mvzsGx67qy/e6nYbIX7BE8xMjP80yZ0D8ulszykhCEAWyuC6D9/XCBw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAyaQuOMuYbO7qygZvgSvWN8CZ5e1N4hzwmddVKiPmF8AiEAm2UX2MxhbG7CNE4MirkQOlYbwORupHGeZc9O2zSNuLU="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"2.0.0":{"name":"simplify-planar-graph","version":"2.0.0","description":"Simplifies a planar graph","main":"simplify.js","directories":{"test":"test"},"dependencies":{"robust-orientation":"^1.0.1","simplicial-complex":"^0.3.3"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/simplify-planar-graph.git"},"keywords":["polygon","simplify","region","vertex","collapse","planar","graph","planar graph","edge","cell","complex","polyline"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/simplify-planar-graph/issues"},"homepage":"https://github.com/mikolalysenko/simplify-planar-graph","_id":"simplify-planar-graph@2.0.0","dist":{"shasum":"dc8c97717446aec6eb9a7e8d9523c516c940d614","tarball":"https://registry.npmjs.org/simplify-planar-graph/-/simplify-planar-graph-2.0.0.tgz","integrity":"sha512-QNwUj2vezzouyl3jWXxA6uwll0RnOZhInERh02J1U7Iq0v+mn25K3q5XrVa9MTN7XoAeUceICkpWRHYgoMgkXg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCZ88sOtbhjGG9Wfz7Bci/IE9LPiipGRfNsAlbaiiuMswIgVjcWDgBRN8+IkRlXgAtrkQL/F02iYAaY4t7mG6hgld8="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]},"2.0.1":{"name":"simplify-planar-graph","version":"2.0.1","description":"Simplifies a planar graph","main":"simplify.js","directories":{"test":"test"},"dependencies":{"robust-orientation":"^1.0.1","simplicial-complex":"^0.3.3"},"devDependencies":{"tape":"~2.12.3"},"scripts":{"test":"tape test/*.js"},"repository":{"type":"git","url":"git://github.com/mikolalysenko/simplify-planar-graph.git"},"keywords":["polygon","simplify","region","vertex","collapse","planar","graph","planar graph","edge","cell","complex","polyline"],"author":{"name":"Mikola Lysenko"},"license":"MIT","bugs":{"url":"https://github.com/mikolalysenko/simplify-planar-graph/issues"},"homepage":"https://github.com/mikolalysenko/simplify-planar-graph","_id":"simplify-planar-graph@2.0.1","dist":{"shasum":"bc85893725f32e8fa8ae25681398446d2cbcf766","tarball":"https://registry.npmjs.org/simplify-planar-graph/-/simplify-planar-graph-2.0.1.tgz","integrity":"sha512-KdC2ZPFvrGl9+lH/P3Yik7G0si2Zpk6Xiqjq8l9U1lOox5a/9dGLjevi9tvqoh4V7yQbs7fs6+rNCOAdrzUktw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGvla5qPC5nPlJdJSDirYwHTJLWOywUwi6Tv088Osu+ZAiBLr8X7SctHFgypsUUoBEGc7hMXfAD9SWVJQp6KS1hLoQ=="}]},"_from":".","_npmVersion":"1.4.3","_npmUser":{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"},"maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}]}},"readme":"simplify-planar-graph\n=====================\nSimplifies a planar graph by removing small or nearly flat corners.\n\n# Example\n\n```javascript\nvar simplify = require(\"simplify-planar-graph\")\n\n//Create a circle\nvar positions = []\nvar edges = []\nfor(var i=0; i<100; ++i) {\n  var theta = i / 100 * Math.PI * 2.0\n  positions.push([Math.cos(theta), Math.sin(theta)])\n  edges.push([i, (i+1)%100])\n}\n\n//Simplify it\nconsole.log(simplify(edges, positions, 0.1))\n```\n\nOutput:\n\n```javascript\n{ positions:\n   [ [ 0.9921147013144779, 0.12533323356430426 ],\n     [ 0.8090169943749475, 0.5877852522924731 ],\n     [ 0.48175367410171516, 0.8763066800438637 ],\n     [ -0.30901699437494734, 0.9510565162951536 ],\n     [ -0.7705132427757891, 0.6374239897486899 ],\n     [ -0.9980267284282716, 0.06279051952931358 ],\n     [ -0.9510565162951535, -0.30901699437494773 ],\n     [ -0.5877852522924732, -0.8090169943749473 ],\n     [ -0.18738131458572463, -0.9822872507286887 ],\n     [ 0.535826794978996, -0.8443279255020155 ],\n     [ 0.7705132427757894, -0.6374239897486896 ] ],\n  edges:\n   [ [ 0, 1 ],\n     [ 1, 2 ],\n     [ 2, 3 ],\n     [ 3, 4 ],\n     [ 4, 5 ],\n     [ 10, 0 ],\n     [ 5, 6 ],\n     [ 6, 7 ],\n     [ 7, 8 ],\n     [ 8, 9 ],\n     [ 9, 10 ] ] }\n```\n\n# Install\n\n```\nnpm install simplify-planar-graph\n```\n\n# API\n\n#### `require(\"simplify-planar-graph\")(edges, positions, tolerance)`\nSimplies a planar graph to a given tolerance\n\n* `edges` are the edges of the graph represented by pairs of vertex indices\n* `positions` is a list of vertex coordinates encoded as an array of 2D arrays\n* `tolerance` controls the target aspect ratio of the corners of the mesh\n\n**Returns** A new planar graph encoded as a JSON object with two properties:\n\n* `edges` is an array of edges encoded as pairs of indices\n* `positions` is an array of positions for the simplicial complex\n\n**Note** The current implementation does not detect the removal of features which cross existing line segments.  Picking a high tolerance value may result in destroying the planarity of the resulting graph.  Eventually if it becomes a priority I may go back and implement code to detect and handle these cases.\n\n# Credits\n(c) 2014 Mikola Lysenko. MIT License","maintainers":[{"name":"mikolalysenko","email":"mikolalysenko@gmail.com"}],"time":{"modified":"2022-06-26T20:07:59.647Z","created":"2014-04-22T16:53:23.143Z","1.0.0":"2014-04-22T16:53:23.143Z","2.0.0":"2014-04-23T18:19:17.321Z","2.0.1":"2014-04-23T18:26:04.349Z"},"homepage":"https://github.com/mikolalysenko/simplify-planar-graph","keywords":["polygon","simplify","region","vertex","collapse","planar","graph","planar graph","edge","cell","complex","polyline"],"repository":{"type":"git","url":"git://github.com/mikolalysenko/simplify-planar-graph.git"},"author":{"name":"Mikola Lysenko"},"bugs":{"url":"https://github.com/mikolalysenko/simplify-planar-graph/issues"},"license":"MIT","readmeFilename":"README.md"}