Oops, was computing numerical by perturbing a point in uv; but the
xyz point that I subtracted off had been refined to lie exactly on our edge's curve, and the uv point that I started with had not. So normals got randomly screwed up. [git-p4: depot-paths = "//depot/solvespace/": change = 1978]
This commit is contained in:
parent
1ac083a9a2
commit
2013f9f466
|
@ -57,7 +57,7 @@ void SolveSpace::Init(char *cmdLine) {
|
||||||
lightDir[1].y = CnfThawFloat( 0.0f, "LightDir_1_Up" );
|
lightDir[1].y = CnfThawFloat( 0.0f, "LightDir_1_Up" );
|
||||||
lightDir[1].z = CnfThawFloat( 0.0f, "LightDir_1_Forward" );
|
lightDir[1].z = CnfThawFloat( 0.0f, "LightDir_1_Forward" );
|
||||||
// Chord tolerance
|
// Chord tolerance
|
||||||
chordTol = CnfThawFloat(1.5f, "ChordTolerance");
|
chordTol = CnfThawFloat(2.0f, "ChordTolerance");
|
||||||
// Max pwl segments to generate
|
// Max pwl segments to generate
|
||||||
maxSegments = CnfThawDWORD(10, "MaxSegments");
|
maxSegments = CnfThawDWORD(10, "MaxSegments");
|
||||||
// View units
|
// View units
|
||||||
|
|
|
@ -276,7 +276,6 @@ void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
|
||||||
Point2d enuv = abuv.Normal();
|
Point2d enuv = abuv.Normal();
|
||||||
|
|
||||||
*pt = PointAt(muv);
|
*pt = PointAt(muv);
|
||||||
*surfn = NormalAt(muv.x, muv.y);
|
|
||||||
|
|
||||||
// If this edge just approximates a curve, then refine our midpoint so
|
// If this edge just approximates a curve, then refine our midpoint so
|
||||||
// so that it actually lies on that curve too. Otherwise stuff like
|
// so that it actually lies on that curve too. Otherwise stuff like
|
||||||
|
@ -288,8 +287,11 @@ void SSurface::EdgeNormalsWithinSurface(Point2d auv, Point2d buv,
|
||||||
double t;
|
double t;
|
||||||
sc->exact.ClosestPointTo(*pt, &t, false);
|
sc->exact.ClosestPointTo(*pt, &t, false);
|
||||||
*pt = sc->exact.PointAt(t);
|
*pt = sc->exact.PointAt(t);
|
||||||
|
ClosestPointTo(*pt, &muv);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*surfn = NormalAt(muv.x, muv.y);
|
||||||
|
|
||||||
// Compute the inner and outer normals of this edge (within the srf),
|
// Compute the inner and outer normals of this edge (within the srf),
|
||||||
// in xyz space. These are not necessarily antiparallel, if the
|
// in xyz space. These are not necessarily antiparallel, if the
|
||||||
// surface is curved.
|
// surface is curved.
|
||||||
|
@ -487,7 +489,6 @@ void SShell::MakeIntersectionCurvesAgainst(SShell *agnst, SShell *into) {
|
||||||
// list for into.
|
// list for into.
|
||||||
sa->IntersectAgainst(sb, this, agnst, into);
|
sa->IntersectAgainst(sb, this, agnst, into);
|
||||||
}
|
}
|
||||||
FLAG++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
5
util.cpp
5
util.cpp
|
@ -510,8 +510,11 @@ Vector Vector::ScaledBy(double v) {
|
||||||
Vector Vector::WithMagnitude(double v) {
|
Vector Vector::WithMagnitude(double v) {
|
||||||
double m = Magnitude();
|
double m = Magnitude();
|
||||||
if(m == 0) {
|
if(m == 0) {
|
||||||
|
// We can do a zero vector with zero magnitude, but not any other cases.
|
||||||
|
if(fabs(v) > 1e-100) {
|
||||||
dbp("Vector::WithMagnitude of zero vector!");
|
dbp("Vector::WithMagnitude of zero vector!");
|
||||||
return From(v, 0, 0);
|
}
|
||||||
|
return From(0, 0, 0);
|
||||||
} else {
|
} else {
|
||||||
return ScaledBy(v/m);
|
return ScaledBy(v/m);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user