From 85109504efee7bda9153f6d0b3b076948e1debd5 Mon Sep 17 00:00:00 2001 From: cnr-isti-vclab Date: Tue, 15 Nov 2005 12:16:34 +0000 Subject: [PATCH] Changed DegeneratedFaces, sets the D flags for each faces that is found to be degenerated. CounEdges and ConnectedComponents check now if a face IsD() else for degenerated faces many asserts fail. --- vcg/complex/trimesh/clean.h | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/vcg/complex/trimesh/clean.h b/vcg/complex/trimesh/clean.h index 03e33b85..073cb046 100644 --- a/vcg/complex/trimesh/clean.h +++ b/vcg/complex/trimesh/clean.h @@ -24,6 +24,10 @@ History $Log: not supported by cvs2svn $ +Revision 1.9 2005/11/14 09:28:18 cignoni +changed access to face functions (border, area) +removed some typecast warnings + Revision 1.8 2005/10/11 16:03:40 rita_borgo Added new functions belonging to triMeshInfo Started the Self-Intersection routine @@ -262,6 +266,8 @@ namespace vcg { bool counted =false; for(fi=m.face.begin();fi!=m.face.end();fi++) { + if(!((*fi).IsD())) + { (*fi).SetS(); count_e +=3; //assume that we have to increase the number of edges with three for(int j=0; j<3; j++) @@ -297,6 +303,7 @@ namespace vcg { } } } + } } } @@ -392,6 +399,8 @@ namespace vcg { MeshType::FaceType *l; for(fi=m.face.begin();fi!=m.face.end();++fi) { + if(!((*fi).IsD())) + { if (!(*fi).IsS()) { (*fi).SetS(); @@ -418,6 +427,7 @@ namespace vcg { } Compindex++; } + } } return Compindex; } @@ -430,7 +440,11 @@ namespace vcg { for(fi=m.face.begin(); fi!=m.face.end();++fi) if(Area(*fi) == 0) + { count_fd++; + fi->SetD(); + m.fn--; + } return count_fd; } /** @@ -618,6 +632,7 @@ The polyhedral formula corresponds to the special case g==0. int nelem; bbox = m.bbox; double bdiag = bbox.Diag(); + FaceType *f=0; Point3x normf, bestq, ip,p; @@ -626,7 +641,7 @@ The polyhedral formula corresponds to the special case g==0. std::vector ret; - std::vector inCell; + std::vector inBox; gM.Set::iterator>(m.face.begin(),m.face.end()); for(fi=m.face.begin();fi!=m.face.end();++fi) @@ -635,16 +650,17 @@ The polyhedral formula corresponds to the special case g==0. // f = vcg::trimesh::GetClosestFace(m, gM, p, bdiag, bdiag, normf, bestq, ip); // fill the cell /*....*/ - nelem = inCell.size(); + + nelem = inBox.size(); if (nelem>=2)// in a cell { //test combinations of elements for (int i=0;iIsD())&&(!inCell[j]->IsD())&&(TestIntersection(inCell[i],inCell[j]))) + if ((!inBox[i]->IsD())&&(!inBox[j]->IsD())&&(TestIntersection(inBox[i],inBox[j]))) { - ret.push_back(inCell[i]); - ret.push_back(inCell[j]); + ret.push_back(inBox[i]); + ret.push_back(inBox[j]); } } }