1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-02-24 09:33:26 +01:00
This commit is contained in:
Justin Lin 2019-06-16 21:07:23 +08:00
parent 057ad863af
commit 56d2fb648f

View File

@ -30,13 +30,9 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
]; ];
function rotate_pts(pts, a, v) = [for(p = pts) rotate_p(p, a, v)]; function rotate_pts(pts, a, v) = [for(p = pts) rotate_p(p, a, v)];
function scale_step() =
let(s = (scale - 1) / len_path_pts_minus_one)
[s, s, s];
scale_step_vt = is_num(scale) ? scale_step_vt = is_num(scale) ?
scale_step() : let(s = (scale - 1) / len_path_pts_minus_one) [s, s, s] :
[ [
(scale[0] - 1) / len_path_pts_minus_one, (scale[0] - 1) / len_path_pts_minus_one,
(scale[1] - 1) / len_path_pts_minus_one, (scale[1] - 1) / len_path_pts_minus_one,
@ -127,7 +123,7 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
] ]
]; ];
function sections() = sections =
let( let(
fst_section = fst_section =
translate_pts(local_rotate_section(0, 0, [1, 1, 1]), pth_pts[0]), translate_pts(local_rotate_section(0, 0, [1, 1, 1]), pth_pts[0]),
@ -140,13 +136,11 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
) )
] ]
) concat([fst_section], remain_sections); ) concat([fst_section], remain_sections);
sects = sections();
calculated_sections = calculated_sections =
closed && pth_pts[0] == pth_pts[len_path_pts_minus_one] ? closed && pth_pts[0] == pth_pts[len_path_pts_minus_one] ?
concat(sects, [sects[0]]) : // round-robin concat(sections, [sections[0]]) : // round-robin
sects; sections;
polysections( polysections(
calculated_sections, calculated_sections,
@ -154,7 +148,7 @@ module path_extrude(shape_pts, path_pts, triangles = "SOLID", twist = 0, scale =
); );
// hook for testing // hook for testing
test_path_extrude(sects); test_path_extrude(sections);
} }
module euler_angle_path_extrude() { module euler_angle_path_extrude() {