Don't do numeric surface intersections if an exact curve has been copied. We don't want 2 overlapping but different sets of PWLs.

pull/787/head
phkahler 2020-10-28 14:17:48 -04:00
parent eadeac44f0
commit 8a3e5b4d56
1 changed files with 7 additions and 0 deletions

View File

@ -331,6 +331,7 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
sext = this; sext = this;
shext = agnstA; shext = agnstA;
} }
bool foundExact = false;
SCurve *sc; SCurve *sc;
for(sc = shext->curve.First(); sc; sc = shext->curve.NextAfter(sc)) { for(sc = shext->curve.First(); sc; sc = shext->curve.NextAfter(sc)) {
if(sc->source == SCurve::Source::INTERSECTION) continue; if(sc->source == SCurve::Source::INTERSECTION) continue;
@ -341,8 +342,14 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
if(splane->ContainsPlaneCurve(sc)) { if(splane->ContainsPlaneCurve(sc)) {
SBezier bezier = sc->exact; SBezier bezier = sc->exact;
AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into); AddExactIntersectionCurve(&bezier, b, agnstA, agnstB, into);
foundExact = true;
} }
} }
// if we found at lest one of these we don't want to do the numerical
// intersection as well. Sometimes it will also find the same curve but
// with different PWLs and the polygon will fail to assemble.
if(foundExact)
return;
} }
// Try intersecting the surfaces numerically, by a marching algorithm. // Try intersecting the surfaces numerically, by a marching algorithm.