From 64c5cb56cf8b341ed2e1e593f92230efc1c5a538 Mon Sep 17 00:00:00 2001 From: nicopietroni Date: Wed, 4 Aug 2004 20:50:12 +0000 Subject: [PATCH] corrected vfdatach and added vf append --- vcg/simplex/face/topology.h | 61 +++++++++++++++++++++---------------- 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/vcg/simplex/face/topology.h b/vcg/simplex/face/topology.h index c5901200..db850e9e 100644 --- a/vcg/simplex/face/topology.h +++ b/vcg/simplex/face/topology.h @@ -24,15 +24,6 @@ History $Log: not supported by cvs2svn $ -Revision 1.9 2004/07/15 12:03:07 ganovelli -minor changes - -Revision 1.8 2004/07/15 11:26:48 ganovelli -VFDetach corrected - -Revision 1.7 2004/05/12 12:23:23 cignoni -Conformed C++ syntax to GCC requirements - Revision 1.6 2004/05/11 16:03:18 ganovelli changed from "thi" to "&f" in Vfdetach @@ -169,8 +160,8 @@ void Attach(FaceType * &f, int z1, FaceType *&f2, int z2) EPB.NextF(); } //Salvo i dati di f1 prima di sovrascrivere - FaceType *f1prec = f.FFp(z1); - int z1prec = f.FFi(z1); + FaceType *f1prec = f->FFp(z1); + int z1prec = f->FFi(z1); //Aggiorno f1 f->FFp(z1) = TEPB.f->FFp(TEPB.z); f->FFi(z1) = TEPB.f->FFi(TEPB.z); @@ -225,34 +216,52 @@ void Swap (SwapFaceType &f, const int z ) // NOTA funziona SOLO per la topologia VF!!! // usata nelle classi di collapse template -void VFDetach(FaceType & f, int z) +void VFDetach(FaceType* &f, int z) { - if(f.V(z)->VFp()==&f ) //if it is the first face detach from the begin + if(f->V(z)->VFp()==f ) { - int fz = f.V(z)->VFi(); - f.V(z)->VFp() = f.VFp(fz); - f.V(z)->VFi() = f.VFi(fz); + int fz = f->V(z)->VFi(); + f->V(z)->VFp() = (FaceType*) f->VFp(fz); + f->V(z)->VFi() = f->VFi(fz); } - else // scan the list of faces in order to finde the current face f to be detached + else { - VFIterator x(f.V(z)->VFp(),f.V(z)->VFi()); - VFIterator y; + + vcg::face::VFIterator x,y; - for(;;) + x.f = f->V(z)->VFp(); + x.z = f->V(z)->VFi(); + y = x; + y++; + while (!y.End()) { - y = x; - ++x; - assert(x.f!=0); - if(x.f==&f) // found! + assert(y.f!=0); + if(y.f==f) { - y.f->VFp(y.z) = f.VFp(z); - y.f->VFi(y.z) = f.VFi(z); + x.f->VFp(x.z) = y.f->VFp(y.z); + x.f->VFi(x.z) = y.f->VFi(y.z); break; } + x++; + y++; } } } + +/// Append a face in VF list of vertex f->V(z) +template +void VFAppend(FaceType* & f, int z) +{ + FaceType::VertexType *v=f->V(z); + FaceType *f0=v->VFp(); + int z0=v->VFi(); + v->VFp()=f; + v->VFi()=z; + f->VFp(z)=f0; + f->VFi(z)=z0; +} + /*@}*/ } // end namespace } // end namespace