corrected an ugly bug in the testfaceface

(note that it still assert for non 2manif meshes...)
This commit is contained in:
Paolo Cignoni 2010-03-26 22:53:31 +00:00
parent 0165f918f1
commit b2e4c6cf80
1 changed files with 20 additions and 19 deletions

View File

@ -447,32 +447,33 @@ static void TestVertexFace(MeshType &m)
} }
} }
/// \brief Test correctness of FFtopology /// \brief Test correctness of FFtopology (only for 2Manifold Meshes!)
static void TestFaceFace(MeshType &m) static void TestFaceFace(MeshType &m)
{ {
if(!m.HasFFTopology()) return; if(!m.HasFFTopology()) return;
FaceIterator Fi; for(FaceIterator fi=m.face.begin();fi!=m.face.end();++fi)
for(Fi=m.face.begin();Fi!=m.face.end();++Fi)
{ {
if (!Fi->IsD()) if (!fi->IsD())
{ {
for (int i=0;i<(*Fi).VN();i++) for (int i=0;i<(*fi).VN();i++)
{ {
FaceType *f=Fi->FFp(i); FaceType *ffpi=fi->FFp(i);
int e=Fi->FFi(i); int e=fi->FFi(i);
//invariant property of fftopology //invariant property of FF topology for two manifold meshes
assert(f->FFp(e)=&(*Fi)); assert(ffpi->FFp(e) == &(*fi));
// Test that the two faces shares the same edge assert(ffpi->FFi(e) == i);
VertexPointer v0= Fi->V0(i);
VertexPointer v1= Fi->V1(i);
assert( (f->V0(e)==v0) || (f->V1(e)==v0) );
assert( (f->V0(e)==v1) || (f->V1(e)==v1) );
// Old unreadable test // Test that the two faces shares the same edge
// assert(((f->V(e) == Fi->V(i))&&(f->V((e+1)%3)==Fi->V((i+1)%3)))|| // Vertices of the i-th edges of the first face
// ((f->V(e)==Fi->V((i+1)%3))&&(f->V((e+1)%3)==Fi->V(i)))); VertexPointer v0i= fi->V0(i);
VertexPointer v1i= fi->V1(i);
// Vertices of the corresponding edge on the other face
VertexPointer ffv0i= ffpi->V0(e);
VertexPointer ffv1i= ffpi->V1(e);
assert( (ffv0i==v0i) || (ffv0i==v1i) );
assert( (ffv1i==v0i) || (ffv1i==v1i) );
} }
} }