add healing to open top polys if ends are close. update support union call
This commit is contained in:
parent
19323b2958
commit
6470be92ca
2 changed files with 7 additions and 2 deletions
|
|
@ -688,8 +688,8 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// undo temp del/used marks
|
||||||
for (let i=0; i<stack.length; i++) stack[i].del = false;
|
for (let i=0; i<stack.length; i++) stack[i].del = false;
|
||||||
// stack.forEach(function(p) { p.del = false });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// emit a polygon if it can be cleaned and still have 2 or more points
|
// emit a polygon if it can be cleaned and still have 2 or more points
|
||||||
|
|
|
||||||
|
|
@ -388,6 +388,11 @@
|
||||||
last = top_poly.clone(true);
|
last = top_poly.clone(true);
|
||||||
top.shells = last;
|
top.shells = last;
|
||||||
} else {
|
} else {
|
||||||
|
// heal top open polygons if the ends are close (benchy tilt test)
|
||||||
|
top_poly.forEach(p => { if (p.open) {
|
||||||
|
let dist = p.first().distTo2D(p.last());
|
||||||
|
if (dist < 1) p.open = false;
|
||||||
|
} });
|
||||||
if (opt.thin) {
|
if (opt.thin) {
|
||||||
top.thin_fill = [];
|
top.thin_fill = [];
|
||||||
let oso = {z, count, gaps: [], outs: [], minArea: 0.05};
|
let oso = {z, count, gaps: [], outs: [], minArea: 0.05};
|
||||||
|
|
@ -963,7 +968,7 @@
|
||||||
if (!supports) return;
|
if (!supports) return;
|
||||||
|
|
||||||
// union supports
|
// union supports
|
||||||
supports = POLY.union(supports);
|
supports = POLY.union(supports, undefined, true);
|
||||||
|
|
||||||
// trim to clip offsets
|
// trim to clip offsets
|
||||||
if (slice.offsets) POLY.subtract(supports, slice.offsets, nsB, null, slice.z, min);
|
if (slice.offsets) POLY.subtract(supports, slice.offsets, nsB, null, slice.z, min);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue