{"_id":"extrude-polyline","_rev":"16-bdd1c37de9a8794cea0325969f86f3dd","name":"extrude-polyline","description":"triangulates a 2D polyline into a stroke","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.0":{"name":"extrude-polyline","version":"1.0.0","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-segment.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":"882d825cf545713d3efa3df1514bc55334db8e1a","_id":"extrude-polyline@1.0.0","_shasum":"3cbd1a0284885b99962a62f19915e2de421cf5d0","_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":"3cbd1a0284885b99962a62f19915e2de421cf5d0","tarball":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.0.tgz","integrity":"sha512-MUjSVGIzhyeaO6CssXv8dqF3oAtU9E9Rvu4c+ijDOkfS6J/ntpSF6zixEyVzLvs18gd2UN++xEJjwPxP0C+aGw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCnUyYnPqTffunbOqdn5uGlS39zktEvJvS9n1X7da2t4AIgIEv91dWFO2UDul42CDx174iQaMEkGMfV2jz9NbQ+lF4="}]}},"1.0.1":{"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":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.1.tgz","integrity":"sha512-9Z+lPg6S7eeIfb6ExlybJcnZKo2FMOs0Eu1AKDwjXk1FfYkCXv6BcnK6U6fxSVYh9/y9W4vSYt/N9AxwUwForw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGoPADY36f21K6VCTppfGZnldCDHEMZ8kfoSEsIJaoQ+AiBNvUQONCI5I5uj3ZHteP7chg7G/k9c9s23CvAACY840Q=="}]}},"1.0.2":{"name":"extrude-polyline","version":"1.0.2","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","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":"c5b05ffc3f16a1a87659e9b22f061be4392bc85f","_id":"extrude-polyline@1.0.2","_shasum":"a87f4cbfcad7d3c60ce5f19b85eddf82e520e6fb","_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":"a87f4cbfcad7d3c60ce5f19b85eddf82e520e6fb","tarball":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.2.tgz","integrity":"sha512-Z1q2a7xSalQJKk2BcnTFovi2saTCXLyjgRnQI2xFy/b45bBcfSya+cBTSsGyEmswSmyOVZpR/jn8Qq9A6lWJiQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDH1OKm1A4YXOBO2elSyv42DGULYaGTsGnZm0yHnXKr4AIgaajwHgqwG2PX6fPmigqjMmKk3hD9s2OHbtZOj/BjXLA="}]}},"1.0.3":{"name":"extrude-polyline","version":"1.0.3","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","draw-triangles-2d":"^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","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":"afe16fc4d22765be3d1dd15ae4b19c908623af53","_id":"extrude-polyline@1.0.3","_shasum":"bcead68f291d16eada984c71ec37f5c27251c0d3","_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":"bcead68f291d16eada984c71ec37f5c27251c0d3","tarball":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.3.tgz","integrity":"sha512-O90SY5lJthYl2r2+LwdHCxrfoFrv7GYt8Trb+uzWva8/OGyjJqf3sWwCRuYBnTznHYbTxEUqccLcvFbqHdqkdA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCv40r9N37cif5vPcH3n9IaFMCDeDZONySv4GBCbSbwSQIgL1IqpulEok0PbYWFQL27wh3f3xGDHjaRooRKo0TNIuo="}]}},"1.0.4":{"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":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.4.tgz","integrity":"sha512-akIGDeSWSXX4aN5E2o1C0zIhrHuZdmI2JN4XVlLULA54ak7AGoaLjCpQBwTYSUInfHdx0/ELc8dMeWgvq5Gw4w==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAMt1sSI61k5Fhuh0nROuVQ9IZntPFp8j1ab8P/YUR4KAiEAl1hxtlSUipztwHRwb86nVlMd7LtNCrN+V7bjcOga910="}]}},"1.0.5":{"name":"extrude-polyline","version":"1.0.5","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.1"},"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":"2f4283db9a7ab2e3099f59b9b9e9eb07cf094600","_id":"extrude-polyline@1.0.5","_shasum":"7511bd09195b729c9125f5f84173781d55789fb7","_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":"7511bd09195b729c9125f5f84173781d55789fb7","tarball":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.5.tgz","integrity":"sha512-7vUtDgFv7rA12A1EaW3Kdg5xVAPp6JYebetNaWStjBh5OmuNCosfE02shHZKjsrUj7+bP7qbpvgq2PdL/49uIQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEig25oxfIt1iYZ38u3iht4jArU7gojfVihVyMNuyg2VAiBWi2q9kAqHShGRCyK/iPUW2SuUQVsaHZVPanRaHAEVCA=="}]}},"1.0.6":{"name":"extrude-polyline","version":"1.0.6","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.1"},"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":"277e25782459891e5e31fac666e0c3d7ea495361","_id":"extrude-polyline@1.0.6","_shasum":"7e6afe1f349a4182fa3f61a00d93979b95f18b20","_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":"7e6afe1f349a4182fa3f61a00d93979b95f18b20","tarball":"https://registry.npmjs.org/extrude-polyline/-/extrude-polyline-1.0.6.tgz","integrity":"sha512-fcKIanU/v+tcdgG0+xMbS0C2VZ0/CF3qqxSjHiWfWICh0yFBezPr3SsOhgdzwE5E82plG6p1orEsfSqgldpxVg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICQQJdf+IBTnPPyL5vcFZvtR0pci9LUYcmJ554phRbDhAiBH0//l0/r0asTdEadHKOrISNDHCeVpUahc4LIN3QANTA=="}]}}},"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","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2022-06-17T23:01:02.655Z","created":"2014-11-25T20:31:39.582Z","1.0.0":"2014-11-25T20:31:39.582Z","1.0.1":"2014-11-25T21:03:08.958Z","1.0.2":"2014-11-25T22:44:00.855Z","1.0.3":"2014-11-27T19:38:31.635Z","1.0.4":"2014-11-27T19:39:30.461Z","1.0.5":"2014-11-28T15:55:50.472Z","1.0.6":"2014-11-28T18:56:33.025Z"},"homepage":"https://github.com/mattdesl/extrude-polyline","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"},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"bugs":{"url":"https://github.com/mattdesl/extrude-polyline/issues"},"license":"MIT","readmeFilename":"README.md"}