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]
This commit is contained in:
Jonathan Westhues 2009-06-21 01:54:21 -08:00
parent 4c8f535305
commit c6a0148724

View File

@ -56,13 +56,25 @@ SCurve SCurve::MakeCopySplitAgainst(SShell *agnstA, SShell *agnstB,
// The intersections were generated by intersecting the pwl // The intersections were generated by intersecting the pwl
// edge against a surface; so they must be refined to lie // edge against a surface; so they must be refined to lie
// exactly on the original curve. // exactly on the original curve.
il.ClearTags();
SInter *pi; SInter *pi;
for(pi = il.First(); pi; pi = il.NextAfter(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; double u, v;
(pi->srf)->ClosestPointTo(pi->p, &u, &v, false); (pi->srf)->ClosestPointTo(pi->p, &u, &v, false);
(pi->srf)->PointOnSurfaces(srfA, srfB, &u, &v); (pi->srf)->PointOnSurfaces(srfA, srfB, &u, &v);
pi->p = (pi->srf)->PointAt(u, v); pi->p = (pi->srf)->PointAt(u, v);
} }
il.RemoveTagged();
// And now sort them in order along the line. Note that we must // And now sort them in order along the line. Note that we must
// do that after refining, in case the refining would make two // do that after refining, in case the refining would make two