{"name":"extrude-polyline","version":"1.0.1","description":"triangulates a 2D polyline into a stroke","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{"as-number":"^1.0.0","gl-vec2":"^1.0.0"},"devDependencies":{"array-range":"^1.0.1","beefy":"^2.1.1","canvas-testbed":"^1.0.3","clamp":"^1.0.1","color-convert":"^0.5.2","color-style":"^1.0.0","randf":"^1.0.0","smoothstep":"^1.0.1","tape":"^3.0.3","touch-position":"^1.0.3"},"scripts":{"test":"beefy test/test-draw.js --open"},"keywords":["triangulate","line","rendering","lines","2d","poly","line","polyline","path","outline","stroke","gl","webgl","glsl","stackgl"],"repository":{"type":"git","url":"git://github.com/mattdesl/extrude-polyline.git"},"homepage":"https://github.com/mattdesl/extrude-polyline","bugs":{"url":"https://github.com/mattdesl/extrude-polyline/issues"},"gitHead":"0aef5251484235a0659b1798a25b857917f0af52","_id":"extrude-polyline@1.0.1","_shasum":"c7ae118b0be5d01d46a67e8993b5e8568e0d8004","_from":".","_npmVersion":"2.1.4","_nodeVersion":"0.10.32","_npmUser":{"name":"mattdesl","email":"dave.des@gmail.com"},"maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"dist":{"shasum":"c7ae118b0be5d01d46a67e8993b5e8568e0d8004","tarball":"http://registry-npm.ywwl.com/extrude-polyline/download/extrude-polyline-1.0.1.tgz","integrity":"sha512-9Z+lPg6S7eeIfb6ExlybJcnZKo2FMOs0Eu1AKDwjXk1FfYkCXv6BcnK6U6fxSVYh9/y9W4vSYt/N9AxwUwForw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGoPADY36f21K6VCTppfGZnldCDHEMZ8kfoSEsIJaoQ+AiBNvUQONCI5I5uj3ZHteP7chg7G/k9c9s23CvAACY840Q=="}],"size":4073,"noattachment":false,"key":"/extrude-polyline/-/extrude-polyline-1.0.1.tgz"},"directories":{},"readme":"# extrude-polyline\n\n[![unstable](http://badges.github.io/stability-badges/dist/unstable.svg)](http://github.com/badges/stability-badges)\n\n![img](http://i.imgur.com/LGKsTj2.png)\n\nExtrudes a 2D polyline with a given line thickness and the desired join/cap types. Tries to maintain visual consistency with HTML5 2D context stroking.\n\n```js\nvar polylne = [ [25, 25], [15, 60] ]\nvar stroke = require('extrude-polyline')({ \n    thickness: 20, \n    cap: 'square',\n    join: 'bevel',\n    miterLimit: 10\n})\n\n//builds a triangulated mesh from a polyline\nvar mesh = stroke.build(polyline)\n```\n\nThe returned mesh is a simplicial complex.\n\n```js\n{\n    positions: [ [x,y], [x,y] ],\n    cells: [ [a,b,c], [a,b,c] ]\n}\n```\n\n## variable thickness\n\nCurrently, to achieve variable thickness you can provide a `mapThickness` function to the stroke instance before building. By default, it will simply return the current thickness.\n\n```js\n//create a falloff, so the thickness tapers toward the start of the path\nstroke.mapThickness = function(point, index, points) {\n    return this.thickness * index/(points.length-1)\n}.bind(stroke)\n```\n\n## demo\n\nGit clone, `npm install`, then `npm run test`\n\n## Usage\n\n[![NPM](https://nodei.co/npm/extrude-polyline.png)](https://nodei.co/npm/extrude-polyline/)\n\n#### `stroke = Extrusion([opt])`\n\nCreates a new path builder with the given settings:\n\n- `thickness` the line thickness\n- `miterLimit` the limit before miters turn into bevels; default 10\n- `join` the join type, can be `'miter'` or `'bevel'` - default 'miter'\n- `cap` the cap type, can be `'butt'` or `'square'` - defalut 'butt'\n\n#### `mesh = stroke.build(points)`\n\nBuilds a stroke with the specified list of 2D points. Returns a simplicial complex.\n\n## Roadmap\n\nSome features that could be useful to add at a later point. PRs welcome.\n\n- round corners\n- round end caps\n- use consistent winding order so we don't need to disable gl.CULLING\n- connecting start and end points \n- optimizations for flat arrays (Float32Array) ? \n- optimizations for GC (pooling, etc)\n- handling anti-aliasing\n- degenerate triangles or some other form of supporting disconnected lines\n- unify codebase with [polyline-normals](https://nodei.co/npm/polyline-normals/)\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/extrude-polyline/blob/master/LICENSE.md) for details.\n","publish_time":1416949388958,"_cnpm_publish_time":1416949388958,"dist-tags":{"latest":"1.0.6"}}