From 7a279c4e3f93a610fd1ff136b1cebfb5a7302542 Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sat, 6 Jun 2009 01:44:58 -0800 Subject: [PATCH] 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] --- glhelper.cpp | 2 +- mesh.cpp | 7 +++++++ polygon.h | 5 +++-- solvespace.cpp | 6 +----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/glhelper.cpp b/glhelper.cpp index 82a5c13..6968e66 100644 --- a/glhelper.cpp +++ b/glhelper.cpp @@ -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); diff --git a/mesh.cpp b/mesh.cpp index 42d8a49..74008fd 100644 --- a/mesh.cpp +++ b/mesh.cpp @@ -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) && diff --git a/polygon.h b/polygon.h index a6ce271..45a45c8 100644 --- a/polygon.h +++ b/polygon.h @@ -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); diff --git a/solvespace.cpp b/solvespace.cpp index 67958e0..c34c67b 100644 --- a/solvespace.cpp +++ b/solvespace.cpp @@ -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;