fix new clipper union function
This commit is contained in:
parent
5811aa9b1c
commit
93b641a68f
3 changed files with 13 additions and 9 deletions
|
|
@ -83,17 +83,21 @@ var gs_base_polygons = exports;
|
|||
return polys;
|
||||
};
|
||||
|
||||
function fromClipperTreeUnion(tnode, z, minarea) {
|
||||
let polys = [], poly;
|
||||
function fromClipperTreeUnion(tnode, z, minarea, tops, parent) {
|
||||
let polys = tops || [], poly;
|
||||
|
||||
tnode.m_Childs.forEach(function(child) {
|
||||
poly = fromClipperNode(child, z);
|
||||
if (minarea && poly.area() < minarea) {
|
||||
return;
|
||||
}
|
||||
polys.push(poly);
|
||||
if (parent) {
|
||||
parent.addInner(poly);
|
||||
} else {
|
||||
polys.push(poly);
|
||||
}
|
||||
if (child.m_Childs) {
|
||||
fromClipperTreeUnion(child, z, minarea);
|
||||
fromClipperTreeUnion(child, z, minarea, polys, parent ? null : poly);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ let gs_kiri_sla = exports;
|
|||
polys.appendAll(slice.tops.map(t => t.poly.clone()));
|
||||
});
|
||||
// p.clone prevents inner voids from forming
|
||||
let union = POLY.union(polys,0).map(p => p.clone());
|
||||
let union = POLY.union(polys).map(p => p.clone());
|
||||
let expand = POLY.expand(union, off, zoff, [], 1);
|
||||
let lastraft;
|
||||
for (let s=0; s<layers + gap; s++) {
|
||||
|
|
@ -178,7 +178,7 @@ let gs_kiri_sla = exports;
|
|||
let traces = POLY.nest(POLY.flatten(slice.gatherTraces([])));
|
||||
let trims = slice.solids.trimmed || [];
|
||||
traces.appendAll(trims);
|
||||
let union = POLY.union(traces,0);
|
||||
let union = POLY.union(traces);
|
||||
slice.solids.unioned = union;
|
||||
}, "solid");
|
||||
} else {
|
||||
|
|
@ -563,14 +563,14 @@ let gs_kiri_sla = exports;
|
|||
}
|
||||
|
||||
if (!cached) {
|
||||
fill = POLY.union(fill,0);
|
||||
fill = POLY.union(fill);
|
||||
fill_cache[seq_c] = fill;
|
||||
} else {
|
||||
fill = cached.slice().map(p => p.clone(true).setZ(slice.z));
|
||||
}
|
||||
|
||||
fill = POLY.trimTo(fill, slice.tops.map(t => t.poly));
|
||||
fill = POLY.union(slice.solids.unioned.appendAll(fill),0);
|
||||
fill = POLY.union(slice.solids.unioned.appendAll(fill));
|
||||
|
||||
slice.solids.unioned = fill;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -399,7 +399,7 @@ kiri.lang['en-us'] = {
|
|||
sa_otop_s: "open top",
|
||||
sa_otop_l: "if shell is enabled\nresults in an open top",
|
||||
sa_obas_s: "open base",
|
||||
sa_obas_l: "if shell is enabled\nresults in an open base",
|
||||
sa_obas_l: "if shell is enabled\nresults in an open base\ndisabled with supports",
|
||||
|
||||
sa_layr_m: "layers",
|
||||
sa_lton_s: "light on time",
|
||||
|
|
|
|||
Loading…
Reference in a new issue