small simplifications

This commit is contained in:
phkahler 2023-05-15 19:00:39 -04:00 committed by Paul Kahler
parent 604335f1c9
commit fd25424ab5
2 changed files with 7 additions and 7 deletions

View File

@ -438,13 +438,12 @@ void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
double t; double t;
sc->exact.ClosestPointTo(*pt, &t, /*mustConverge=*/false); sc->exact.ClosestPointTo(*pt, &t, /*mustConverge=*/false);
*pt = sc->exact.PointAt(t); *pt = sc->exact.PointAt(t);
ClosestPointTo(*pt, &muv);
} else if(!sc->isExact) { } else if(!sc->isExact) {
SSurface *trimmedA = sc->GetSurfaceA(sha, shb), SSurface *trimmedA = sc->GetSurfaceA(sha, shb),
*trimmedB = sc->GetSurfaceB(sha, shb); *trimmedB = sc->GetSurfaceB(sha, shb);
*pt = trimmedA->ClosestPointOnThisAndSurface(trimmedB, *pt); *pt = trimmedA->ClosestPointOnThisAndSurface(trimmedB, *pt);
ClosestPointTo(*pt, &muv);
} }
ClosestPointTo(*pt, &muv);
*surfn = NormalAt(muv.x, muv.y); *surfn = NormalAt(muv.x, muv.y);
@ -472,6 +471,9 @@ void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
pout = PointAt(muv.Plus(enuv)); pout = PointAt(muv.Plus(enuv));
*enin = pin.Minus(*pt), *enin = pin.Minus(*pt),
*enout = pout.Minus(*pt); *enout = pout.Minus(*pt);
// ideally this should work (fail screwdriver file)
// *enin = enxyz.ScaledBy(-1.0);
// *enout = enxyz;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -456,13 +456,11 @@ void SSurface::IntersectAgainst(SSurface *b, SShell *agnstA, SShell *agnstB,
} }
} }
Vector dp = nb.Cross(na).WithMagnitude(1.0);
if(!fwd) dp = dp.ScaledBy(-1.0);
int i; int i;
for(i = 0; i < 20; i++) { for(i = 0; i < 20; i++) {
Vector dp = nb.Cross(na); np = start.Plus(dp.ScaledBy(step));
if(!fwd) dp = dp.ScaledBy(-1);
dp = dp.WithMagnitude(step);
np = start.Plus(dp);
npc = ClosestPointOnThisAndSurface(b, np); npc = ClosestPointOnThisAndSurface(b, np);
tol = (npc.Minus(np)).Magnitude(); tol = (npc.Minus(np)).Magnitude();