orthogami
Voxel origami generator. Works in node.js and browserify.
Example usage
//First create a voxel set// 0 = emptyvar voxels = 0 1 2 3 0 0 0 4 //Require the module (works with browserify)var orthogami = //Set up options (can skip this if you like)var options = units: 'mm' //Units bounds: 210 297 //Page size scale: 10 //Size of voxel lineWidth: 01 //Size of dashed line //Then run orthogamivar svgs = //Print out the resultvar fs = svgs
Output
Page 1:
Page 2:
Install
npm install orthogami
API
require('orthogami')(voxels[, options])
Generates an origami template for folding a model from the given voxel object.
-
voxels
is a 3D ndarray of integer values.0
values indicate empty voxels. -
options
is an optional object containing any of the following extra parameters:colorMap
a function mapping color values in the voxels to SVG color names, or alternatively an array of SVG color names.bounds
a 2D array representing the size of each page (default[Infinity, Infinity]
)scale
a number giving the size of each voxel (default64
)convexColor
the color of the convex creases (default'black'
)concaveColor
the color of the concave creases (default'white'
)tabColor
the color of the tab lines (default'black'
)lineWidth
the width of the crease lines (default1
)units
the units for the coordinate system (default'px'
)
Returns An array of SVG files encoding the pages of the origami printout
Credits
(c) 2014 Mikola Lysenko. MIT License