From 8a3e5b4d56b644808b4378a1f068486151a69ab2 Mon Sep 17 00:00:00 2001 From: phkahler <14852918+phkahler@users.noreply.github.com> Date: Wed, 28 Oct 2020 14:17:48 -0400 Subject: [PATCH] Don't do numeric surface intersections if an exact curve has been copied. We don't want 2 overlapping but different sets of PWLs. --- src/srf/surfinter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/srf/surfinter.cpp b/src/srf/surfinter.cpp index 1e4fb396..0a827761 100644 --- a/src/srf/surfinter.cpp +++ b/src/srf/surfinter.cpp @@ -331,6 +331,7 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB, sext = this; shext = agnstA; } + bool foundExact = false; SCurve *sc; for(sc = shext->curve.First(); sc; sc = shext->curve.NextAfter(sc)) { if(sc->source == SCurve::Source::INTERSECTION) continue; @@ -341,8 +342,14 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB, if(splane->ContainsPlaneCurve(sc)) { SBezier bezier = sc->exact; 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.