Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

orthogami

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

orthogami - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

mario1.svg

9

index.js

@@ -70,2 +70,5 @@ "use strict"

//Units for the SVG files
var units = options.units || "px"
//Extract faces/normals from mesh

@@ -76,2 +79,3 @@ var result = getFaces(padded)

//Compute topology

@@ -98,3 +102,4 @@ var links = getLinks(faces, normals)

//Pack pieces into sheets
return combinePieces(pieces, boxSize, scale)
}
return combinePieces(pieces, boxSize, scale, units)
}

@@ -5,3 +5,4 @@ var boxpack = require('boxpack')

function packSVGData(sheets, boxSize, scale) {
function packSVGData(sheets, boxSize, scale, units) {
var pages = []

@@ -64,4 +65,5 @@ while(sheets.length > 0) {

'xmlns:xlink="http://www.w3.org/1999/xlink" ',
'width="', pageSize[0], '" ',
'height="', pageSize[1], '">'
'width="', pageSize[0], units, '" ',
'height="', pageSize[1], units, '" ',
'viewBox="0 0 ', pageSize[0], ' ', pageSize[1], '">'
]

@@ -68,0 +70,0 @@ for(var i=0; i<packed.length; ++i) {

@@ -14,3 +14,4 @@ var project = require('./project')

projection,
scale) {
scale,
strokeWidth) {

@@ -83,3 +84,3 @@ var svg = []

var color = colorMap(value)
svg.push('<path stroke="', color, '" fill="', color, '" d="')
svg.push('<path stroke="', color, '" stroke-width="', strokeWidth, '" fill="', color, '" d="')
var path = []

@@ -278,3 +279,4 @@ for(var du=0; du<2; ++du) {

projections[i],
scale)
scale,
strokeWidth)
guts.push(result[0])

@@ -281,0 +283,0 @@ var b = result[1]

{
"name": "orthogami",
"version": "1.0.1",
"version": "1.1.0",
"description": "Turn voxel models into papercraft",

@@ -18,3 +18,5 @@ "main": "index.js",

},
"devDependencies": {},
"devDependencies": {
"ndarray-pack": "^1.1.1"
},
"scripts": {

@@ -21,0 +23,0 @@ "test": "echo \"Error: no test specified\" && exit 1"

@@ -24,8 +24,6 @@ orthogami

var options = {
bounds: [300, 300], //Page size
scale: 50, //Size of each voxel face
colorMap: ['black', 'red', 'green', 'blue', 'yellow'], //Colors (can be a function)
convexColor: 'magenta', //Color for crease lines
concaveColor: 'turquoise',
lineWidth: 1 //Width for lines
units: 'mm', //Units
bounds: [210, 297], //Page size
scale: 10, //Size of voxel
lineWidth: 0.1 //Size of dashed line
}

@@ -75,2 +73,3 @@

+ `lineWidth` the width of the crease lines (default `1`)
+ `units` the units for the coordinate system (default `'px'`)

@@ -77,0 +76,0 @@ **Returns** An array of SVG files encoding the pages of the origami printout

@@ -7,4 +7,9 @@ var fs = require('fs')

orthogami(voxels).forEach(function(svg, idx) {
orthogami(voxels, {
"units": "mm", //Units
"bounds": [210, 297], //Page size
"scale": 10, //Size of voxel
"lineWidth": 0.1 //Size of dashed line
}).forEach(function(svg, idx) {
fs.writeFileSync("mario" + idx + ".svg", svg)
})

@@ -9,10 +9,12 @@ "use strict"

/*
[ [0,0,0,0],
[
[0,1,0,0],
[1,1,1,0],
[0,1,0,0],
[0,0,0,0] ],
[1,1,1,0],
[1,0,1,0] ],
[ [0,0,0,0],
[0,1,1,0],
[1,0,1,0],
[0,0,0,0],
[0,0,0,0],
[0,0,0,0] ],

@@ -22,2 +24,3 @@ [ [0,0,0,0],

[0,0,0,0],
[0,0,0,0],
[0,0,0,0] ],

@@ -27,5 +30,6 @@ [ [0,0,0,0],

[0,0,0,0],
[0,0,0,0],
[0,0,0,0] ]
*/
/*
[ [1,0],

@@ -38,6 +42,7 @@ [1,0],

[1,1],
[1,0] ]
[1,0] ]*/
])
unfold(cube, {bounds: [1000, 500]}).map(function(svg, idx) {
unfold(cube, {bounds:[300,500], size:50}).map(function(svg, idx) {
console.log("data:", idx, "--:")

@@ -44,0 +49,0 @@ console.log(svg)

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc