From 06831ffe15c9b0804b2de592284ecf65fed4279d Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Sat, 15 Jun 2019 10:56:33 +0800 Subject: [PATCH] c-style for loop --- src/along_with.scad | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/along_with.scad b/src/along_with.scad index 39ced260..268c20a8 100644 --- a/src/along_with.scad +++ b/src/along_with.scad @@ -48,16 +48,16 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") ]; function axis_angle_local_ang_vects(j) = - j == 0 ? [] : axis_angle_local_ang_vects_sub(j); - - function axis_angle_local_ang_vects_sub(j) = - let( - vt0 = points[j] - points[j - 1], - vt1 = points[j + 1] - points[j], - a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))), - v = cross(vt0, vt1) - ) - concat([[a, v]], axis_angle_local_ang_vects(j - 1)); + [ + for(i = j; i > 0; i = i - 1) + let( + vt0 = points[i] - points[i - 1], + vt1 = points[i + 1] - points[i], + a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))), + v = cross(vt0, vt1) + ) + [a, v] + ]; function axis_angle_cumulated_rot_matrice(i, rot_matrice) = let(