1
0
mirror of https://github.com/JustinSDK/dotSCAD.git synced 2025-08-12 01:34:12 +02:00

supported the same face

This commit is contained in:
Justin Lin
2017-05-18 09:32:32 +08:00
parent 8496800ed5
commit aca76cc80d

View File

@@ -46,16 +46,33 @@ module polysections(sections, triangles = "SOLID") {
);
module solid_sections(sects) {
leng_sects = len(sects);
leng_pts_sect = len(sects[0]);
first_sect = sects[0];
last_sect = sects[leng_sects - 1];
function search_at_first_sect(p, i = 0) =
i < leng_pts_sect ?
(p == first_sect[i] ? i : search_at_first_sect(p, i + 1)) : -1;
function the_same_as_first_sect(sect) =
let(
found_at_i = search_at_first_sect(last_sect[0])
)
found_at_i == -1 ? false :
sect == concat(
[for(i = [found_at_i:leng_pts_sect-1]) first_sect[i]],
[for(i = [0:found_at_i - 1]) first_sect[i]]
);
v_pts = [
for(sect = sects)
for(pt = sect)
pt
];
if(sects[0] == sects[leng_sects - 1]) {
if(first_sect == last_sect || the_same_as_first_sect(last_sect)) {
polyhedron(
v_pts,
side_indexes(sects)