From 3b917459765e8bd830b058f78e4fc6b4911c8a47 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Mon, 29 May 2017 17:18:42 +0800 Subject: [PATCH] refactored --- src/hexagons.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hexagons.scad b/src/hexagons.scad index 47041be6..5bd8415b 100644 --- a/src/hexagons.scad +++ b/src/hexagons.scad @@ -16,6 +16,7 @@ module hexagons(radius, spacing, levels) { offset_x = radius * cos(30); offset_y = radius + radius * sin(30); r_hexagon = radius - spacing / 2; + offset_step = 2 * offset_x; module hexagon() { rotate(30) @@ -23,9 +24,8 @@ module hexagons(radius, spacing, levels) { } module line_hexagons(n) { - offset = 2 * offset_x; for(i = [0:n - 1]) { - offset_p = [i * offset, 0, 0]; + offset_p = [i * offset_step, 0, 0]; translate(offset_p) hexagon(); }