Created
January 18, 2021 01:54
-
-
Save ecarlisle/1a289b26f5bf37548ee12d6b4476642b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const rowWidth = 10; | |
const rows = [ | |
[50, 40, 30, 30, 50], | |
[20, 50, 60, 40, 30], | |
[40, 40, 30, 40, 50], | |
[30, 60, 30, 40, 40], | |
[20, 40, 50, 60, 30], | |
[50, 40, 30, 30, 50], | |
[20, 50, 60, 40, 30], | |
[40, 40, 30, 40, 50], | |
[30, 60, 30, 40, 40], | |
[20, 40, 50, 60, 30], | |
[50, 40, 30, 30, 50], | |
[20, 50, 60, 40, 30], | |
[40, 40, 30, 40, 50], | |
[30, 60, 30, 40, 40], | |
[20, 40, 50, 60, 30], | |
[50, 40, 30, 30, 50], | |
[20, 50, 60, 40, 30], | |
[40, 40, 30, 40, 50], | |
[30, 60, 30, 40, 40], | |
[20, 40, 50, 60, 30], | |
]; | |
function makeBoard(tx, ty, l) { | |
let board = cube({size: [rowWidth-1, l-1, 1.2], center: false}); | |
return translate([tx, ty, 0], board); | |
} | |
function makeFloor() { | |
let x = 0; | |
let y = 0; | |
let floor = []; | |
for (let i = 0; i < rows.length; i++) { | |
y = 0; | |
for (let j=0; j < rows[i].length; j++) { | |
floor.push(makeBoard(i * rowWidth, y, rows[i][j])); | |
y = y + rows[i][j]; | |
} | |
} | |
floor.push(cube({size: [200, 199, 0.4], center: false})) | |
return floor; | |
} | |
function main () { | |
return union(makeFloor()) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment