{"_id":"svg-mesh-3d","_rev":"6-a31e0fbd3b37378b95f13ab59f1d416a","name":"svg-mesh-3d","description":"converts a SVG path to a 3D mesh","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"svg-mesh-3d","version":"1.0.0","description":"converts a SVG path to a 3D mesh","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"bound-points":"^1.0.0","cdt2d":"^1.0.0","clean-pslg":"^1.1.0","normalize-path-scale":"^2.0.0","object-assign":"^4.0.1","parse-svg-path":"^0.1.1","random-float":"^1.0.0","simplify-path":"^1.1.0","svg-path-contours":"^2.0.0"},"devDependencies":{"array-shuffle":"^1.0.0","babelify":"^6.3.0","brfs":"^1.4.1","browserify":"^11.2.0","budo":"^5.1.0","canvas-loop":"^1.0.6","draw-triangles-2d":"^1.0.0","extract-svg-path":"^2.1.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","load-svg":"^1.0.0","mesh-reindex":"^1.0.0","three":"^0.69.0","three-simplicial-complex":"^69.0.6","triangle-centroid":"^1.0.0","tweenr":"^2.1.3","uglify-js":"^2.4.24","unindex-mesh":"^1.0.1"},"scripts":{"test":"node test.js","2d":"budo demo/2d.js:bundle.js --live | garnish","start":"budo demo/:bundle.js --live -- -t babelify -t brfs | garnish","build":"browserify demo/index.js -t babelify -t brfs | uglifyjs -cm > bundle.js"},"keywords":["svg","triangulate","mesh","path","normalize","scale"],"repository":{"type":"git","url":"git://github.com/mattdesl/svg-mesh-3d.git"},"homepage":"https://github.com/mattdesl/svg-mesh-3d","bugs":{"url":"https://github.com/mattdesl/svg-mesh-3d/issues"},"gitHead":"bd3b21f696a49b4f2e356b22514e52b0d54ceb1f","_id":"svg-mesh-3d@1.0.0","_shasum":"d63dd71b3bcbcb5c381886765678438f5f7a9546","_from":".","_npmVersion":"2.14.5","_nodeVersion":"0.12.7","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"d63dd71b3bcbcb5c381886765678438f5f7a9546","tarball":"https://registry.npmjs.org/svg-mesh-3d/-/svg-mesh-3d-1.0.0.tgz","integrity":"sha512-BeSV5tdDNtqb1wgHeGFFtQg7YCx5YWy5dXUN6H5wIv6QH4GHIHYRrNN3qGXT3wSqZ68+tW6KOaX8jiHfbP8ZhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAahUUuZagMdZh4utjdGjy8VGI7GH3kpmb5lH3BxFzatAiByvaOeKCQHgoUGlwGwITbBDAKuyzIpBH3GHHP6RKSikA=="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.0.1":{"name":"svg-mesh-3d","version":"1.0.1","description":"converts a SVG path to a 3D mesh","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"bound-points":"^1.0.0","cdt2d":"^1.0.0","clean-pslg":"^1.1.0","normalize-path-scale":"^2.0.0","object-assign":"^4.0.1","parse-svg-path":"^0.1.1","random-float":"^1.0.0","simplify-path":"^1.1.0","svg-path-contours":"^2.0.0"},"devDependencies":{"array-shuffle":"^1.0.0","babelify":"^6.3.0","brfs":"^1.4.1","browserify":"^11.2.0","budo":"^5.1.0","canvas-loop":"^1.0.6","draw-triangles-2d":"^1.0.0","extract-svg-path":"^2.1.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","load-svg":"^1.0.0","mesh-reindex":"^1.0.0","three":"^0.69.0","three-simplicial-complex":"^69.0.6","triangle-centroid":"^1.0.0","tweenr":"^2.1.3","uglify-js":"^2.4.24","unindex-mesh":"^1.0.1"},"scripts":{"test":"node test.js","2d":"budo demo/2d.js:bundle.js --live | garnish","start":"budo demo/:bundle.js --live -- -t babelify -t brfs | garnish","build":"browserify demo/index.js -t babelify -t brfs | uglifyjs -cm > bundle.js"},"keywords":["svg","triangulate","mesh","path","normalize","scale"],"repository":{"type":"git","url":"git://github.com/mattdesl/svg-mesh-3d.git"},"homepage":"https://github.com/mattdesl/svg-mesh-3d","bugs":{"url":"https://github.com/mattdesl/svg-mesh-3d/issues"},"gitHead":"4963b8971d9cce74daf562d4f997a2552d9a9def","_id":"svg-mesh-3d@1.0.1","_shasum":"b9188995cff371bfa3782b3fe5f934840c15c633","_from":".","_npmVersion":"2.14.5","_nodeVersion":"0.12.7","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"b9188995cff371bfa3782b3fe5f934840c15c633","tarball":"https://registry.npmjs.org/svg-mesh-3d/-/svg-mesh-3d-1.0.1.tgz","integrity":"sha512-qxGQaw5oVbcO81VI/VBbJ7ruH3tM9cvvX/P2HFmlL9Y/16w7Xg1zXIchFOCDpISolMYS3+MviTMqj0oMsfE6cg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCgbn4YW2V29SGU8YvarUXKHaJtX2vz/bQvAhk6KeUz0QIhAN7CVdAAGoZun0K6bx0Tl/r7N/FdiRuGNL7Z7CMmcOIG"}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}]},"1.1.0":{"name":"svg-mesh-3d","version":"1.1.0","description":"converts a SVG path to a 3D mesh","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"bound-points":"^1.0.0","cdt2d":"^1.0.0","clean-pslg":"^1.1.0","normalize-path-scale":"^2.0.0","object-assign":"^4.0.1","parse-svg-path":"^0.1.1","random-float":"^1.0.0","simplify-path":"^1.1.0","svg-path-contours":"^2.0.0"},"devDependencies":{"array-shuffle":"^1.0.0","babelify":"^6.3.0","brfs":"^1.4.1","browserify":"^11.2.0","budo":"^5.1.0","canvas-loop":"^1.0.6","draw-triangles-2d":"^1.0.0","extract-svg-path":"^2.1.0","garnish":"^3.2.1","gl-vec3":"^1.0.3","load-svg":"^1.0.0","mesh-reindex":"^1.0.0","three":"^0.69.0","three-simplicial-complex":"^69.0.6","triangle-centroid":"^1.0.0","tweenr":"^2.1.3","uglify-js":"^2.4.24","unindex-mesh":"^1.0.1"},"scripts":{"test":"node test.js","2d":"budo demo/2d.js:bundle.js --live | garnish","start":"budo demo/:bundle.js --live -- -t babelify -t brfs | garnish","build":"browserify demo/index.js -t babelify -t brfs | uglifyjs -cm > bundle.js"},"keywords":["svg","triangulate","mesh","path","normalize","scale"],"repository":{"type":"git","url":"git://github.com/mattdesl/svg-mesh-3d.git"},"homepage":"https://github.com/mattdesl/svg-mesh-3d","bugs":{"url":"https://github.com/mattdesl/svg-mesh-3d/issues"},"gitHead":"1f765b7d18e3193030c464ad22cd252b807d44d9","_id":"svg-mesh-3d@1.1.0","_shasum":"59d1651812dcbbfc69fb6d762b933911382c14a5","_from":".","_npmVersion":"3.8.9","_nodeVersion":"6.2.0","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"dist":{"shasum":"59d1651812dcbbfc69fb6d762b933911382c14a5","tarball":"https://registry.npmjs.org/svg-mesh-3d/-/svg-mesh-3d-1.1.0.tgz","integrity":"sha512-ZaeN4Y5D2uzzIBCOs7gZenLFe6QqF6nQOueqWRax1GuVEYRSusQ3N1oRSAcpZizeOXPbkwJzWyW6JAA/ejo/bA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID0kvuBDzwx1G/xVmn9YjkcUuzvBR2pKSLzjBrKioyUgAiBi8ra6r7UgPK9ZnxgJj9Ih93TbKCQZHKMJj7Bv8Au5vQ=="}]},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/svg-mesh-3d-1.1.0.tgz_1466440659820_0.6819624460767955"}}},"readme":"# svg-mesh-3d\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\n  <center>[<img src=\"http://i.imgur.com/rY3bRps.png\" width=\"80%\" />](http://mattdesl.github.io/svg-mesh-3d/)</center>\n\n[(ThreeJS demo)](http://mattdesl.github.io/svg-mesh-3d/) - [(source)](./demo/index.js)\n\nA high-level module to convert a SVG `<path>` string into a 3D triangulated mesh. Best suited for silhouettes, like font icon SVGs.\n\nBuilt on top of [cdt2d](https://www.npmjs.com/package/cdt2d) by [@mikolalysenko](https://twitter.com/MikolaLysenko), and various other modules.\n\n## Install\n\n```sh\nnpm install svg-mesh-3d --save\n```\n\n## Example\n\nHere is an example using a simple path:\n\n```js\nvar svgMesh3d = require('svg-mesh-3d')\n\nvar path = 'M305.214,374.779c2.463,0,3.45,0.493...'\nvar mesh = svgMesh3d(path)\n```\n\nThe returned mesh is a 3D indexed [\"simplicial complex\"](https://www.npmjs.com/package/mesh-primitives#generic-mesh-modules) that can be used in ThreeJS, StackGL, etc. It uses arrays for vectors and follows the format:\n\n```js\n{\n  positions: [ [x1, y1, z1], [x2, y2, z2], ... ],\n  cells: [ [a, b, c], [d, e, f] ]\n}\n```\n\nOr, to load a mesh in the browser from an SVG file:\n\n```js\nvar loadSvg = require('load-svg')\nvar parsePath = require('extract-svg-path').parse\nvar svgMesh3d = require('svg-mesh-3d')\n\nloadSvg('svg/logo.svg', function (err, svg) {\n  if (err) throw err\n\n  var svgPath = parsePath(svg)\n  var mesh = svgMesh3d(svgPath, {\n    delaunay: false,\n    scale: 4\n  })\n})\n\n```\n\n## Demos\n\n- [ThreeJS Demo](http://mattdesl.github.io/svg-mesh-3d/)\n\nSource:\n\n- [demo/index.js](demo/index.js) - animated meshes in ThreeJS\n- [demo/2d.js](demo/2d.js) - drawing Canvas2D\n\nTo run the demos from source:\n\n```sh\ngit clone https://github.com/mattdesl/svg-mesh-3d.git\ncd svg-mesh-3d\n\n# install dependencies\nnpm install\n\n# ThreeJS demo\nnpm run start\n\n# Canvas2D demo\nnpm run 2d\n```\n\n## Usage\n\n#### `mesh = svgMesh3d(svgPath, [opt])`\n\nTriangulates the `svgPath` string into a 3D simplicial complex. The positions in the 3D mesh are normalized to a `-1.0 ... 1.0` range.\n\nOptions:\n\n- `delaunay` (default `true`)\n  - whether to use Delaunay triangulation\n  - Delaunay triangulation is slower, but looks better\n- `clean` (default `true`)\n  - whether to run the mesh through [clean-pslg](https://www.npmjs.com/package/clean-pslg)\n  - slower, but often needed for correct triangulation\n- `simplify` (default `0`)\n  - a number, the distance threshold for simplication before triangulation (in pixel space)\n  - higher number can produce faster triangulation\n- `scale` (default `1`)\n  - a positive number, the scale at which to [approximate the curves](https://github.com/mattdesl/adaptive-bezier-curve) from the SVG paths\n  - higher number leads to smoother corners, but slower triangulation\n- `normalize` (default `true`) a boolean, whether to normalize the positions to `-1 .. 1`\n- `randomization` (default `0`)\n  - a positive number, the amount of extra points to randomly add within the bounding box before triangulation\n  - higher number can lead to a nicer aesthetic, but slower triangulation\n\nOther options are passed to [cdt2d](https://www.npmjs.com/package/cdt2d), such as `exterior` (default false) and `interior` (default true).\n\n## See Also\n\n- [extract-svg-path](https://www.npmjs.com/package/extract-svg-path) - grab `<path>` data from SVG\n- [load-svg](https://www.npmjs.com/package/load-svg) - load SVG in browser\n- [three-simplicial-complex](https://www.npmjs.com/package/three-simplicial-complex) - render meshes in ThreeJS\n- [cdt2d](https://www.npmjs.com/package/cdt2d) - constrained delaunay triangulation in 2D\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/svg-mesh-3d/blob/master/LICENSE.md) for details.\n","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2022-06-27T02:34:28.683Z","created":"2015-10-04T19:06:02.624Z","1.0.0":"2015-10-04T19:06:02.624Z","1.0.1":"2015-10-04T19:33:16.705Z","1.1.0":"2016-06-20T16:37:41.343Z"},"homepage":"https://github.com/mattdesl/svg-mesh-3d","keywords":["svg","triangulate","mesh","path","normalize","scale"],"repository":{"type":"git","url":"git://github.com/mattdesl/svg-mesh-3d.git"},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"bugs":{"url":"https://github.com/mattdesl/svg-mesh-3d/issues"},"license":"MIT","readmeFilename":"README.md","users":{"rafszul":true}}