From e185e9b7e94ac5820169f6d525061586b6b473c0 Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 14 Jun 2019 08:38:24 +0800 Subject: [PATCH] c-style for loop --- src/shape_glued2circles.scad | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/shape_glued2circles.scad b/src/shape_glued2circles.scad index 73318d19..e11db544 100644 --- a/src/shape_glued2circles.scad +++ b/src/shape_glued2circles.scad @@ -12,10 +12,11 @@ function _glued2circles_pie_curve(radius, centre_dist, tangent_angle) = let( begin_ang = 90 + tangent_angle, - shape_pts = shape_pie(radius, [-begin_ang, begin_ang]) + shape_pts = shape_pie(radius, [-begin_ang, begin_ang]), + leng = len(shape_pts) ) [ - for(i = [1:len(shape_pts) - 1]) + for(i = 1; i < leng; i = i + 1) shape_pts[i] + [centre_dist / 2, 0] ]; @@ -53,7 +54,7 @@ function _glued2circles_half_glued_circle(radius, centre_dist, tangent_angle, t_ lower_curve_pts = _glued2circles_lower_half_curve(curve_pts, len(curve_pts)), leng_half_curve_pts = len(lower_curve_pts), upper_curve_pts = [ - for(i = [0:leng_half_curve_pts - 1]) + for(i = 0; i < leng_half_curve_pts; i = i + 1) let(pt = lower_curve_pts[leng_half_curve_pts - 1 - i]) [pt[0], -pt[1]] ] @@ -68,7 +69,7 @@ function shape_glued2circles(radius, centre_dist, tangent_angle = 30, t_step = 0 half_glued_circles = _glued2circles_half_glued_circle(radius, centre_dist, tangent_angle, t_step), leng_half_glued_circles = len(half_glued_circles), left_half_glued_circles = [ - for(i = [0:leng_half_glued_circles - 1]) + for(i = 0; i < leng_half_glued_circles; i = i + 1) let(pt = half_glued_circles[leng_half_glued_circles - 1 - i]) [-pt[0], pt[1]] ]