{"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":{"integrity":"sha512-X+uusxIDk/DZBC1w6gYCThB9GiSI7wlatxPYmme4wmcWnHFGanxdFBtuZQj1YeYhxXESJ5/Ym/h7DWDMw4A9mA==","shasum":"f5ebf80d5341741874eef20d232871ffec67a9b8","tarball":"http://registry-npm.ywwl.com/points-on-path/download/points-on-path-0.2.0.tgz","fileCount":8,"unpackedSize":9601,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJelkedCRA9TVsSAnZWagAAc3EP/RevK5hGUzRgu8i8Vv8q\ngeLFMv0uIMHpVK0kNNBxxk1+8euj3ihYlHzpDh1SyRxD0XSgWV5GgrP2zUq/\ndQJTrTACXnIYQG3DBCO+aiqi3tNUNSmPjtQgRS+UZ3T8xUWRGQXAPqk6Dsg4\n+9RniJjruzaa6t/cRMOE0mzZfZxSQh7sHj56tKBbSkTjc/+AxnvMRKvpFsvJ\nmHB5jPNx6FrDkqYcQEuhlbiZuvgm1lCC0oL21M5ouhzA9P66UVXMS2h6o41S\n28VLQ7EAqovZBHkULY3VlqWKp7PBBCW//1Feu1tHsZoQQc6KZfwGInvvBqXx\nNF0ugm72ach/eDcE+C3NDS+0n0Hif6ee2abvFHlxVVHg1Ka/C7f18vDdiK8+\nmrPjoBN/DxfspWHA+LGgJdJv8AsokyJPFfjehxXmQfB2TXUKnFuEKvA7aS80\nA5PAi+CxrA7emiFZ/RNhYmfOEYqUV+Y1alIyChoIzuTgM5mege8eif62V0Mq\nYOsQACgqGYk/RNkOPuwOEbGHKQ6JyIbD7kr0/s5hpTJvdt5/SvFf2SLNCxiP\n5/0ybEzjcn4EB1/388m5QVbXIaQ0s473I42KoK5kwvBTiouCWAfWzG80aiKo\nAT25s8HxUikTOxGEF5zqLphyWS9YNn2kDwMCreYrDVl79I1Q3wnngMjEqvEC\ntfB0\r\n=2N+7\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCRHitNzrHy6HkPceydSmTcFVX1NQr7qhn9Ao6kEnEmWQIgOHEgfptQTJoVxJEvouKYsME2d45/69eJbyqSf2b16bw="}],"size":3419,"noattachment":false,"key":"/points-on-path/-/points-on-path-0.2.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.2.0_1586907036838_0.10667145528297128"},"_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":1586907036956,"_cnpm_publish_time":1586907036956,"dist-tags":{"latest":"0.2.1"}}