removed the return type from the ++ operator of the vfi iterator

This commit is contained in:
Paolo Cignoni 2013-09-10 10:54:40 +00:00
parent 46dc55fb3c
commit 344de42c2e
1 changed files with 78 additions and 79 deletions

View File

@ -88,9 +88,9 @@ public:
if (f->V(i) == v) { z = f->Prev(i); break;} if (f->V(i) == v) { z = f->Prev(i); break;}
} }
// Official Access functions functions // Official Access functions functions
VertexType *& V(){ return v; } VertexType *& V(){ return v; }
int & E(){ return z; } int & E(){ return z; }
FaceType *& F(){ return f; } FaceType *& F(){ return f; }
VertexType * V() const { return v; } VertexType * V() const { return v; }
@ -101,11 +101,11 @@ public:
// 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;
assert(0); assert(0);
return -1; return -1;
} }
/// Operator to compare two half-edge /// Operator to compare two half-edge
@ -119,7 +119,7 @@ public:
} }
/// Operator to order half-edge; it's compare at the first the face pointers, then the index of the edge and finally the vertex pointers /// Operator to order half-edge; it's compare at the first the face pointers, then the index of the edge and finally the vertex pointers
inline bool operator <= ( PosType const & p) const { inline bool operator <= ( PosType const & p) const {
return (f!=p.f)?(f<p.f): return (f!=p.f)?(f<p.f):
(z!=p.z)?(z<p.z): (z!=p.z)?(z<p.z):
(v<=p.v); (v<=p.v);
} }
@ -213,19 +213,19 @@ public:
/// return the vertex that it should have if we make FlipV; /// return the vertex that it should have if we make FlipV;
VertexType *VFlip() const VertexType *VFlip() const
{ {
assert(f->cV(f->Prev(z))!=v && (f->cV(f->Next(z))==v || f->cV(z)==v)); assert(f->cV(f->Prev(z))!=v && (f->cV(f->Next(z))==v || f->cV(z)==v));
if(f->cV(f->Next(z))==v) return f->cV(z); if(f->cV(f->Next(z))==v) return f->cV(z);
else return f->cV(f->Next(z)); else return f->cV(f->Next(z));
} }
/// 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 && (f->V(f->Next(z))==v || f->V((z+0)%f->VN())==v)); assert(f->V(f->Prev(z))!=v && (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;
} }
@ -250,7 +250,7 @@ public:
//finche' non si trova una faccia di bordo. //finche' non si trova una faccia di bordo.
do do
NextE(); NextE();
while(!IsBorder()); while(!IsBorder());
// L'edge j e' di bordo e deve contenere v // L'edge j e' di bordo e deve contenere v
assert(IsBorder() &&( f->V(z)==v || f->V(f->Next(z))==v )); assert(IsBorder() &&( f->V(z)==v || f->V(f->Next(z))==v ));
@ -263,13 +263,13 @@ public:
/// 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 IsManifold() bool IsManifold()
{ {
return face::IsManifold(*f,z); return face::IsManifold(*f,z);
} }
/*! /*!
* Returns the number of vertices incident on the vertex pos is currently pointing to. * Returns the number of vertices incident on the vertex pos is currently pointing to.
@ -313,16 +313,16 @@ public:
while (ht!=*this); while (ht!=*this);
return count; return count;
} }
/** Function to inizialize an half-edge. /** Function to inizialize an half-edge.
@param fp Puntatore alla faccia @param fp Puntatore alla faccia
@param zp Indice dell'edge @param zp Indice dell'edge
@param vp Puntatore al vertice @param vp Puntatore al vertice
*/ */
void Set(FaceType * const fp, int const zp, VertexType * const vp) void Set(FaceType * const fp, int const zp, VertexType * const vp)
{ {
f=fp;z=zp;v=vp; f=fp;z=zp;v=vp;
assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v)); assert(f->V(f->Prev(z))!=v && (f->V(f->Next(z))==v || f->V(z)==v));
} }
void Set(FaceType * const pFace, VertexType * const pVertex) void Set(FaceType * const pFace, VertexType * const pVertex)
{ {
@ -366,7 +366,7 @@ public:
}; };
/** Class VFIterator. /** Class VFIterator.
This class is used as an iterator over the VF adjacency. This class is used as an iterator over the VF adjacency.
It allow to easily traverse all the faces around a given vertex v; It allow to easily traverse all the faces around a given vertex v;
The faces are traversed in no particular order. No Manifoldness requirement. The faces are traversed in no particular order. No Manifoldness requirement.
@ -375,11 +375,11 @@ public:
VertexPointer v; VertexPointer v;
vcg::face::VFIterator<FaceType> vfi(v); vcg::face::VFIterator<FaceType> vfi(v);
for (;!vfi.End();++vfi) for (;!vfi.End();++vfi)
vfi.F()->ClearV(); vfi.F()->ClearV();
// Alternative // Alternative
vcg::face::VFIterator<FaceType> vfi(f, 1); vcg::face::VFIterator<FaceType> vfi(f, 1);
while (!vfi.End()){ while (!vfi.End()){
vfi.F()->ClearV(); vfi.F()->ClearV();
++vfi; ++vfi;
@ -430,11 +430,10 @@ public:
inline VertexType * const & V2() const { return f->V2(z);} inline VertexType * const & V2() const { return f->V2(z);}
bool End() const {return f==0;} bool End() const {return f==0;}
VFIFaceType *operator++() { void operator++() {
FaceType* t = f; FaceType* t = f;
f = f->VFp(z); f = t->VFp(z);
z = t->VFi(z); z = t->VFi(z);
return f;
} }
}; };