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