Corrected bug in the search of holes. Removed output prints

This commit is contained in:
Paolo Cignoni 2006-12-01 21:24:16 +00:00
parent 9c5b7ce5a1
commit 02456f0505
1 changed files with 19 additions and 14 deletions

View File

@ -24,6 +24,9 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.23 2006/12/01 08:53:55 cignoni
Corrected pop_heap vs pop_back issue in heap usage
Revision 1.22 2006/12/01 00:11:17 cignoni Revision 1.22 2006/12/01 00:11:17 cignoni
Added Callback, Corrected some spelling errors (adiacense -> adjacency). Added Callback, Corrected some spelling errors (adiacense -> adjacency).
Added Validity Check function for hole loops Added Validity Check function for hole loops
@ -215,7 +218,7 @@ namespace vcg {
{ {
// simple topological check // simple topological check
if(e0.f==e1.f) { if(e0.f==e1.f) {
printf("Avoided bad ear"); //printf("Avoided bad ear");
return false; return false;
} }
@ -243,7 +246,7 @@ namespace vcg {
// caso ear degenere per buco triangolare // caso ear degenere per buco triangolare
if(ep==en) if(ep==en)
{ {
printf("Closing the last triangle"); //printf("Closing the last triangle");
f->FFp(2)=en.f; f->FFp(2)=en.f;
f->FFi(2)=en.z; f->FFi(2)=en.z;
en.f->FFp(en.z)=f; en.f->FFp(en.z)=f;
@ -254,7 +257,7 @@ namespace vcg {
// Caso ear non manifold a // Caso ear non manifold a
else if(ep.v==en.v) else if(ep.v==en.v)
{ {
printf("Ear Non manif A\n"); //printf("Ear Non manif A\n");
face::Pos<typename MESH::FaceType> enold=en; face::Pos<typename MESH::FaceType> enold=en;
en.NextB(); en.NextB();
f->FFp(2)=enold.f; f->FFp(2)=enold.f;
@ -267,7 +270,7 @@ namespace vcg {
// Caso ear non manifold b // Caso ear non manifold b
else if(ep.VFlip()==e1.v) else if(ep.VFlip()==e1.v)
{ {
printf("Ear Non manif B\n"); //printf("Ear Non manif B\n");
face::Pos<typename MESH::FaceType> epold=ep; face::Pos<typename MESH::FaceType> epold=ep;
ep.FlipV(); ep.NextB(); ep.FlipV(); ep.FlipV(); ep.NextB(); ep.FlipV();
f->FFp(2)=epold.f; f->FFp(2)=epold.f;
@ -349,7 +352,7 @@ namespace vcg {
{ {
// simple topological check // simple topological check
if(this->e0.f==this->e1.f) { if(this->e0.f==this->e1.f) {
printf("Avoided bad ear"); //printf("Avoided bad ear");
return false; return false;
} }
@ -393,7 +396,7 @@ namespace vcg {
// caso ear degenere per buco triangolare // caso ear degenere per buco triangolare
if(ep==en) if(ep==en)
{ {
printf("Closing the last triangle"); //printf("Closing the last triangle");
f->FFp(2)=en.f; f->FFp(2)=en.f;
f->FFi(2)=en.z; f->FFi(2)=en.z;
en.f->FFp(en.z)=f; en.f->FFp(en.z)=f;
@ -404,7 +407,7 @@ namespace vcg {
// Caso ear non manifold a // Caso ear non manifold a
else if(ep.v==en.v) else if(ep.v==en.v)
{ {
printf("Ear Non manif A\n"); //printf("Ear Non manif A\n");
face::Pos<typename MESH::FaceType> enold=en; face::Pos<typename MESH::FaceType> enold=en;
en.NextB(); en.NextB();
f->FFp(2)=enold.f; f->FFp(2)=enold.f;
@ -419,7 +422,7 @@ namespace vcg {
// Caso ear non manifold b // Caso ear non manifold b
else if(ep.VFlip()==this->e1.v) else if(ep.VFlip()==this->e1.v)
{ {
printf("Ear Non manif B\n"); //printf("Ear Non manif B\n");
face::Pos<typename MESH::FaceType> epold=ep; face::Pos<typename MESH::FaceType> epold=ep;
ep.FlipV(); ep.NextB(); ep.FlipV(); ep.FlipV(); ep.NextB(); ep.FlipV();
f->FFp(2)=epold.f; f->FFp(2)=epold.f;
@ -507,7 +510,7 @@ public:
{ {
if(!p.IsBorder()) if(!p.IsBorder())
return false; return false;
PosType ip=p;ip.NextB() PosType ip=p;ip.NextB();
for(;ip!=p;ip.NextB()) for(;ip!=p;ip.NextB())
{ {
if(!ip.IsBorder()) if(!ip.IsBorder())
@ -705,24 +708,26 @@ template<class EAR>
{ {
if( !(*fi).IsUserBit(UBIT) ) if( !(*fi).IsUserBit(UBIT) )
{ {
(*fi).SetUserBit(UBIT);
for(int j =0; j<3 ; ++j) for(int j =0; j<3 ; ++j)
{ {
if( (*fi).IsB(j) ) if( face::IsBorder(*fi,j) && !(*fi).IsUserBit(UBIT) )
{//Trovato una faccia di bordo non ancora visitata. {//Trovato una faccia di bordo non ancora visitata.
(*fi).SetUserBit(UBIT);
PosType sp(&*fi, j, (*fi).V(j)); PosType sp(&*fi, j, (*fi).V(j));
PosType fp=sp; PosType fp=sp;
int holesize=0; int holesize=0;
Box3Type hbox; Box3Type hbox;
hbox.Add(sp.v->cP()); hbox.Add(sp.v->cP());
//printf("Looping %i : (face %i edge %i) \n", VHI.size(),sp.f-&*m.face.begin(),sp.z);
sp.f->SetUserBit(UBIT);
do do
{ {
sp.f->SetUserBit(UBIT); sp.f->SetUserBit(UBIT);
hbox.Add(sp.v->cP()); hbox.Add(sp.v->cP());
++holesize; ++holesize;
sp.NextB(); sp.NextB();
sp.f->SetUserBit(UBIT);
assert(sp.IsBorder()); assert(sp.IsBorder());
}while(sp != fp); }while(sp != fp);