From 65116cbc783eebaac370425cefde85edd6dab9ee Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Tue, 15 Mar 2022 20:43:21 +0800 Subject: [PATCH] refactor --- src/maze/_impl/_mz_theta_cells.scad | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/maze/_impl/_mz_theta_cells.scad b/src/maze/_impl/_mz_theta_cells.scad index 341d02f2..1460631a 100644 --- a/src/maze/_impl/_mz_theta_cells.scad +++ b/src/maze/_impl/_mz_theta_cells.scad @@ -194,12 +194,10 @@ function nextCells(maze, cell, dir) = cw = get_cw(cell), ccw = get_ccw(cell) ) - [ - is_undef(inward) ? [] : [cell_from(maze, inward)], - is_undef(outwards) ? [] : [for(outward = outwards) cell_from(maze, outward)], - is_undef(cw) ? [] : [cell_from(maze, cw)], - is_undef(ccw) ? [] : [cell_from(maze, ccw)] - ][dir]; + dir == 0 ? (is_undef(inward) ? [] : [cell_from(maze, inward)]) : + dir == 1 ? (is_undef(outwards) ? [] : [for(outward = outwards) cell_from(maze, outward)]) : + dir == 2 ? (is_undef(cw) ? [] : [cell_from(maze, cw)]) : + (is_undef(ccw) ? [] : [cell_from(maze, ccw)]); function visitIN(maze, next, currentCell) = update_maze(