{"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":{"integrity":"sha512-GCaiag1+KfxM2KzXQb04yceoa5PqQMPqHPZzu8Y28UegtMxfyMwvUuDAQnmv51LJo84Y7kSt6Dabee/FJX/NUQ==","shasum":"fb62252e947e6f6a052993f1acd3e35103e9332f","tarball":"http://registry-npm.ywwl.com/points-on-path/download/points-on-path-0.1.0.tgz","fileCount":8,"unpackedSize":9024,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJekjCCCRA9TVsSAnZWagAAiTUP/0qlSX1w9s0J6bTC84NV\nLGjat/WIBsWOy2kF2I4N4HyW7pIzjgMJNl+BExAY/WDTrMiopDy43lYHx3uR\nnIQbdz8sPyT0y6Q67yVEN6q6R8+YTORCsW8a+Gr7n7cbzQzgoUrVq/eLpiFv\nNLpudwlIklu27jzrRzTyuiByhY74LOWDYFMj3rdbpLGEhA7JpfiH/c6Ig6ul\nI3uNAOPIjM053x4R6uVjGfVLJyZNIsLMpYxfNvY+8YOnRx9q95PrgMDQmpsV\nIk6dSpZKV3etRWo/26fTLod0LygTxGTdVCKRPuQv0zPAjO1XAozB3c0sGjhZ\nsuSGJN3n+l+SaeNGAVORhmo8feRNaI2KePObbbpdZ5jzLD7lYd66DkqpXU4U\n0awgYybPqRix4AOYFf7Og+4xVfaUksU+oT7X+dOXkGeclPabI9mn4hiU1Bwh\nFlrhOTiJhz94qpE4NFsD6OyNFyOVuf8x6gM11tum08Xqf7stuPRM5ughFYAf\nlIaPYCAfSN8+9lovvy1uVcAj2wBjsaD+el1iYSMlw5+kPv+dQWZS2yGuR6K+\ns57eVozJyPRc/d/BsX85rom4bKR95FNmvTIOMmiob93W5V8M0djL3p7OjnE0\nQ9B8+2YqySir6VglOG48K0/ESgMhArty3d/3TnrQigR2i8tW7CeMjsP5MyZT\nAe0u\r\n=hv9U\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDg6frCL0g12n3rUjCP0jHQ1PFOAgEvzVQ68Qu+zBWF2QIhAPkArcskIwkSv0fgcJHfvZTCuE4ccvpNCD8S73DdYWEJ"}],"size":3315,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.1.0.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.0_1586638977752_0.9521286659905122"},"_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":1586638977931,"_cnpm_publish_time":1586638977931,"dist-tags":{"latest":"0.2.1"}}