fix healPolys() when Z differs

This commit is contained in:
Stewart Allen 2021-09-26 19:54:21 -04:00
commit 7bfe59de90
2 changed files with 4 additions and 1 deletions

View file

@ -829,7 +829,6 @@
similar(p0.first().distTo2D(p1.first()), toolDiam) &&
similar(p0.last().distTo2D(p1.last()), toolDiam)
) {
console.log({candidates: [p0, p1]});
pout.push(centerPoly(p0, p1));
ptst[i] = undefined;
ptst[j] = undefined;

View file

@ -302,6 +302,10 @@
for (let j=i+1; j<tlen; j++) {
let s2 = ntmp[j];
if (!s2) continue;
// require polys at same Z to heal
if (Math.abs(s1.getZ() - s2.getZ()) > 0.01) {
continue;
}
if (!(s1.open && s2.open)) continue;
if (s1.last().isMergable2D(s2.first())) {
s1.addPoints(s2.points.slice(1));