1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-07-31 20:10:36 +02:00

fix rotation bug

This commit is contained in:
Justin Lin
2022-03-30 09:17:27 +08:00
parent af87c89ecc
commit 96c9cfc0c4
4 changed files with 20 additions and 12 deletions

View File

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

View File

@@ -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);

View File

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

View File

@@ -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);
}
}