From 699de29c5381479bdc5a837dae4321699b12329f Mon Sep 17 00:00:00 2001 From: Justin Lin Date: Fri, 31 May 2019 10:09:49 +0800 Subject: [PATCH] rename --- src/along_with.scad | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/src/along_with.scad b/src/along_with.scad index e6739552..cafc323a 100644 --- a/src/along_with.scad +++ b/src/along_with.scad @@ -45,19 +45,19 @@ module along_with(points, angles, twist = 0, scale = 1.0) { [0, 0, 0, 1] ]; - function local_ang_vects(j) = - j == 0 ? [] : local_ang_vects_sub(j); + function axis_angle_local_ang_vects(j) = + j == 0 ? [] : axis_angle_local_ang_vects_sub(j); - function 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]], local_ang_vects(j - 1)); + concat([[a, v]], axis_angle_local_ang_vects(j - 1)); - function cumulated_rot_matrice(i, rot_matrice) = + function axis_angle_cumulated_rot_matrice(i, rot_matrice) = let( leng_rot_matrice = len(rot_matrice), leng_rot_matrice_minus_one = leng_rot_matrice - 1, @@ -70,13 +70,13 @@ module along_with(points, angles, twist = 0, scale = 1.0) { rot_matrice[leng_rot_matrice_minus_one], rot_matrice[leng_rot_matrice_minus_two] * rot_matrice[leng_rot_matrice_minus_one] ] - : cumulated_rot_matrice_sub(i, rot_matrice) + : axis_angle_cumulated_rot_matrice_sub(i, rot_matrice) ) ); - function cumulated_rot_matrice_sub(i, rot_matrice) = + function axis_angle_cumulated_rot_matrice_sub(i, rot_matrice) = let( - matrice = cumulated_rot_matrice(i + 1, rot_matrice), + matrice = axis_angle_cumulated_rot_matrice(i + 1, rot_matrice), curr_matrix = rot_matrice[i], prev_matrix = matrice[len(matrice) - 1] ) @@ -84,7 +84,7 @@ module along_with(points, angles, twist = 0, scale = 1.0) { // align modules - module align_with_pts_angles(i) { + module axis_angle_align_with_pts_angles(i) { translate(points[i]) rotate(angles[i]) rotate(twist_step_a * i) @@ -92,7 +92,7 @@ module along_with(points, angles, twist = 0, scale = 1.0) { children(0); } - module align_with_pts_init(a, s) { + module axis_angle_align_with_pts_init(a, s) { angleyz = __angy_angz(points[0], points[1]); rotate([0, -angleyz[0], angleyz[1]]) rotate([90, 0, -90]) @@ -101,14 +101,14 @@ module along_with(points, angles, twist = 0, scale = 1.0) { children(0); } - module align_with_pts_local_rotate(j, init_a, init_s, cumu_rot_matrice) { + module axis_angle_align_with_pts_local_rotate(j, init_a, init_s, cumu_rot_matrice) { if(j == 0) { // first child - align_with_pts_init(init_a, init_s) + axis_angle_align_with_pts_init(init_a, init_s) children(0); } else { multmatrix(cumu_rot_matrice[j - 1]) - align_with_pts_init(init_a, init_s) + axis_angle_align_with_pts_init(init_a, init_s) children(0); } } @@ -116,34 +116,34 @@ module along_with(points, angles, twist = 0, scale = 1.0) { if(angles_defined) { if($children == 1) { for(i = [0:leng_points_minus_one]) { - align_with_pts_angles(i) children(0); + axis_angle_align_with_pts_angles(i) children(0); } } else { for(i = [0:min(leng_points, $children) - 1]) { - align_with_pts_angles(i) children(i); + axis_angle_align_with_pts_angles(i) children(i); } } } else { - cumu_rot_matrice = cumulated_rot_matrice(0, [ - for(ang_vect = local_ang_vects(leng_points - 2)) + cumu_rot_matrice = axis_angle_cumulated_rot_matrice(0, [ + for(ang_vect = axis_angle_local_ang_vects(leng_points - 2)) m_rotation(ang_vect[0], ang_vect[1]) ]); translate(points[0]) - align_with_pts_local_rotate(0, 0, [1, 1, 1], cumu_rot_matrice) + axis_angle_align_with_pts_local_rotate(0, 0, [1, 1, 1], cumu_rot_matrice) children(0); if($children == 1) { for(i = [0:leng_points - 2]) { translate(points[i + 1]) - align_with_pts_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) + axis_angle_align_with_pts_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) children(0); } } else { for(i = [0:min(leng_points, $children) - 2]) { translate(points[i + 1]) - align_with_pts_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) + axis_angle_align_with_pts_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) children(i + 1); } }