From b613b875369e27ce8b3c38969e7c4d1147f88624 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 24 Jun 2022 08:29:37 +0800 Subject: [PATCH] refactor --- src/experimental/_impl/_foliage_scroll_impl.scad | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/experimental/_impl/_foliage_scroll_impl.scad b/src/experimental/_impl/_foliage_scroll_impl.scad index fab57d85..f946b65d 100644 --- a/src/experimental/_impl/_foliage_scroll_impl.scad +++ b/src/experimental/_impl/_foliage_scroll_impl.scad @@ -36,7 +36,6 @@ function spiral_step(spiral, angle_step) = sa = spiral_startAngle(spiral), as = spiral_angleSign(spiral), a = spiral_angle(spiral) + angle_step - ) spiral( c, @@ -93,7 +92,8 @@ function try_create_spiral(width, height, spirals, i, min_radius) = out_size(width, height, cx, cy, cr) || overlapped(spirals, i, cx, cy, cr) ? undef : spiral([cx, cy], cr, ca, -angleSign); function out_size(width, height, cx, cy, cr) = - cx < -width / 2 + cr || cx > width / 2 - cr || cy < -height / 2 + cr || cy > height / 2 - cr; + let(half_width = width / 2, half_height = height / 2) + cx < -half_width + cr || cx > half_width - cr || cy < -half_height + cr || cy > half_height - cr; function overlapped(spirals, i, cx, cy, cr, j = 0) = j == len(spirals) ? false :