From c6a0148724dd3903e7314675b65149bcce576691 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sun, 21 Jun 2009 01:54:21 -0800 Subject: [PATCH] When splitting a curve against surfaces, don't split the curve against the surfaces that it supposedly borders; that will cause numerical trouble. [git-p4: depot-paths = "//depot/solvespace/": change = 1993] --- srf/boolean.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/srf/boolean.cpp b/srf/boolean.cpp index 56797de..4ee97e0 100644 --- a/srf/boolean.cpp +++ b/srf/boolean.cpp @@ -56,13 +56,25 @@ SCurve SCurve::MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB, // The intersections were generated by intersecting the pwl // edge against a surface; so they must be refined to lie // exactly on the original curve. + il.ClearTags(); SInter *pi; for(pi = il.First(); pi; pi = il.NextAfter(pi)) { + if(pi->srf == srfA || pi->srf == srfB) { + // The edge certainly intersects the surfaces that it + // trims (at its endpoints), but those ones don't count. + // They are culled later, but no sense calculating them + // and they will cause numerical problems (since two + // of the three surfaces they're refined to lie on will + // be identical, so the matrix will be singular). + pi->tag = 1; + continue; + } double u, v; (pi->srf)->ClosestPointTo(pi->p, &u, &v, false); (pi->srf)->PointOnSurfaces(srfA, srfB, &u, &v); pi->p = (pi->srf)->PointAt(u, v); } + il.RemoveTagged(); // And now sort them in order along the line. Note that we must // do that after refining, in case the refining would make two