1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-20 21:41:41 +02:00
This commit is contained in:
Justin Lin
2022-03-17 16:28:04 +08:00
parent 4b24c81eeb
commit 4a5c576630

View File

@@ -28,15 +28,11 @@ function mz_hamiltonian(rows, columns, start = [0, 0], init_cells, seed) =
all = concat( all = concat(
[ [
for(cell = cells) for(cell = cells)
let( let(type = mz_square_get(cell, "t"))
x = cell.x, each if(type == "TOP_WALL") _mz_hamiltonian_top(cell.x, cell.y) else
y = cell.y, if(type == "RIGHT_WALL") _mz_hamiltonian_right(cell.x, cell.y) else
type = mz_square_get(cell, "t") if(type == "TOP_RIGHT_WALL") _mz_hamiltonian_top_right(cell.x, cell.y) else
) if(type == "MASK") _mz_hamiltonian_mask(cell.x, cell.y)
each if(type == "TOP_WALL") _mz_hamiltonian_top(x, y) else
if(type == "RIGHT_WALL") _mz_hamiltonian_right(x, y) else
if(type == "TOP_RIGHT_WALL") _mz_hamiltonian_top_right(x, y) else
if(type == "MASK") _mz_hamiltonian_mask(x, y)
], ],
[for(x = [0:c * 2 - 1]) [x, 0]], [for(x = [0:c * 2 - 1]) [x, 0]],
@@ -44,4 +40,4 @@ function mz_hamiltonian(rows, columns, start = [0, 0], init_cells, seed) =
), ),
dot_pts = dedup(sort(all, by = "vt")) dot_pts = dedup(sort(all, by = "vt"))
) )
_mz_hamiltonian_travel(dot_pts, start * 3, r * c * 4); _mz_hamiltonian_travel(dot_pts, start * 2, r * c * 4);