{"_id":"points-on-path","_rev":"4127076","name":"points-on-path","description":"Estimate points on a SVG path","dist-tags":{"latest":"0.2.1"},"maintainers":[{"name":"shihn","email":""}],"time":{"modified":"2026-03-01T18:25:33.000Z","created":"2020-04-11T04:59:47.480Z","0.2.1":"2020-05-01T04:16:00.000Z","0.2.0":"2020-04-14T23:30:36.956Z","0.1.1":"2020-04-13T23:43:41.836Z","0.1.0":"2020-04-11T21:02:57.931Z","0.0.1":"2020-04-11T04:59:47.480Z"},"users":{},"author":{"name":"Preet Shihn"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"versions":{"0.2.1":{"name":"points-on-path","version":"0.2.1","description":"Estimate points on a SVG path","main":"lib/index.js","module":"lib/index.js","types":"lib/index.d.ts","scripts":{"build":"rm -rf lib && tsc","lint":"tslint -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"keywords":["SVG","graphics"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"homepage":"https://github.com/pshihn/points-on-path#readme","devDependencies":{"tslint":"^6.1.1","typescript":"^3.8.3"},"dependencies":{"path-data-parser":"0.1.0","points-on-curve":"0.2.0"},"gitHead":"7693ef0c930466b7408ee7082497e0d735f9c646","_id":"points-on-path@0.2.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"553202b5424c53bed37135b318858eacff85dd52","size":3429,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/points-on-path/download/points-on-path-0.2.1.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/points-on-path_0.2.1_1588306559868_0.8572769503941855"},"_hasShrinkwrap":false,"publish_time":1588306560000,"_cnpm_publish_time":1588306560000,"_cnpmcore_publish_time":"2021-12-17T02:50:23.511Z"},"0.2.0":{"name":"points-on-path","version":"0.2.0","description":"Estimate points on a SVG path","main":"lib/index.js","scripts":{"build":"rm -rf lib && tsc","lint":"tslint -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"keywords":["SVG","graphics"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"homepage":"https://github.com/pshihn/points-on-path#readme","devDependencies":{"tslint":"^6.1.1","typescript":"^3.8.3"},"dependencies":{"path-data-parser":"0.1.0","points-on-curve":"0.2.0"},"gitHead":"8b94a573c4d54daedee3d7796dc6ae18b4de0ca9","_id":"points-on-path@0.2.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"f5ebf80d5341741874eef20d232871ffec67a9b8","size":3419,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/points-on-path/download/points-on-path-0.2.0.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/points-on-path_0.2.0_1586907036838_0.10667145528297128"},"_hasShrinkwrap":false,"publish_time":1586907036956,"_cnpm_publish_time":1586907036956,"_cnpmcore_publish_time":"2021-12-17T02:50:23.806Z"},"0.1.1":{"name":"points-on-path","version":"0.1.1","description":"Estimate points on a SVG path","main":"lib/index.js","scripts":{"build":"rm -rf lib && tsc","lint":"tslint -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"keywords":["SVG","graphics"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"homepage":"https://github.com/pshihn/points-on-path#readme","devDependencies":{"tslint":"^6.1.1","typescript":"^3.8.3"},"dependencies":{"path-data-parser":"0.1.0","points-on-curve":"0.1.1"},"gitHead":"6607c1df1d22941d5a798a6af43fb119b5071513","_id":"points-on-path@0.1.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"cb3d704f5a672cbd127405a7fca2bfdd742b5744","size":3312,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/points-on-path/download/points-on-path-0.1.1.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/points-on-path_0.1.1_1586821421689_0.8346124522587557"},"_hasShrinkwrap":false,"publish_time":1586821421836,"_cnpm_publish_time":1586821421836,"_cnpmcore_publish_time":"2021-12-17T02:50:24.024Z"},"0.1.0":{"name":"points-on-path","version":"0.1.0","description":"Estimate points on a SVG path","main":"lib/index.js","scripts":{"build":"rm -rf lib && tsc","lint":"tslint -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"keywords":["SVG","graphics"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"homepage":"https://github.com/pshihn/points-on-path#readme","devDependencies":{"tslint":"^6.1.1","typescript":"^3.8.3"},"dependencies":{"path-data-parser":"0.1.0","points-on-curve":"0.1.0"},"gitHead":"cffaf2d83c5d213f6a745f5afc58093860559b81","_id":"points-on-path@0.1.0","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"fb62252e947e6f6a052993f1acd3e35103e9332f","size":3315,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/points-on-path/download/points-on-path-0.1.0.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/points-on-path_0.1.0_1586638977752_0.9521286659905122"},"_hasShrinkwrap":false,"publish_time":1586638977931,"_cnpm_publish_time":1586638977931,"_cnpmcore_publish_time":"2021-12-17T02:50:24.256Z"},"0.0.1":{"name":"points-on-path","version":"0.0.1","description":"Estimate points on a SVG path","main":"lib/index.js","scripts":{"build":"rm -rf lib && tsc","lint":"tslint -p tsconfig.json","test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/pshihn/points-on-path.git"},"keywords":["SVG","graphics"],"author":{"name":"Preet Shihn"},"license":"MIT","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"homepage":"https://github.com/pshihn/points-on-path#readme","devDependencies":{"tslint":"^6.1.1","typescript":"^3.8.3"},"dependencies":{"path-data-parser":"0.0.2","points-on-curve":"0.0.1"},"gitHead":"7a4176d1028a34ca09d7630c8aa8ec9ed59ab74c","_id":"points-on-path@0.0.1","_nodeVersion":"10.16.0","_npmVersion":"6.9.0","dist":{"shasum":"0483b0976a5b6f6fd39e98874275870d751bb26d","size":2557,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/points-on-path/download/points-on-path-0.0.1.tgz"},"maintainers":[{"name":"shihn","email":""}],"_npmUser":{"name":"shihn","email":"preetshihn@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/points-on-path_0.0.1_1586581187357_0.2565591197754784"},"_hasShrinkwrap":false,"publish_time":1586581187480,"_cnpm_publish_time":1586581187480,"_cnpmcore_publish_time":"2021-12-17T02:50:24.451Z"}},"readme":"# points-on-path\n\nThis package calculate the points on a SVG Path with a certain tolerance. It can also simplify the shape to use fewer points. \nThis can really usefule when estimating lines/polygons for paths in WebGL or for Hit/Cosllision detections. \n\nThis package essentially combines packages [path-data-parser](https://github.com/pshihn/path-data-parser) and [points-on-curve](https://github.com/pshihn/bezier-points)\n\n## Install\n\nFrom npm\n\n```\nnpm install --save points-on-path\n```\n\nThe package is distributed as an ES6 module. \n\n## Usage\n\n### pointsOnPath(path: string, tolerance?: number, distance?: number): PathPoints\n\nPass in a SVG path string and get back a `PathPoints` object. A `PathPoints` gives you a list of points (each being a an array of 2 numbers `[x, y]`), and a flag telling you if the path is actually composed of multiple disconnected paths. \n\n```javascript\nPathPoints {\n  points: Point[];\n  continuous: boolean;\n}\n```\n\nTake this path for example:\n\n![points on path](https://user-images.githubusercontent.com/833927/79054782-ba8d0300-7bfc-11ea-8f16-ed36001c56c9.png)\n\nand estimate the points on the path\n\n```javascript\nimport { pointsOnPath } from 'points-on-path';\n\nconst points = pointsOnPath('M240,100c50,0,0,125,50,100s0,-125,50,-150s175,50,50,100s-175,50,-300,0s0,-125,50,-100s0,125,50,150s0,-100,50,-100');\n// plotPoints(points);\n```\n\n![points on path](https://user-images.githubusercontent.com/833927/79054650-8d8c2080-7bfb-11ea-93cf-2c070dfe63c5.png)\n\nThe method also accepts two optional values `tolerance` and `distance`. These are described by [points-on-curve](https://github.com/pshihn/bezier-points); to estimate more tolerant and fewer points. \n\n\n![points on path](https://user-images.githubusercontent.com/833927/79054652-8e24b700-7bfb-11ea-8ff8-68dce51a3940.png)\n\n![points on path](https://user-images.githubusercontent.com/833927/79054653-8ebd4d80-7bfb-11ea-8645-a5a0ed81cf84.png)\n\n## License\n[MIT License](https://github.com/pshihn/points-on-path/blob/master/LICENSE)\n\n","_attachments":{},"homepage":"https://github.com/pshihn/points-on-path#readme","bugs":{"url":"https://github.com/pshihn/points-on-path/issues"},"license":"MIT"}