1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-28 08:50:30 +02:00
This commit is contained in:
Justin Lin
2019-09-26 08:12:43 +08:00
parent 55400c9d2c
commit 86fb7c1279

View File

@@ -83,19 +83,19 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
module axis_angle_align_with_pts_angles(i) { module axis_angle_align_with_pts_angles(i) {
translate(points[i]) translate(points[i])
rotate(angles[i]) rotate(angles[i])
rotate(twist_step_a * i) rotate(twist_step_a * i)
scale([1, 1, 1] + scale_step_vt * i) scale([1, 1, 1] + scale_step_vt * i)
children(0); children(0);
} }
module axis_angle_align_with_pts_init(a, s) { module axis_angle_align_with_pts_init(a, s) {
angleyz = __angy_angz(__to3d(points[0]), __to3d(points[1])); angleyz = __angy_angz(__to3d(points[0]), __to3d(points[1]));
rotate([0, -angleyz[0], angleyz[1]]) rotate([0, -angleyz[0], angleyz[1]])
rotate([90, 0, -90]) rotate([90, 0, -90])
rotate(a) rotate(a)
scale(s) scale(s)
children(0); children(0);
} }
module axis_angle_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) {
@@ -105,8 +105,8 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
} }
else { else {
multmatrix(cumu_rot_matrice[j - 1]) multmatrix(cumu_rot_matrice[j - 1])
axis_angle_align_with_pts_init(init_a, init_s) axis_angle_align_with_pts_init(init_a, init_s)
children(0); children(0);
} }
} }
@@ -131,11 +131,11 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
module euler_angle_align(i, angs) { module euler_angle_align(i, angs) {
translate(points[i]) translate(points[i])
rotate(angs[i]) rotate(angs[i])
rotate(angles_defined ? [0, 0, 0] : [90, 0, -90]) rotate(angles_defined ? [0, 0, 0] : [90, 0, -90])
rotate(twist_step_a * i) rotate(twist_step_a * i)
scale([1, 1, 1] + scale_step_vt * i) scale([1, 1, 1] + scale_step_vt * i)
children(0); children(0);
} }
// <<< end: modules and functions for "EULER-ANGLE" // <<< end: modules and functions for "EULER-ANGLE"
@@ -159,20 +159,20 @@ module along_with(points, angles, twist = 0, scale = 1.0, method = "AXIS_ANGLE")
]); ]);
translate(points[0]) translate(points[0])
axis_angle_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); children(0);
if($children == 1) { if($children == 1) {
for(i = [0:leng_points - 2]) { for(i = [0:leng_points - 2]) {
translate(points[i + 1]) translate(points[i + 1])
axis_angle_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); children(0);
} }
} else { } else {
for(i = [0:min(leng_points, $children) - 2]) { for(i = [0:min(leng_points, $children) - 2]) {
translate(points[i + 1]) translate(points[i + 1])
axis_angle_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); children(i + 1);
} }
} }
} }