From 4b24c81eebe1b5e5c610eca5e108643247d6fd64 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Thu, 17 Mar 2022 16:21:46 +0800 Subject: [PATCH] support mask --- src/maze/_impl/_mz_hamiltonian_impl.scad | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/maze/_impl/_mz_hamiltonian_impl.scad b/src/maze/_impl/_mz_hamiltonian_impl.scad index edf7a2af..c73f8855 100644 --- a/src/maze/_impl/_mz_hamiltonian_impl.scad +++ b/src/maze/_impl/_mz_hamiltonian_impl.scad @@ -21,6 +21,13 @@ 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]]; +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) = let( c1 = has(dots, [x, y], sorted = true) ? 1 : 0,