From 438e9cfd935aeef7aee45bd21f5e032dc9ed2506 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 4 Apr 2022 15:35:21 +0800 Subject: [PATCH] refactor: extract lines --- examples/hollow_out/hollow_out_square.scad | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/examples/hollow_out/hollow_out_square.scad b/examples/hollow_out/hollow_out_square.scad index 7be39ace..32f1fb4c 100644 --- a/examples/hollow_out/hollow_out_square.scad +++ b/examples/hollow_out/hollow_out_square.scad @@ -21,12 +21,11 @@ function h_lines_in_square(width) = function hollow_out_square(size, width) = let( columns = size[0], - rows = size[1] + rows = size[1], + lines = h_lines_in_square(width) ) [ - for(y = [0:width:width * rows - width], - x = [0:width:width * columns - width], - line = h_lines_in_square(width) - ) - [for(p = line) p + [x, y]] + for(y = [0:width:width * rows - width], x = [0:width:width * columns - width]) + let(coord = [x, y]) + for(line = lines) [for(p = line) p + coord] ]; \ No newline at end of file