1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-11 09:14:29 +02:00
This commit is contained in:
Justin Lin
2022-03-07 15:04:57 +08:00
parent 762d16b2a4
commit adf3ea365f

View File

@@ -101,34 +101,32 @@ module sweep(sections, triangles = "SOLID") {
half_leng_v_pts = leng_sects * half_leng_sect; half_leng_v_pts = leng_sects * half_leng_sect;
function strip_sects(begin_idx, end_idx) = function strip_sects(begin_idx, end_idx) =
let(range = [begin_idx:end_idx])
[ [
for(i = 0; i < leng_sects; i = i + 1) for(sect = sects) [for(j = range) sect[j]]
[
for(j = begin_idx; j <= end_idx; j = j + 1)
sects[i][j]
]
]; ];
range = [0:half_leng_sect - 1];
function first_idxes() = function first_idxes() =
[ [
for(i = 0; i < half_leng_sect; i = i + 1) for(i = range)
[ [
i, i,
i + half_leng_v_pts, i + half_leng_v_pts,
(i + 1) % half_leng_sect + half_leng_v_pts, (i + 1) % half_leng_sect + half_leng_v_pts,
(i + 1) % half_leng_sect (i + 1) % half_leng_sect
] ]
]; ];
function last_idxes(begin_idx) = function last_idxes(begin_idx) =
[ [
for(i = 0; i < half_leng_sect; i = i + 1) for(i = range)
[ [
begin_idx + i, begin_idx + i,
begin_idx + (i + 1) % half_leng_sect, begin_idx + (i + 1) % half_leng_sect,
begin_idx + (i + 1) % half_leng_sect + half_leng_v_pts, begin_idx + (i + 1) % half_leng_sect + half_leng_v_pts,
begin_idx + i + half_leng_v_pts begin_idx + i + half_leng_v_pts
] ]
]; ];
outer_sects = strip_sects(0, half_leng_sect - 1); outer_sects = strip_sects(0, half_leng_sect - 1);