From 59d52a10e99bcd1d0b630525e21e12af85a104bd Mon Sep 17 00:00:00 2001 From: cignoni Date: Mon, 9 Oct 2006 20:06:46 +0000 Subject: [PATCH] Added Remove NonManifoldFace --- vcg/complex/trimesh/clean.h | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/vcg/complex/trimesh/clean.h b/vcg/complex/trimesh/clean.h index f5123eee..496bd7e2 100644 --- a/vcg/complex/trimesh/clean.h +++ b/vcg/complex/trimesh/clean.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.40 2006/05/25 09:41:09 cignoni +missing std and other gcc detected syntax errors + Revision 1.39 2006/05/16 21:51:07 cignoni Redesigned the function for the removal of faces according to their area and edge lenght @@ -367,6 +370,8 @@ private: i.e. have two or more vertex reference that link the same vertex (and not only two vertexes with the same coordinates). All Degenerate faces are zero area faces BUT not all zero area faces are degenerate. + We do not take care of topology because when we have degenerate faces the + topology calculation functions crash. */ static int RemoveDegenerateFace(MeshType& m) { @@ -384,7 +389,35 @@ private: } return count_fd; } + static int RemoveNonManifoldFace(MeshType& m) + { + FaceIterator fi; + int count_fd = 0; + vector ToDelVec; + for(fi=m.face.begin(); fi!=m.face.end();++fi) + if (!fi->IsD()) + { + if ((!IsManifold(*fi,0))|| + (!IsManifold(*fi,1))|| + (!IsManifold(*fi,2))) + ToDelVec.push_back(&*fi); + } + + for(int i=0;i(ff,j)) vcg::face::FFDetach(ff,j); + ff.SetD(); + count_fd++; + m.fn--; + } + return count_fd; + } /* The following functions remove faces that are geometrically "bad" according to edges and area criteria.