{"name":"extrude-polyline","version":"1.0.4","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","polyline-miter-util":"^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","draw-triangles-2d":"^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","test-basic":"node test/test"},"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":"97fe2ac92b0c7cf1f6e4d80f065dac1f9ef681e8","_id":"extrude-polyline@1.0.4","_shasum":"2e78d59bc87fed702122171005643fac6a342648","_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":"2e78d59bc87fed702122171005643fac6a342648","tarball":"http://registry-npm.ywwl.com/extrude-polyline/download/extrude-polyline-1.0.4.tgz","integrity":"sha512-akIGDeSWSXX4aN5E2o1C0zIhrHuZdmI2JN4XVlLULA54ak7AGoaLjCpQBwTYSUInfHdx0/ELc8dMeWgvq5Gw4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAMt1sSI61k5Fhuh0nROuVQ9IZntPFp8j1ab8P/YUR4KAiEAl1hxtlSUipztwHRwb86nVlMd7LtNCrN+V7bjcOga910="}],"size":4094,"noattachment":false,"key":"/extrude-polyline/-/extrude-polyline-1.0.4.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":1417117170461,"_cnpm_publish_time":1417117170461,"dist-tags":{"latest":"1.0.6"}}