mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-12 01:34:12 +02:00
refactor
This commit is contained in:
@@ -21,13 +21,6 @@ function _mz_hamiltonian_top_right(x, y) =
|
|||||||
)
|
)
|
||||||
[[nx, ny + 2], [nx + 1, ny + 2], [nx + 2, ny + 2], [nx + 2, ny + 1], [nx + 2, ny]];
|
[[nx, ny + 2], [nx + 1, ny + 2], [nx + 2, ny + 2], [nx + 2, ny + 1], [nx + 2, ny]];
|
||||||
|
|
||||||
function _mz_hamiltonian_mask(x, y) =
|
|
||||||
let(
|
|
||||||
nx = x * 2,
|
|
||||||
ny = y * 2
|
|
||||||
)
|
|
||||||
[[nx, ny], [nx, ny + 2], [nx + 1, ny + 2], [nx + 2, ny + 2], [nx + 2, ny + 1], [nx + 2, ny]];
|
|
||||||
|
|
||||||
function _mz_hamiltonian_corner_value(dots, x, y) =
|
function _mz_hamiltonian_corner_value(dots, x, y) =
|
||||||
let(
|
let(
|
||||||
c1 = has(dots, [x, y], sorted = true) ? 1 : 0,
|
c1 = has(dots, [x, y], sorted = true) ? 1 : 0,
|
||||||
|
@@ -31,13 +31,13 @@ function mz_hamiltonian(rows, columns, start = [0, 0], init_cells, seed) =
|
|||||||
let(type = mz_square_get(cell, "t"))
|
let(type = mz_square_get(cell, "t"))
|
||||||
each if(type == "TOP_WALL") _mz_hamiltonian_top(cell.x, cell.y) else
|
each if(type == "TOP_WALL") _mz_hamiltonian_top(cell.x, cell.y) else
|
||||||
if(type == "RIGHT_WALL") _mz_hamiltonian_right(cell.x, cell.y) else
|
if(type == "RIGHT_WALL") _mz_hamiltonian_right(cell.x, cell.y) else
|
||||||
if(type == "TOP_RIGHT_WALL") _mz_hamiltonian_top_right(cell.x, cell.y) else
|
if(type == "TOP_RIGHT_WALL" || type == "MASK") _mz_hamiltonian_top_right(cell.x, cell.y)
|
||||||
if(type == "MASK") _mz_hamiltonian_mask(cell.x, cell.y)
|
|
||||||
|
|
||||||
],
|
],
|
||||||
[for(x = [0:c * 2 - 1]) [x, 0]],
|
[for(x = [0:c * 2 - 1]) [x, 0]],
|
||||||
[for(y = [0:r * 2 - 1]) [0, y]]
|
[for(y = [0:r * 2 - 1]) [0, y]]
|
||||||
),
|
),
|
||||||
dot_pts = dedup(sort(all, by = "vt"))
|
dot_pts = dedup(sort(all, by = "vt")),
|
||||||
|
_ = echo(dot_pts)
|
||||||
)
|
)
|
||||||
_mz_hamiltonian_travel(dot_pts, start * 2, r * c * 4);
|
_mz_hamiltonian_travel(dot_pts, start * 2, r * c * 4);
|
Reference in New Issue
Block a user