{"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":{"integrity":"sha512-ELEJOfnw8Onum1o4pnKBNcvW/2nhlHM/4CEfi5hxlqdX7kktvegqBYOBxRgO2WvMbknCjYM/hEkNFMlicMlcuQ==","shasum":"cb3d704f5a672cbd127405a7fca2bfdd742b5744","tarball":"http://registry-npm.ywwl.com/points-on-path/download/points-on-path-0.1.1.tgz","fileCount":8,"unpackedSize":9023,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelPkuCRA9TVsSAnZWagAAeEUP/1NBw2Gffd7Aq6xRvl9q\nHmg8e9RHCBkUcFnmUVi6rMtceeEhxK7qeb70chvSZSVD0uZu+t+63UM5eAQg\nw9RfuhKbC+ifm4znICGGm2Xr+8QEKLcls4B4JMXy8ErXCW0Kk8g7GfAfNmA4\nKY4ndi0yA9ndI95DmUSddB1vT+2aL9ryodt6E59r+FU+4Iu+A7Tf/qMagCo0\nwuQio6oWfmxum6qa5F/A4BsbkG7UnvR9jIBn2ApexnPdBZUEAN+u5XdPpDm3\nYwUroRjMvme9HljR2lZpWS3M8g+AyaoqTm/FCix7E2vF3HqcJqUsrcMkSEU1\n6VK6uaFmoFdjw+rOz5JyRwJdzi0y5SjN8s48rVdTWD3uZyExkyJhfZxnsR3e\nXhPTn0RuEgQYhbl52tgzquMJQgAdB8Y9K85xKGb+I4nCots0vGP6LUUtRKvm\nmJB8a2Jq9yhCw0vftpzjQyn7mYAjPla6W1Qe8gMLP5e8Ms3s/Pk+knwxln3+\nJ7r2MO95/nVh596cU+jcsryi/+LwyYtIiKR0ypjA/8wmqRIikayGsDjnVMiB\ntn47xFRrC1eSSWJSWoBJaLVL+5odlZl9Q65nYUPRBdCOF/rkDl1d46N304Ap\ncfqAtT7eM+vX31UURu/A4kqbUG9bZpxEqfnlRS4cX3cFO2j+eWABdr6GS65Q\nJeIe\r\n=ECwm\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDzOuBOH477bwfOkijlJqGvuAW2aCjQqFv2RKw2Qp23JQIge0CGOqFH9vYMY2ts2D0hTpE9lA2xk3bucOJZPi/hRuE="}],"size":3312,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.1.1.tgz"},"maintainers":[{"name":"shihn","email":"preetshihn@gmail.com"}],"_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,"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","publish_time":1586821421836,"_cnpm_publish_time":1586821421836,"dist-tags":{"latest":"0.2.1"}}