1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-20 13:31:30 +02:00

c-style for loop

This commit is contained in:
Justin Lin
2019-06-15 10:56:33 +08:00
parent df5775bd05
commit 06831ffe15

View File

@@ -48,16 +48,16 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
]; ];
function axis_angle_local_ang_vects(j) = function axis_angle_local_ang_vects(j) =
j == 0 ? [] : axis_angle_local_ang_vects_sub(j); [
for(i = j; i > 0; i = i - 1)
function axis_angle_local_ang_vects_sub(j) = let(
let( vt0 = points[i] - points[i - 1],
vt0 = points[j] - points[j - 1], vt1 = points[i + 1] - points[i],
vt1 = points[j + 1] - points[j], a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))),
a = acos((vt0 * vt1) / (norm(vt0) * norm(vt1))), v = cross(vt0, vt1)
v = cross(vt0, vt1) )
) [a, v]
concat([[a, v]], axis_angle_local_ang_vects(j - 1)); ];
function axis_angle_cumulated_rot_matrice(i, rot_matrice) = function axis_angle_cumulated_rot_matrice(i, rot_matrice) =
let( let(