{"_id":"draw-triangles-2d","_rev":"4-3b2e3214649c3fb4a65c42b93090111f","name":"draw-triangles-2d","description":"draws a simplicial complex using Canvas2D context","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"draw-triangles-2d","version":"1.0.0","description":"draws a simplicial complex using Canvas2D context","main":"index.js","license":"MIT","author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"dependencies":{},"devDependencies":{"canvas-testbed":"^1.0.3","extrude-polyline":"^1.0.2","tape":"^3.0.3"},"scripts":{"test":"node test.js"},"keywords":["simplicial","complex","2d","mesh","triangles","cells","positions","draw"],"repository":{"type":"git","url":"git://github.com/mattdesl/draw-triangles-2d.git"},"homepage":"https://github.com/mattdesl/draw-triangles-2d","bugs":{"url":"https://github.com/mattdesl/draw-triangles-2d/issues"},"gitHead":"dfb05cbe5ff6866327a0e7453d6369848d3ce567","_id":"draw-triangles-2d@1.0.0","_shasum":"addf774fa1e06925fdd71443049baf83441329c8","_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":"addf774fa1e06925fdd71443049baf83441329c8","tarball":"https://registry.npmjs.org/draw-triangles-2d/-/draw-triangles-2d-1.0.0.tgz","integrity":"sha512-Be4+8jRXowVrlBWolEbMAnDlBxJ2CdbIrd2PcRHvUVKAlYpV3o3iWXcguT/HXukIkMjdKEaVXzR03g7BdvUR7A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC1Lfb4rxJ6vlmo9X/uTvv6rhAMnfZwz856dSqSExgQWAIhAKeBYQ0OZMsCeX3nM24zy9jTZZSrx3evHWXb7hNWjo69"}]}}},"readme":"# draw-triangles-2d\n\n[![stable](http://badges.github.io/stability-badges/dist/stable.svg)](http://github.com/badges/stability-badges)\n\nDraws indexed triangles from a simplicial complex using Canvas2D context. \n\nPositions and cells look like this:\n\n```js\n{ positions: [ [25,25], [50, 50], ... ], cells: [ [0,1,2], [1,2,3], ... ] }\n```\n\nDemo:\n\n```js\nvar drawTriangles = require('draw-triangles-2d')\n\nvar path = [ [25, 25], [40, 30], [50, 75], [125, 15] ]\n\n//get a thick polyline\nvar mesh = require('extrude-polyline')({ \n    thickness: 20,\n    miterLimit: 1.5\n}).build(path)\n\nfunction render(ctx, width, height) {\n    ctx.clearRect(0,0,width,height)\n\n    ctx.beginPath()\n    drawTriangles(ctx, mesh.positions, mesh.cells)\n    ctx.strokeStyle = 'black'\n    ctx.lineJoin = 'bevel'\n    ctx.stroke()\n}\n```\n\nSimplicial complexes are a common ground between various modules, such as [triangulate-contours](https://www.npmjs.org/package/triangulate-contours), [extrude-polyline](https://www.npmjs.org/package/extrude-polyline), etc. \n\n## Usage\n\n[![NPM](https://nodei.co/npm/draw-triangles-2d.png)](https://nodei.co/npm/draw-triangles-2d/)\n\n#### `draw(context, positions, cells[, start, end])`\n\nDraws the 2D positions and triangle cells (i.e. indices into positions) to the given context. You can specify `start` (inclusive) and `end` (exclusive) indices to only render a sub range of the cells. These values defualt to 0 and the length of `cells`, respectively.\n\n## License\n\nMIT, see [LICENSE.md](http://github.com/mattdesl/draw-triangles-2d/blob/master/LICENSE.md) for details.\n","maintainers":[{"name":"mattdesl","email":"dave.des@gmail.com"}],"time":{"modified":"2022-06-15T23:56:08.119Z","created":"2014-11-26T16:32:41.043Z","1.0.0":"2014-11-26T16:32:41.043Z"},"homepage":"https://github.com/mattdesl/draw-triangles-2d","keywords":["simplicial","complex","2d","mesh","triangles","cells","positions","draw"],"repository":{"type":"git","url":"git://github.com/mattdesl/draw-triangles-2d.git"},"author":{"name":"Matt DesLauriers","email":"dave.des@gmail.com","url":"https://github.com/mattdesl"},"bugs":{"url":"https://github.com/mattdesl/draw-triangles-2d/issues"},"license":"MIT","readmeFilename":"README.md"}