From 4107c587d0d0aa6580c1f334b44ba8021bf35081 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Fri, 4 Feb 2011 17:14:47 +0000 Subject: [PATCH] Modified check for diagonal collapses --- .../trimesh/update/halfedge_topology.h | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/vcg/complex/trimesh/update/halfedge_topology.h b/vcg/complex/trimesh/update/halfedge_topology.h index aaa6db69..11a7a8e3 100644 --- a/vcg/complex/trimesh/update/halfedge_topology.h +++ b/vcg/complex/trimesh/update/halfedge_topology.h @@ -1221,32 +1221,32 @@ namespace vcg // Second check - sort (faces1.begin(), faces1.end()); - sort (faces2.begin(), faces2.end()); + set set1; + set set2; - if( faces1[0] == NULL ) - faces1.erase(faces1.begin()); + vector vect1 = getVertices(hp->HVp()); + vector vect2 = getVertices(hp->HNp()->HNp()->HVp()); - if( faces2[0] == NULL ) - faces2.erase(faces2.begin()); + set1.insert(vect1.begin(), vect1.end()); + set2.insert(vect2.begin(), vect2.end()); - vector intersection(faces1.size()+faces2.size()); - typename vector::iterator it; + size = vect1.size(); + if(vect2.size() < size) + size = vect2.size(); - it = set_intersection(faces1.begin(),faces1.end(), faces2.begin(), faces2.end(), intersection.begin()); + vector intersection(size); - intersection.erase(it,intersection.end()); + typename vector::iterator it; + it = set_intersection(set1.begin(), set1.end(), set2.begin(), set2.end(), intersection.begin()); - size = intersection.size(); + size = it- intersection.begin(); - assert( size != 0); + assert( size >= 2 ); - if(size != 1) - return false; + return (size==2); // End of second check - return true; } /*!