Updated names of POS and adj functions to the new standards for many functions

This commit is contained in:
Paolo Cignoni 2004-05-10 15:20:49 +00:00
parent 51d36a0451
commit 98b8a3ae39
1 changed files with 37 additions and 55 deletions

View File

@ -24,12 +24,15 @@
History History
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.4 2004/03/18 16:00:10 cignoni
minor changes
****************************************************************************/ ****************************************************************************/
#ifndef _VCG_FACE_TOPOLOGY #ifndef _VCG_FACE_TOPOLOGY
#define _VCG_FACE_TOPOLOGY #define _VCG_FACE_TOPOLOGY
#include <vcg/simplex/face/pos.h>
namespace vcg { namespace vcg {
namespace face { namespace face {
/** \addtogroup face */ /** \addtogroup face */
@ -43,7 +46,7 @@ template <class FaceType>
inline bool IsManifold( FaceType const & f, const int j ) inline bool IsManifold( FaceType const & f, const int j )
{ {
if(FaceType::HasFFAdjacency()) if(FaceType::HasFFAdjacency())
return ( f.F(j) == &f || &f == f.F(j)->F(f.Z(j)) ); return ( f.FFp(j) == &f || &f == f.FFp(j)->FFp(f.FFi(j)) );
else else
return true; return true;
} }
@ -56,7 +59,7 @@ template <class FaceType>
inline bool IsBorder(FaceType const & f, const int j ) inline bool IsBorder(FaceType const & f, const int j )
{ {
if(FaceType::HasFFAdjacency()) if(FaceType::HasFFAdjacency())
return f.F(j) == &f ; return f.FFp(j) == &f ;
else else
return true; return true;
} }
@ -84,17 +87,14 @@ inline int ComplexSize(FaceType const & f, const int e)
{ {
if(FaceType::HasFFAdjacency()) if(FaceType::HasFFAdjacency())
{ {
Pos< FaceType > fpos(&f,e);
int cnt=0; int cnt=0;
FACE_TYPE *fi=(FACE_TYPE *)this; do
int nzi,zi=e; {
do fpos.NextF();
{
nzi=fi->Z(zi);
fi=fi->F(zi);
zi=nzi;
++cnt; ++cnt;
} }
while(fi!=this); while(fpos.f=&f);
return cnt; return cnt;
} }
assert(0); assert(0);
@ -110,29 +110,27 @@ if(FaceType::HasFFAdjacency())
template <class FaceType> template <class FaceType>
void Detach(FaceType & f, const int e) void Detach(FaceType & f, const int e)
{ {
typedef FEdgePosB< FACE_TYPE > ETYPE;
assert(!IsBorder(e)); assert(!IsBorder(e));
ETYPE EPB(this,e); // la faccia dall'altra parte Pos< FaceType > EPB(&f,e); // la faccia dall'altra parte
EPB.NextF(); EPB.NextF();
int cnt=0; int cnt=0;
while ( EPB.f->F(EPB.z) != this) while ( EPB.f->FFp(EPB.z) != &f)
{ {
assert(!IsManifold(e)); // Si entra in questo loop solo se siamo in una situazione non manifold. assert(!IsManifold(e)); // Si entra in questo loop solo se siamo in una situazione non manifold.
assert(!EPB.f->IsBorder(EPB.z)); assert(!EPB.f->IsBorder(EPB.z));
EPB.NextF(); EPB.NextF();
cnt++; cnt++;
} }
assert(EPB.f->F(EPB.z)==this); assert(EPB.f->FFp(EPB.z)==&f);
EPB.f->F(EPB.z) = F(e); EPB.f->FFp(EPB.z) = F(e);
EPB.f->Z(EPB.z) = Z(e); EPB.f->FFi(EPB.z) = Z(e);
F(e) = this; F(e) = &f;
Z(e) = e; Z(e) = e;
EPB.f->SetM(); EPB.f->SetM();
this->SetM(); f.SetM();
} }
@ -143,11 +141,11 @@ void Detach(FaceType & f, const int e)
@param z2 The edge of the face f2 @param z2 The edge of the face f2
*/ */
template <class FaceType> template <class FaceType>
void Attach(int z1, FaceType *&f2, int z2) void Attach(FaceType * &f, int z1, FaceType *&f2, int z2)
{ {
typedef FEdgePosB< FACE_TYPE > ETYPE; //typedef FEdgePosB< FACE_TYPE > ETYPE;
ETYPE EPB(f2,z2); Pos< FaceType > EPB(f2,z2);
ETYPE TEPB; Pos< FaceType > TEPB;
TEPB = EPB; TEPB = EPB;
EPB.NextF(); EPB.NextF();
while( EPB.f != f2) //Alla fine del ciclo TEPB contiene la faccia che precede f2 while( EPB.f != f2) //Alla fine del ciclo TEPB contiene la faccia che precede f2
@ -156,27 +154,27 @@ void Attach(int z1, FaceType *&f2, int z2)
EPB.NextF(); EPB.NextF();
} }
//Salvo i dati di f1 prima di sovrascrivere //Salvo i dati di f1 prima di sovrascrivere
face_base *f1prec = this->F(z1); FaceType *f1prec = f.FFp(z1);
int z1prec = this->Z(z1); int z1prec = f.FFi(z1);
//Aggiorno f1 //Aggiorno f1
this->F(z1) = TEPB.f->F(TEPB.z); f->FFp(z1) = TEPB.f->FFp(TEPB.z);
this->Z(z1) = TEPB.f->Z(TEPB.z); f->FFi(z1) = TEPB.f->FFi(TEPB.z);
//Aggiorno la faccia che precede f2 //Aggiorno la faccia che precede f2
TEPB.f->F(TEPB.z) = f1prec; TEPB.f->FFp(TEPB.z) = f1prec;
TEPB.f->Z(TEPB.z) = z1prec; TEPB.f->FFi(TEPB.z) = z1prec;
} }
template <class FaceType> template <class FaceType>
void AssertAdj() void AssertAdj(FaceType & f)
{ {
assert(F(0)->F(Z(0))==this); assert(f.FFp(0)->FFp(f.FFi(0))==&f);
assert(F(1)->F(Z(1))==this); assert(f.FFp(1)->FFp(f.FFi(1))==&f);
assert(F(2)->F(Z(2))==this); assert(f.FFp(2)->FFp(f.FFi(2))==&f);
assert(F(0)->Z(Z(0))==0); assert(f.FFp(0)->FFi(f.FFi(0))==0);
assert(F(1)->Z(Z(1))==1); assert(f.FFp(1)->FFi(f.FFi(1))==1);
assert(F(2)->Z(Z(2))==2); assert(f.FFp(2)->FFi(f.FFi(2))==2);
} }
// Funzione di supporto usata da swap? // Funzione di supporto usata da swap?
//template <class FaceType> //template <class FaceType>
@ -195,30 +193,14 @@ template <class SwapFaceType>
void Swap (SwapFaceType &f, const int z ) void Swap (SwapFaceType &f, const int z )
{ {
int i; int i;
face_base *tmp, *prec; SwapFaceType *tmp, *prec;
int t, precz; int t, precz;
swap ( f.V((z )%3),f.V((z+1)%3)); swap ( f.V((z )%3),f.V((z+1)%3));
if(f.HasFFAdjacency() ) if(f.HasFFAdjacency() )
{ {
swap ( f.F((z+1)%3),f.F((z+2)%3)); // TODO!!!
swap ( f.Z((z+1)%3),f.Z((z+2)%3));
for(i = 1; i < 3; i++)
{
tmp = this;
t = (z+i)%3;
do {
prec = tmp;
precz = t;
Nexts(tmp,t);
}
while (tmp != this);
(*prec).Z(precz) = (z+i)%3;
}
} }
} }