From b03c8b4a5dcaa31b1c504d2b642f24fd4674cc81 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 29 May 2017 17:26:11 +0800 Subject: [PATCH] refactored --- src/hexagons.scad | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/hexagons.scad b/src/hexagons.scad index 5bd8415b..39ef07e3 100644 --- a/src/hexagons.scad +++ b/src/hexagons.scad @@ -36,12 +36,15 @@ module hexagons(radius, spacing, levels) { line_hexagons(beginning_n); if(levels > 1) { - for(i = [1:beginning_n - (levels)]) { - translate([offset_x * i, offset_y * i, 0]) + for(i = [1:beginning_n - levels]) { + x = offset_x * i; + y = offset_y * i; + + translate([x, y, 0]) + line_hexagons(beginning_n - i); + + translate([x, -y, 0]) line_hexagons(beginning_n - i); - mirror([0, 1, 0]) - translate([offset_x * i, offset_y * i, 0]) - line_hexagons(beginning_n - i); } } }