heal polys before tracing
This commit is contained in:
parent
2923a0bd88
commit
208a2f2b0c
3 changed files with 16 additions and 3 deletions
|
|
@ -106,6 +106,7 @@
|
|||
tabs,
|
||||
cutTabs,
|
||||
cutPolys,
|
||||
healPolys,
|
||||
slicer,
|
||||
sliceAll,
|
||||
updateToolDiams,
|
||||
|
|
@ -273,8 +274,11 @@
|
|||
|
||||
function cutPolys(polys, offset, z, inter) {
|
||||
let noff = [];
|
||||
// tabs = tabs.filter(tab => z < tab.pos.z + tab.dim.z/2).map(tab => tab.off).flat();
|
||||
offset.forEach(op => noff.appendAll( op.cut(POLY.union(polys, 0, true), inter) ));
|
||||
return healPolys(noff);
|
||||
}
|
||||
|
||||
function healPolys(noff) {
|
||||
if (noff.length > 1) {
|
||||
let heal = 0;
|
||||
// heal/rejoin open segments that share endpoints
|
||||
|
|
@ -317,6 +321,14 @@
|
|||
// cull nulls
|
||||
noff = noff.filter(o => o);
|
||||
}
|
||||
// close poly if head meets tail
|
||||
for (let poly of noff) {
|
||||
if (poly.open && poly.first().isMergable2D(poly.last())) {
|
||||
poly.points.pop();
|
||||
poly.length--;
|
||||
poly.open = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return noff;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue