added NextNotFaux function

This commit is contained in:
Nico Pietroni 2014-09-11 20:43:41 +00:00
parent 4fe40ecef5
commit c3beef6091
1 changed files with 321 additions and 294 deletions

View File

@ -97,9 +97,9 @@ public:
int E() const { return z; } int E() const { return z; }
FaceType * F() const { return f; } FaceType * F() const { return f; }
// Returns the face index of the vertex inside the face. // Returns the face index of the vertex inside the face.
// Note that this is DIFFERENT from using the z member that denotes the edge index inside the face. // Note that this is DIFFERENT from using the z member that denotes the edge index inside the face.
// It should holds that Vind != (z+1)%3 && Vind == z || Vind = z+2%3 // It should holds that Vind != (z+1)%3 && Vind == z || Vind = z+2%3
int VInd() int VInd()
{ {
for(int i = 0; i < f->VN(); ++i) if(v==f->V(i)) return i; for(int i = 0; i < f->VN(); ++i) if(v==f->V(i)) return i;
@ -224,9 +224,9 @@ public:
/// return the face that it should have if we make FlipF; /// return the face that it should have if we make FlipF;
FaceType *FFlip() const FaceType *FFlip() const
{ {
// assert( f->FFp(z)->FFp(f->FFi(z))==f ); // assert( f->FFp(z)->FFp(f->FFi(z))==f );
// assert(f->V(f->Prev(z))!=v); // assert(f->V(f->Prev(z))!=v);
// assert(f->V(f->Next(z))==v || f->V((z+0)%f->VN())==v); // assert(f->V(f->Next(z))==v || f->V((z+0)%f->VN())==v);
FaceType *nf=f->FFp(z); FaceType *nf=f->FFp(z);
return nf; return nf;
} }
@ -263,12 +263,39 @@ public:
assert(f->FFp(z)==f); // f is border along j assert(f->FFp(z)==f); // f is border along j
} }
/// Finds the next half-edge border
void NextNotFaux( )
{
assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v));
//assert(f->FFp(z)==f); // f is border along j
// Si deve cambiare faccia intorno allo stesso vertice v
//finche' non si trova una faccia di bordo.
do
{
FlipE();
if (IsFaux()) FlipF();
}
while(IsFaux());
// L'edge j e' di bordo e deve contenere v
assert((!IsFaux()) &&( f->V(z)==v || f->V(f->Next(z))==v ));
FlipV();
assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v));
//assert(f->FFp(z)==f); // f is border along j
}
/// Checks if the half-edge is of border /// Checks if the half-edge is of border
bool IsBorder() bool IsBorder()
{ {
return face::IsBorder(*f,z); return face::IsBorder(*f,z);
} }
bool IsFaux()
{
return (f->IsF(z));
}
bool IsManifold() bool IsManifold()
{ {
return face::IsManifold(*f,z); return face::IsManifold(*f,z);
@ -335,7 +362,7 @@ public:
} }
void Assert() void Assert()
#ifdef _DEBUG #ifdef _DEBUG
{ {
FaceType ht=*this; FaceType ht=*this;
ht.FlipF(); ht.FlipF();
@ -350,12 +377,12 @@ public:
ht.FlipV(); ht.FlipV();
assert(ht==*this); assert(ht==*this);
} }
#else #else
{} {}
#endif #endif
protected: protected:
void CheckIncidentFaces(int & count, bool & on_border) void CheckIncidentFaces(int & count, bool & on_border)
{ {
PosType ht = *this; PosType ht = *this;