{"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":{"integrity":"sha512-bGlZDLZMVKT+3n+YtP3KljfAfuP0X3ucKk1AQj0/x4oTbrmYlcjiPOFuEM5D/keNLFEFIgatpB1G9dlUwnlBBw==","shasum":"0483b0976a5b6f6fd39e98874275870d751bb26d","tarball":"http://registry-npm.ywwl.com/points-on-path/download/points-on-path-0.0.1.tgz","fileCount":8,"unpackedSize":7056,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekU7DCRA9TVsSAnZWagAALqcQAJ7LwPC2UGRzqyMvczxR\nsfYD9I6QIfznLy+/Bq2i98+uOQSDN3+gE7o8Mf9LuRnO60VV041nKzn3wwEu\ny6CYyPgNNwhWXT8hromIl/Hy4Rh/h/tAWx6ezqF1sase9CZOJvpSEF8qBSOD\nWMDToqwDofEpVgVwM0I2Z0WGVQkmTFhByI4ZLAMSM2QNObyaZjFJIlbKIl+3\n6sZ3BWzq2B1BkDVLC67sGBruU/GMeIlttwsXgkEB18pd1v8TLnTY3MO72rGN\n7v/aLaZxJmhqUx0Cj5lXlWTkg4Uu9kpmd9S/PHJcrSHUmYNu/pU0k5Bfu/A1\nQsEZJoTVi4Jfq5iyOc0GnUqJq8Sr+NKSReoiDKMM/NoMWMnMAcJGPMMyFMnt\nlZsc5NweB6jfq7EroybANAMFi6oNFmUb9PW3LG8fmd4VC0FEzyytGVrHmtVr\ne1ZyrF7TayTxSDtQNboDgP4DP4XrGOqEVLWmH/UjuMTKITGx74azZtMG8adU\nSrD30tCZClkdrQtbJioEmUn2+ma6bIf+uYVrstJZDeepO1Trx8tkG1PCCkxh\nvE7/fpd/sfkGrP3UVRdpl/a2TD5+iKIlcwBeovIonsqrooTmh9dyD8MpvWb7\nCqfQlpxrAXXW3qk//Ar4aeRq3Bge+72yVqpB54ndPEIXGFUK+nK/8ZuHqpt8\nQDdy\r\n=pihV\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBsS6bOUvv07sgKAbD0VuPRb3o2Hu++TwvJYh94AN+tkAiApCYmYw29Z4zJNnXf8wLfsQfprQ+NBOPc3U6oCQZe1mw=="}],"size":2557,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.0.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.0.1_1586581187357_0.2565591197754784"},"_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":1586581187480,"_cnpm_publish_time":1586581187480,"dist-tags":{"latest":"0.2.1"}}