1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-01-17 22:28:16 +01:00

c-style for loop

This commit is contained in:
Justin Lin 2019-06-14 08:38:24 +08:00
parent 3fb08570c6
commit e185e9b7e9

View File

@ -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]]
]