mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-11 01:04:07 +02:00
rename
This commit is contained in:
@@ -45,19 +45,19 @@ module along_with(points, angles, twist = 0, scale = 1.0) {
|
|||||||
[0, 0, 0, 1]
|
[0, 0, 0, 1]
|
||||||
];
|
];
|
||||||
|
|
||||||
function local_ang_vects(j) =
|
function axis_angle_local_ang_vects(j) =
|
||||||
j == 0 ? [] : local_ang_vects_sub(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(
|
let(
|
||||||
vt0 = points[j] - points[j - 1],
|
vt0 = points[j] - points[j - 1],
|
||||||
vt1 = points[j + 1] - points[j],
|
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)
|
||||||
)
|
)
|
||||||
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(
|
let(
|
||||||
leng_rot_matrice = len(rot_matrice),
|
leng_rot_matrice = len(rot_matrice),
|
||||||
leng_rot_matrice_minus_one = leng_rot_matrice - 1,
|
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_one],
|
||||||
rot_matrice[leng_rot_matrice_minus_two] * 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(
|
let(
|
||||||
matrice = cumulated_rot_matrice(i + 1, rot_matrice),
|
matrice = axis_angle_cumulated_rot_matrice(i + 1, rot_matrice),
|
||||||
curr_matrix = rot_matrice[i],
|
curr_matrix = rot_matrice[i],
|
||||||
prev_matrix = matrice[len(matrice) - 1]
|
prev_matrix = matrice[len(matrice) - 1]
|
||||||
)
|
)
|
||||||
@@ -84,7 +84,7 @@ module along_with(points, angles, twist = 0, scale = 1.0) {
|
|||||||
|
|
||||||
// align modules
|
// align modules
|
||||||
|
|
||||||
module 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)
|
||||||
@@ -92,7 +92,7 @@ module along_with(points, angles, twist = 0, scale = 1.0) {
|
|||||||
children(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]);
|
angleyz = __angy_angz(points[0], points[1]);
|
||||||
rotate([0, -angleyz[0], angleyz[1]])
|
rotate([0, -angleyz[0], angleyz[1]])
|
||||||
rotate([90, 0, -90])
|
rotate([90, 0, -90])
|
||||||
@@ -101,14 +101,14 @@ module along_with(points, angles, twist = 0, scale = 1.0) {
|
|||||||
children(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
|
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);
|
children(0);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
multmatrix(cumu_rot_matrice[j - 1])
|
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);
|
children(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,34 +116,34 @@ module along_with(points, angles, twist = 0, scale = 1.0) {
|
|||||||
if(angles_defined) {
|
if(angles_defined) {
|
||||||
if($children == 1) {
|
if($children == 1) {
|
||||||
for(i = [0:leng_points_minus_one]) {
|
for(i = [0:leng_points_minus_one]) {
|
||||||
align_with_pts_angles(i) children(0);
|
axis_angle_align_with_pts_angles(i) children(0);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(i = [0:min(leng_points, $children) - 1]) {
|
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 {
|
else {
|
||||||
cumu_rot_matrice = cumulated_rot_matrice(0, [
|
cumu_rot_matrice = axis_angle_cumulated_rot_matrice(0, [
|
||||||
for(ang_vect = local_ang_vects(leng_points - 2))
|
for(ang_vect = axis_angle_local_ang_vects(leng_points - 2))
|
||||||
m_rotation(ang_vect[0], ang_vect[1])
|
m_rotation(ang_vect[0], ang_vect[1])
|
||||||
]);
|
]);
|
||||||
|
|
||||||
translate(points[0])
|
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);
|
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])
|
||||||
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])
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user