diff --git a/docs/lib3x-along_with.md b/docs/lib3x-along_with.md index fd1cd765..761a924b 100644 --- a/docs/lib3x-along_with.md +++ b/docs/lib3x-along_with.md @@ -73,8 +73,7 @@ Puts children along the given path. If there's only one child, it will put the c scale([2, 1]) circle(1.25, $fn = 24); } - - rotate([90, 0, 0]) + for(a = [0:30:330]) { rotate(a) translate([5, 0, 0]) diff --git a/examples/dragon/hilbert_dragon.scad b/examples/dragon/hilbert_dragon.scad index 4aca37b4..dcf3e668 100644 --- a/examples/dragon/hilbert_dragon.scad +++ b/examples/dragon/hilbert_dragon.scad @@ -42,7 +42,6 @@ module hilbert_dragon() { one_body_scale_data = one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a); along_with(dragon_body_path, scale = [0.425, 0.6, 0.425]) - rotate([90, 0, 0]) scale(0.035) one_segment(body_r, body_fn, one_body_scale_data); diff --git a/examples/dragon/infinity_dragon.scad b/examples/dragon/infinity_dragon.scad index d67007a3..9eccee1d 100644 --- a/examples/dragon/infinity_dragon.scad +++ b/examples/dragon/infinity_dragon.scad @@ -129,7 +129,7 @@ module infinity_dragon() { one_body_scale_data = one_body_scale(body_r, body_fn, scale_fn, scale_tilt_a); along_with(body_path, scale = [0.45, 0.7, 0.45]) - rotate([90, 90, 0]) + rotate([0, 0, -90]) one_segment(body_r, body_fn, one_body_scale_data); ayz = __angy_angz(body_path[leng_body_path - 2], body_path[leng_body_path - 1]); diff --git a/src/along_with.scad b/src/along_with.scad index 11c95bc9..ce4327c9 100644 --- a/src/along_with.scad +++ b/src/along_with.scad @@ -82,8 +82,7 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") module axis_angle_align_with_pts_angles(i) { translate(pts[i]) - rotate(angles[i]) - rotate(twist_step_a * i) + rotate(twist_step_a * i + angles[i]) scale([1, 1, 1] + scale_step_vt * i) children(0); } @@ -127,12 +126,20 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") ]; module euler_angle_align(i, angs) { - translate(pts[i]) - rotate(angs[i]) - rotate(angles_defined ? [0, 0, 0] : [90, 0, -90]) - rotate(twist_step_a * i) - scale([1, 1, 1] + scale_step_vt * i) - children(0); + if(angles_defined) { + translate(pts[i]) + rotate(twist_step_a * i + angs[i]) + scale([1, 1, 1] + scale_step_vt * i) + children(0); + } + else { + translate(pts[i]) + rotate(angs[i]) + rotate([90, 0, -90]) + rotate(twist_step_a * i) + scale([1, 1, 1] + scale_step_vt * i) + children(0); + } } // <<< end: modules and functions for "EULER-ANGLE" @@ -157,18 +164,21 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE") translate(pts[0]) axis_angle_align_with_local_rotate(0, 0, [1, 1, 1], cumu_rot_matrice) + rotate([90, 0, 0]) children(0); if($children == 1) { for(i = [0:leng_points - 2]) { translate(pts[i + 1]) axis_angle_align_with_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) + rotate([90, 0, 0]) children(0); } } else { for(i = [0:min(leng_points, $children) - 2]) { translate(pts[i + 1]) axis_angle_align_with_local_rotate(i, i * twist_step_a, [1, 1, 1] + scale_step_vt * i, cumu_rot_matrice) + rotate([90, 0, 0]) children(i + 1); } }