1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-24 09:33:26 +01:00
dotSCAD/examples/maze/random_scala.scad
2020-03-05 08:45:39 +08:00

27 lines
661 B
OpenSCAD

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