Fix interference check to not report not-2-manifold edges; those

can occur in assemblies with coincident faces. And turn on smooth
shading, finally.

[git-p4: depot-paths = "//depot/solvespace/": change = 1971]
This commit is contained in:
Jonathan Westhues 2009-06-06 01:44:58 -08:00
parent 213c21db87
commit 7a279c4e3f
4 changed files with 12 additions and 8 deletions

View File

@ -181,7 +181,7 @@ void glxFillMesh(int specColor, SMesh *m, DWORD h, DWORD s1, DWORD s2)
glBegin(GL_TRIANGLES);
}
if(1 || tr->an.EqualsExactly(Vector::From(0, 0, 0))) {
if(0 || tr->an.EqualsExactly(Vector::From(0, 0, 0))) {
// Compute the normal from the vertices
Vector n = tr->Normal();
glNormal3d(n.x, n.y, n.z);

View File

@ -914,6 +914,13 @@ void SKdNode::MakeCertainEdgesInto(SEdgeList *sel, int how,
}
break;
case SELF_INTER_EDGES:
if(thisIntersects) {
sel->AddEdge(a, b);
if(inter) *inter = true;
}
break;
case TURNING_EDGES:
if((tr->Normal().z < LENGTH_EPS) &&
(n == 1) &&

View File

@ -236,8 +236,9 @@ public:
bool *inter, bool *fwd,
DWORD *face);
static const int NAKED_OR_SELF_INTER_EDGES = 100;
static const int TURNING_EDGES = 200;
static const int EMPHASIZED_EDGES = 300;
static const int SELF_INTER_EDGES = 200;
static const int TURNING_EDGES = 300;
static const int EMPHASIZED_EDGES = 400;
void MakeCertainEdgesInto(SEdgeList *sel, int how, bool coplanarIsInter,
bool *inter, bool *leaky);

View File

@ -458,7 +458,7 @@ void SolveSpace::MenuAnalyze(int id) {
SKdNode *root = SKdNode::From(m);
bool inters, leaks;
root->MakeCertainEdgesInto(&(SS.nakedEdges),
SKdNode::NAKED_OR_SELF_INTER_EDGES, false, &inters, &leaks);
SKdNode::SELF_INTER_EDGES, false, &inters, &leaks);
InvalidateGraphics();
@ -466,10 +466,6 @@ void SolveSpace::MenuAnalyze(int id) {
Error("%d edges interfere with other triangles, bad.",
SS.nakedEdges.l.n);
} else {
// MakeCertainEdgesInto also reports "naked" edges, which
// will include some types of coincident geometry that are
// not errors.
SS.nakedEdges.Clear();
Message("The assembly does not interfere, good.");
}
break;