1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-07 07:16:36 +02:00
This commit is contained in:
Justin Lin
2020-03-05 08:45:39 +08:00
parent e52d9fb0f5
commit 3847a0b6d4

View File

@@ -2,14 +2,15 @@ use <experimental/mz_hamiltonian.scad>;
module random_scala(start, rows, columns, width, height) { module random_scala(start, rows, columns, width, height) {
line = mz_hamiltonian(start, rows, columns); line = mz_hamiltonian(start, rows, columns);
leng = len(line);
for(i = [0:len(line) - 1]) { for(i = [0:leng - 1]) {
p1 = line[i]; p1 = line[i];
translate(p1) translate(p1)
linear_extrude(height * i * 2 + height) linear_extrude(height * i * 2 + height)
square(width + 0.01, center = true); square(width + 0.01, center = true);
p2 = line[(i + 1) % len(line)]; p2 = line[(i + 1) % leng];
translate(p1 + (p2 - p1) / 2) translate(p1 + (p2 - p1) / 2)
linear_extrude(height * (2 * i + 1) + height) linear_extrude(height * (2 * i + 1) + height)