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.
This commit is contained in:
Paolo Cignoni 2005-11-15 12:16:34 +00:00
parent f32fb12d03
commit 85109504ef
1 changed files with 21 additions and 5 deletions

View File

@ -24,6 +24,10 @@
History History
$Log: not supported by cvs2svn $ $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 Revision 1.8 2005/10/11 16:03:40 rita_borgo
Added new functions belonging to triMeshInfo Added new functions belonging to triMeshInfo
Started the Self-Intersection routine Started the Self-Intersection routine
@ -262,6 +266,8 @@ namespace vcg {
bool counted =false; bool counted =false;
for(fi=m.face.begin();fi!=m.face.end();fi++) for(fi=m.face.begin();fi!=m.face.end();fi++)
{ {
if(!((*fi).IsD()))
{
(*fi).SetS(); (*fi).SetS();
count_e +=3; //assume that we have to increase the number of edges with three count_e +=3; //assume that we have to increase the number of edges with three
for(int j=0; j<3; j++) for(int j=0; j<3; j++)
@ -297,6 +303,7 @@ namespace vcg {
} }
} }
} }
}
} }
} }
@ -392,6 +399,8 @@ namespace vcg {
MeshType::FaceType *l; MeshType::FaceType *l;
for(fi=m.face.begin();fi!=m.face.end();++fi) for(fi=m.face.begin();fi!=m.face.end();++fi)
{ {
if(!((*fi).IsD()))
{
if (!(*fi).IsS()) if (!(*fi).IsS())
{ {
(*fi).SetS(); (*fi).SetS();
@ -418,6 +427,7 @@ namespace vcg {
} }
Compindex++; Compindex++;
} }
}
} }
return Compindex; return Compindex;
} }
@ -430,7 +440,11 @@ namespace vcg {
for(fi=m.face.begin(); fi!=m.face.end();++fi) for(fi=m.face.begin(); fi!=m.face.end();++fi)
if(Area<FaceType>(*fi) == 0) if(Area<FaceType>(*fi) == 0)
{
count_fd++; count_fd++;
fi->SetD();
m.fn--;
}
return count_fd; return count_fd;
} }
/** /**
@ -618,6 +632,7 @@ The polyhedral formula corresponds to the special case g==0.
int nelem; int nelem;
bbox = m.bbox; bbox = m.bbox;
double bdiag = bbox.Diag(); double bdiag = bbox.Diag();
FaceType *f=0; FaceType *f=0;
Point3x normf, bestq, ip,p; Point3x normf, bestq, ip,p;
@ -626,7 +641,7 @@ The polyhedral formula corresponds to the special case g==0.
std::vector<FaceType*> ret; std::vector<FaceType*> ret;
std::vector<FaceType*> inCell; std::vector<FaceType*> inBox;
gM.Set<vector<FaceType>::iterator>(m.face.begin(),m.face.end()); gM.Set<vector<FaceType>::iterator>(m.face.begin(),m.face.end());
for(fi=m.face.begin();fi!=m.face.end();++fi) 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<MeshType,TriMeshGrid>(m, gM, p, bdiag, bdiag, normf, bestq, ip); // f = vcg::trimesh::GetClosestFace<MeshType,TriMeshGrid>(m, gM, p, bdiag, bdiag, normf, bestq, ip);
// fill the cell // fill the cell
/*....*/ /*....*/
nelem = inCell.size();
nelem = inBox.size();
if (nelem>=2)// in a cell if (nelem>=2)// in a cell
{ {
//test combinations of elements //test combinations of elements
for (int i=0;i<nelem-1;i++) for (int i=0;i<nelem-1;i++)
for (int j=i+1;j<nelem;j++) for (int j=i+1;j<nelem;j++)
if ((!inCell[i]->IsD())&&(!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(inBox[i]);
ret.push_back(inCell[j]); ret.push_back(inBox[j]);
} }
} }
} }