From d7503446532f0028d615524cbce285d5ed3c869f Mon Sep 17 00:00:00 2001 From: Jonathan Westhues Date: Sun, 25 May 2008 20:27:34 -0800 Subject: [PATCH] Even if one vertex is collinear, the other one could be reflex; triangle merging code was screwing up. [git-p4: depot-paths = "//depot/solvespace/": change = 1744] --- mesh.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mesh.cpp b/mesh.cpp index f2582b8..987581e 100644 --- a/mesh.cpp +++ b/mesh.cpp @@ -120,9 +120,9 @@ void SMesh::Simplify(int start) { bDot /= min(ab.Magnitude(), bc.Magnitude()); dDot /= min(cd.Magnitude(), de.Magnitude()); - if(fabs(bDot) < LENGTH_EPS) { + if(fabs(bDot) < LENGTH_EPS && dDot > 0) { conv[j] = c; - } else if(fabs(dDot) < LENGTH_EPS) { + } else if(fabs(dDot) < LENGTH_EPS && bDot > 0) { conv[WRAP((j+1), convc)] = c; } else if(bDot > 0 && dDot > 0) { // conv[j] is unchanged, conv[j+1] goes to [j+2]