From 261ff53ab19834c67983de1a6d43239c276fc9bd Mon Sep 17 00:00:00 2001 From: ganovelli Date: Thu, 25 Mar 2010 16:52:18 +0000 Subject: [PATCH] [introduction of half edges as alternative representation] No modification should be necessary for the existing code. most relevant changes: creation of folder: vcg/connectors vcg/connectors/hedge.h vcg/connectors/hedge_component.h addition to the container of half edges to the trimesh: HEdgeContainer hedge; // container int hn; // number of half edges addition of vcg/trimesh/update/halfedge_indexed.h which contains: - the functions to compute the half edge representation from the indexed and vivecersa - the functions to add or remove an half edge --- vcg/simplex/edge/base.h | 12 +- vcg/simplex/edge/component.h | 166 +++++---------------------- vcg/simplex/face/component.h | 26 ++++- vcg/simplex/face/component_ocf.h | 26 +++-- vcg/simplex/face/component_polygon.h | 96 ++++++++++------ vcg/simplex/vertex/component.h | 24 ++++ vcg/simplex/vertex/component_ocf.h | 30 ++--- 7 files changed, 172 insertions(+), 208 deletions(-) diff --git a/vcg/simplex/edge/base.h b/vcg/simplex/edge/base.h index a908f834..d48f4393 100644 --- a/vcg/simplex/edge/base.h +++ b/vcg/simplex/edge/base.h @@ -62,12 +62,12 @@ we have to build the type a step a time (deriving from a single ancestor at a ti */ template -class EdgeBase: public edge::EmptyEVAdj< - edge::EmptyEEAdj< - edge::EmptyHEdgeData< - edge::EmptyBitFlags< - EdgeTypeHolder < UserTypes> > > > > { -}; + class EdgeBase: public edge::EmptyEFAdj< + edge::EmptyEVAdj< + edge::EmptyEEAdj< + edge::EmptyEHAdj< + edge::EmptyBitFlags< + EdgeTypeHolder < UserTypes> > > > > >{}; /* The Real Big Edge class; diff --git a/vcg/simplex/edge/component.h b/vcg/simplex/edge/component.h index 008c72c2..89905f2f 100644 --- a/vcg/simplex/edge/component.h +++ b/vcg/simplex/edge/component.h @@ -253,33 +253,6 @@ private: typename T::VertexPointer _vp[2] ; }; -/*----------------------------- HEVADJ ------------------------------*/ -template class EmptyHEVAdj: public T { -public: - typename T::VertexPointer &HEVp() { static typename T::VertexPointer ep=0; assert(0); return ep; } - typename T::VertexPointer cHEVp() { static typename T::VertexPointer ep=0; assert(0); return ep; } - int &EVi(){static int z=0; return z;}; - template < class LeftV> - void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } - static bool HasHEVAdjacency() { return false; } - static bool HasHEVAdjacencyOcc() { return false; } - static void Name(std::vector & name){ T::Name(name);} -}; - -template class HEVAdj: public T { -public: - HEVAdj(){_vp =0;} - typename T::VertexPointer & HEVp() {return _vp ; } - const typename T::VertexPointer cHEVp() const {return _vp ; } - template < class LeftV> - void ImportLocal(const LeftV & left ) { this->V() = NULL; T::ImportLocal( left); } - static bool HasHEVAdjacency() { return true; } - static bool HasHEVAdjacencyOcc() { return true; } - static void Name(std::vector & name){name.push_back(std::string("HEVAdj"));T::Name(name);} - -private: - typename T::VertexPointer _vp ; -}; /*----------------------------- EEADJ ------------------------------*/ template class EmptyEEAdj: public T { @@ -312,6 +285,35 @@ private: }; +/*----------------------------- EHADJ ------------------------------*/ +template class EmptyEHAdj: public T { +public: + typename T::HEdgePointer &EHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; } + typename T::HEdgePointer cEHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; } + + template < class LeftV> + void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } + static bool HasEHAdjacency() { return false; } + static bool HasEHAdjacencyOcc() { return false; } + static void Name(std::vector & name){ T::Name(name);} +}; + +template class EHAdj: public T { +public: + EHAdj(){_hp=0;} + typename T::HEdgePointer &EHp( ) {return _hp ; } + typename T::HEdgePointer cEHp( ) {return _hp ; } + + template < class LeftV> + void ImportLocal(const LeftV & left ) { EHp() = NULL; T::ImportLocal( left); } + static bool HasEHAdjacency() { return true; } + static bool HasEHAdjacencyOcc() { return true; } + static void Name(std::vector & name){name.push_back(std::string("EHAdj"));T::Name(name);} + +private: + typename T::EdgePointer _hp ; +}; + /*----------------------------- ETADJ ------------------------------*/ @@ -342,86 +344,6 @@ private: -/*----------------------------- HENextADJ ------------------------------*/ -template class EmptyHENextAdj: public T { -public: - typename T::EdgePointer &HENp( ) { static typename T::EdgePointer ep=0; assert(0); return ep; } - typename T::EdgePointer cHEp( ) { static typename T::EdgePointer ep=0; assert(0); return ep; } - template < class LeftV> - void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } - static bool HasHENextAdjacency() { return false; } - static bool HasHENextAdjacencyOcc() { return false; } - static void Name(std::vector & name){ T::Name(name);} -}; - -template class HENextAdj: public T { -public: - HENextAdj(){_nep=0;} - typename T::EdgePointer &HENp() {return _nep; } - typename T::EdgePointer cHENp() {return _nep; } - template < class LeftV> - void ImportLocal(const LeftV & left ) { this->EEp() = NULL; T::ImportLocal( left); } - static bool HasHENextAdjacency() { return true; } - static void Name(std::vector & name){name.push_back(std::string("HENextAdj"));T::Name(name);} - -private: - typename T::EdgePointer _nep ; -}; - -/*----------------------------- HEOppADJ ------------------------------*/ -template class EmptyHEOppAdj: public T { -public: - typename T::EdgePointer &HEOp(const int & i ) { static typename T::EdgePointer ep=0; assert(0); return ep; } - typename T::EdgePointer cHOp(const int & i) { static typename T::EdgePointer ep=0; assert(0); return ep; } - int &EEi(){static int z=0; return z;}; - template < class LeftV> - void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } - static bool HasHEOppAdjacency() { return false; } - static bool HasHEOpptAdjacencyOcc() { return false; } - static void Name(std::vector & name){ T::Name(name);} -}; - -template class HEOppAdj: public T { -public: - HEOppAdj(){_oep=0;} - typename T::EdgePointer &HEOp() {return _oep; } - typename T::EdgePointer cHEOp() {return _oep; } - template < class LeftV> - void ImportLocal(const LeftV & left ) { this->EEp() = NULL; T::ImportLocal( left); } - static bool HasHEOppAdjacency() { return true; } - static void Name(std::vector & name){name.push_back(std::string("HEOpptAdj"));T::Name(name);} - -private: - typename T::EdgePointer _oep ; - -}; -/*----------------------------- HEPrevADJ ------------------------------*/ -template class EmptyHEPrevAdj: public T { -public: - typename T::EdgePointer &HEPp() { static typename T::EdgePointer ep=0; assert(0); return ep; } - typename T::EdgePointer cHPp() { static typename T::EdgePointer ep=0; assert(0); return ep; } - int &EEi(){static int z=0; return z;}; - template < class LeftV> - void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } - static bool HasHEPrevAdjacency() { return false; } - static bool HasHEPrevAdjacencyOcc() { return false; } - static void Name(std::vector & name){ T::Name(name);} -}; - -template class HEPrevAdj: public T { -public: - HEPrevAdj(){_pep=0;} - typename T::EdgePointer &HEPp() {return _pep; } - typename T::EdgePointer cHEPp() {return _pep; } - int &EEi(const int & i) {return this->_nei[i]; } - template < class LeftV> - void ImportLocal(const LeftV & left ) { this->EEp() = NULL; T::ImportLocal( left); } - static bool HasHEPrevAdjacency() { return true; } - static void Name(std::vector & name){name.push_back(std::string("HEPrevAdj"));T::Name(name);} - -private: - typename T::EdgePointer _pep ; -}; /*----------------------------- EFADJ ------------------------------*/ template class EmptyEFAdj: public T { @@ -454,36 +376,6 @@ private: }; -/*----------------------------- EFADJ ------------------------------*/ -/** - HEdgeData keep all the data for the half edge -*/ -template -class EmptyHEdgeData : public EmptyEFAdj< // pointer to the face - EmptyHEOppAdj < // pointer to the opposite half edge - EmptyHENextAdj < // pointer to the next half edge along the face - EmptyHEVAdj < // pointer to the vertex - EmptyHEPrevAdj< - T > > > > >{}; - - -template -class HEdgeData : public EFAdj< // pointer to the face - HEOppAdj < // pointer to the opposite half edge - HENextAdj < // pointer to the next half edge along the face - HEVAdj < // pointer to the vertex - T > > > >{ - - // functions to make the half edge user confortable - typename T::VertexPointer & Vertex() { return this->HEVp();} - const typename T::VertexPointer & cVertex() const { return this->cHEVp();} - typename T::EdgePointer Opposite() { return &this->HEOp();} - const typename T::EdgePointer & cOpposite() const { return this->cHEOp();} - typename T::EdgePointer & Next() { return this->HENp();} - const typename T::EdgePointer & cNext() const { return this->HENp();} - -}; - } // end namespace edge }// end namespace vcg #endif diff --git a/vcg/simplex/face/component.h b/vcg/simplex/face/component.h index b964cd4b..bff0d084 100644 --- a/vcg/simplex/face/component.h +++ b/vcg/simplex/face/component.h @@ -103,6 +103,7 @@ First Really Working version #include namespace vcg { + namespace face { /* Some naming Rules @@ -538,7 +539,9 @@ public: typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; } typename T::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; } typename T::EdgePointer const cFEp(const int) const { static typename T::EdgePointer const fp=0; return fp; } - char &VFi(const int j){(void)j; static char z=0; assert(0); return z;}; + typename T::HEdgePointer &FHp(const int) { static typename T::HEdgePointer fp=0; assert(0); return fp; } + typename T::HEdgePointer const cFHp(const int) const { static typename T::HEdgePointer const fp=0; return fp; } + char &VFi(const int j){(void)j; static char z=0; assert(0); return z;}; char &FFi(const int j){(void)j; static char z=0; assert(0); return z;}; const char &cVFi(const int j){(void)j; static char z=0; return z;}; const char &cFFi(const int j) const {(void)j; static char z=0; return z;}; @@ -549,10 +552,12 @@ public: static bool HasVFAdjacency() { return false; } static bool HasFFAdjacency() { return false; } static bool HasFEAdjacency() { return false; } + static bool HasFHAdjacency() { return false; } static bool HasFFAdjacencyOcc() { return false; } static bool HasVFAdjacencyOcc() { return false; } static bool HasFEAdjacencyOcc() { return false; } + static bool HasFHAdjacencyOcc() { return false; } static void Name(std::vector & name){T::Name(name);} @@ -648,6 +653,25 @@ private: char _fei[3] ; }; + +/*----------------------------- FHADJ ------------------------------*/ + +template class FHAdj: public T { +public: + FHAdj(){_fh=0;} + typename T::HEdgePointer &FHp( ) { return _fh; } + typename T::HEdgePointer const cFHp( ) const { return _fh; } + + template + void ImportLocal(const RightF & rightF){T::ImportLocal(rightF);} + inline void Alloc(const int & ns){T::Alloc(ns);} + inline void Dealloc(){T::Dealloc();} + static bool HasFHAdjacency() { return true; } + static void Name(std::vector & name){name.push_back(std::string("FHAdj"));T::Name(name);} + +private: + typename T::FacePointer _fh ; +}; } // end namespace face }// end namespace vcg #endif diff --git a/vcg/simplex/face/component_ocf.h b/vcg/simplex/face/component_ocf.h index 723ad2cf..10d6184f 100644 --- a/vcg/simplex/face/component_ocf.h +++ b/vcg/simplex/face/component_ocf.h @@ -769,43 +769,45 @@ public: namespace tri { - template < class VertContainerType, class FaceType, class EdgeContainerType > - bool HasVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + + + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasVFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasVFAdjacencyOcf()) return m.face.IsVFAdjacencyEnabled(); else return FaceType::FaceType::HasVFAdjacency(); } - template < class VertContainerType, class FaceType, class EdgeContainerType> - bool HasFFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasFFAdjacency (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasFFAdjacencyOcf()) return m.face.IsFFAdjacencyEnabled(); else return FaceType::FaceType::HasFFAdjacency(); } - template < class VertContainerType, class FaceType, class EdgeContainerType > - bool HasPerWedgeTexCoord (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasPerWedgeTexCoord (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasWedgeTexCoordOcf()) return m.face.IsWedgeTexEnabled(); else return FaceType::HasWedgeTexCoord(); } - template < class VertContainerType, class FaceType, class EdgeContainerType > - bool HasPerFaceColor (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasPerFaceColor (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasFaceColorOcf()) return m.face.IsColorEnabled(); else return FaceType::HasFaceColor(); } - template < class VertContainerType, class FaceType, class EdgeContainerType > - bool HasPerFaceQuality (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasPerFaceQuality (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasFaceQualityOcf()) return m.face.IsQualityEnabled(); else return FaceType::HasFaceQuality(); } - template < class VertContainerType, class FaceType, class EdgeContainerType > - bool HasPerFaceMark (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, EdgeContainerType > & m) + template < class VertContainerType, class FaceType, class Container1, class Container2 > + bool HasPerFaceMark (const TriMesh < VertContainerType , face::vector_ocf< FaceType >, Container1, Container2 > & m) { if(FaceType::HasFaceMarkOcf()) return m.face.IsMarkEnabled(); else return FaceType::HasFaceMark(); diff --git a/vcg/simplex/face/component_polygon.h b/vcg/simplex/face/component_polygon.h index f391743e..f5bb1c76 100644 --- a/vcg/simplex/face/component_polygon.h +++ b/vcg/simplex/face/component_polygon.h @@ -42,6 +42,9 @@ template class EmptyPolyInfo: public T { protected: inline void SetVN(const int & n) {assert(0);} public: + typedef typename T::HEdgeType HEdgeType; + typedef typename T::HEdgePointer HEdgePointer; + /* Note: the destructor will not be called in general because there are no virtual destructors. Instead, the job of deallocating the memory will be done bu the edge allocator. This destructor is only done for those who istance a face alone (outside a mesh) @@ -49,9 +52,16 @@ public: static bool HasPolyInfo() { return false; } inline void Alloc(const int & ns){T::Alloc(ns);};// it should be useless inline void Dealloc(){T::Dealloc();};// it should be useless + + // EmptyPFHAdj + HEdgePointer &FHp(const int) { static typename T::HEdgePointer fp=0; assert(0); return fp; } + HEdgePointer const cFHp(const int) const { static typename T::HEdgePointer const fp=0; return fp; } + static bool HasFHAdjacency() { return false; } }; + + template class PolyInfo: public T { protected: inline void SetVN(const int & n) {_ns = n;} @@ -67,6 +77,11 @@ public: inline int Next(const int & i){ return (i+1)%VN();} inline void Alloc(const int & ns){}; inline void Dealloc(){}; + + // EmptyPFHAdj + typename T::HEdgePointer &FHp(const int & ) { static typename T::HEdgePointer fp=0; assert(0); return fp; } + typename T::HEdgePointer const cFHp(const int & ) const { static typename T::HEdgePointer const fp=0; return fp; } + static bool HasFHAdjacency() { return false; } private: int _ns; }; @@ -74,8 +89,9 @@ private: /*-------------------------- VERTEX ----------------------------------------*/ template class PEmptyFVAdj: public T { public: - typedef typename T::VertexType VertexType; - // typedef typename T::CoordType CoordType; + typedef typename T::VertexType::CoordType CoordType; + typedef typename T::VertexType::ScalarType ScalarType; +// typedef typename T::CoordType CoordType; inline typename T::VertexType * & V( const int j ) { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * const & V( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * cV( const int j ) const { assert(0); static typename T::VertexType *vp=0; return vp; } @@ -92,8 +108,11 @@ public: }; template class PFVAdj: public T { public: + typedef typename T::VertexType::CoordType CoordType; + typedef typename T::VertexType::ScalarType ScalarType; + typedef typename T::VertexType VertexType; + PFVAdj(){_vpoly = NULL;} - typedef typename T::VertexType::CoordType::ScalarType ScalarType; inline typename T::VertexType * & V( const int j ) { assert(j>=0 && jVN()); return _vpoly[j]; } inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]; } inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]; } @@ -102,31 +121,31 @@ public: /** Return the pointer to the ((j+1)%3)-th vertex of the face. @param j Index of the face vertex. */ - inline typename T::VertexType * & V0( const int j ) { return V(j);} - inline typename T::VertexType * & V1( const int j ) { return V((j+1)%this->VN());} - inline typename T::VertexType * & V2( const int j ) { return V((j+2)%this->VN());} - inline const typename T::VertexType * const & V0( const int j ) const { return V(j);} - inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%this->VN());} - inline const typename T::VertexType * const & V2( const int j ) const { return V((j+2)%this->VN());} - inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);} - inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%this->VN());} - inline const typename T::VertexType * const & cV2( const int j ) const { return cV((j+2)%this->VN());} + inline VertexType * & V0( const int j ) { return V(j);} + inline VertexType * & V1( const int j ) { return V((j+1)%this->VN());} + inline VertexType * & V2( const int j ) { return V((j+2)%this->VN());} + inline const VertexType * const & V0( const int j ) const { return V(j);} + inline const VertexType * const & V1( const int j ) const { return V((j+1)%this->VN());} + inline const VertexType * const & V2( const int j ) const { return V((j+2)%this->VN());} + inline const VertexType * const & cV0( const int j ) const { return cV(j);} + inline const VertexType * const & cV1( const int j ) const { return cV((j+1)%this->VN());} + inline const VertexType * const & cV2( const int j ) const { return cV((j+2)%this->VN());} // Shortcut per accedere ai punti delle facce - inline typename T::CoordType & P( const int j ) { assert(j>=0 && jVN()); return _vpoly[j]->P(); } - inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]->cP(); } - inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]->cP(); } + inline CoordType & P( const int j ) { assert(j>=0 && jVN()); return _vpoly[j]->P(); } + inline const CoordType & P( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]->cP(); } + inline const CoordType &cP( const int j ) const { assert(j>=0 && jVN()); return _vpoly[j]->cP(); } /// Shortcut per accedere ai punti delle facce - inline typename T::CoordType & P0( const int j ) { return V(j)->P();} - inline typename T::CoordType & P1( const int j ) { return V((j+1)%this->VN())->P();} - inline typename T::CoordType & P2( const int j ) { return V((j+2)%this->VN())->P();} - inline const typename T::CoordType & P0( const int j ) const { return V(j)->P();} - inline const typename T::CoordType & P1( const int j ) const { return V((j+1)%this->VN())->P();} - inline const typename T::CoordType & P2( const int j ) const { return V((j+2)%this->VN())->P();} - inline const typename T::CoordType & cP0( const int j ) const { return cV(j)->P();} - inline const typename T::CoordType & cP1( const int j ) const { return cV((j+1)%this->VN())->P();} - inline const typename T::CoordType & cP2( const int j ) const { return cV((j+2)%this->VN())->P();} + inline CoordType & P0( const int j ) { return V(j)->P();} + inline CoordType & P1( const int j ) { return V((j+1)%this->VN())->P();} + inline CoordType & P2( const int j ) { return V((j+2)%this->VN())->P();} + inline const CoordType & P0( const int j ) const { return V(j)->P();} + inline const CoordType & P1( const int j ) const { return V((j+1)%this->VN())->P();} + inline const CoordType & P2( const int j ) const { return V((j+2)%this->VN())->P();} + inline const CoordType & cP0( const int j ) const { return cV(j)->P();} + inline const CoordType & cP1( const int j ) const { return cV((j+1)%this->VN())->P();} + inline const CoordType & cP2( const int j ) const { return cV((j+2)%this->VN())->P();} template void ImportLocal(const LeftF & leftF){ for(int i =0; i < this->VN(); ++i) V(i) = NULL; T::ImportLocal(leftF);} @@ -284,33 +303,36 @@ public: static void Name(std::vector & name){name.push_back(std::string("PFEAdj"));T::Name(name);} //private: - typename T::EdgePointer *_fepP ; + typename T::EdgePointer *_fepP ; }; -/*----------------------------- PFEADJ ------------------------------*/ -template class PFHEAdj: public T { +/*----------------------------- PFHADJ ------------------------------*/ + +template class PFHAdj: public T { public: - typedef typename T::EdgeType EdgeType; - PFHEAdj(){_fhepP = NULL; } - typename T::EdgePointer &FHEp() { return _fhepP; } - typename T::EdgePointer const FHEp() const { return _fhepP; } - typename T::EdgePointer const cFHEp() const { return _fhepP; } - + typedef typename T::HEdgeType HEdgeType; + typedef typename T::HEdgePointer HEdgePointer; + + PFHAdj(){_fhP = NULL; } + typename T::HEdgePointer &FHp() { return _fhP; } + typename T::HEdgePointer const cFHp() const { return _fhP; } + template void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);} inline void Alloc(const int & ns) {T::Alloc(ns);} inline void Dealloc() { T::Dealloc();} - static bool HasFHEAdjacency() { return true; } - static bool HasFHEAdjacencyOcc() { return false; } - static void Name(std::vector & name){name.push_back(std::string("PFHEAdj"));T::Name(name);} + static bool HasFHAdjacency() { return true; } + static bool HasFHAdjacencyOcc() { return false; } + static void Name(std::vector & name){name.push_back(std::string("PFHAdj"));T::Name(name);} //private: - typename T::EdgePointer _fhepP ; + typename T::HEdgePointer _fhP ; }; + } // end namespace face }// end namespace vcg #endif diff --git a/vcg/simplex/vertex/component.h b/vcg/simplex/vertex/component.h index 48514078..2483be10 100644 --- a/vcg/simplex/vertex/component.h +++ b/vcg/simplex/vertex/component.h @@ -145,6 +145,11 @@ public: int &VEi(){static int z=0; return z;}; static bool HasVEAdjacency() { return false; } + typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; } + typename TT::HEdgePointer cVHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; } + int &VHi(){static int z=0; return z;}; + static bool HasVHAdjacency() { return false; } + typedef Point3f VecType; typedef Point2f CurvatureType; @@ -459,6 +464,25 @@ private: int _zp ; }; +/*----------------------------- VHADJ ------------------------------*/ + +template class VHAdj: public T { +public: + VHAdj(){_hp=0;} + typename T::HEdgePointer &VHp() {return _hp; } + typename T::HEdgePointer cVHp() {return _hp; } + int &VHi() {return _zp; } + template < class LeftV> + void ImportLocal(const LeftV & left ) { VHp() = NULL; T::ImportLocal( left); } + static bool HasVHAdjacency() { return true; } + static bool HasVHAdjacencyOcc() { return true; } + static void Name(std::vector & name){name.push_back(std::string("VHAdj"));T::Name(name);} + +private: + typename T::HEdgePointer _hp ; + int _zp ; +}; + /*----------------------------- VTADJ ------------------------------*/ template class VTAdj: public T { diff --git a/vcg/simplex/vertex/component_ocf.h b/vcg/simplex/vertex/component_ocf.h index 09c8b455..b3fdcf9b 100644 --- a/vcg/simplex/vertex/component_ocf.h +++ b/vcg/simplex/vertex/component_ocf.h @@ -688,52 +688,52 @@ public: namespace tri { - template < class, class,class > class TriMesh; + template < class, class,class, class> class TriMesh; - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexRadius (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 > + bool HasPerVertexRadius (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m) { if(VertexType::HasRadiusOcf()) return m.vert.IsRadiusEnabled(); else return VertexType::HasRadius(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexQuality (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType , EdgeContainerType> & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2> + bool HasPerVertexQuality (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m) { if(VertexType::HasQualityOcf()) return m.vert.IsQualityEnabled(); else return VertexType::HasQuality(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexTexCoord (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType , EdgeContainerType> & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 > + bool HasPerVertexTexCoord (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m) { if(VertexType::HasTexCoordOcf()) return m.vert.IsTexCoordEnabled(); else return VertexType::HasTexCoord(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexNormal (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType , EdgeContainerType> & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 > + bool HasPerVertexNormal (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m) { if(VertexType::HasNormalOcf()) return m.vert.IsNormalEnabled(); else return VertexType::HasNormal(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexColor (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType , EdgeContainerType> & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2> + bool HasPerVertexColor (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2> & m) { if(VertexType::HasColorOcf()) return m.vert.IsColorEnabled(); else return VertexType::HasColor(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexCurvature (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2 > + bool HasPerVertexCurvature (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m) { if(VertexType::HasCurvatureOcf()) return m.vert.IsCurvatureEnabled(); else return VertexType::HasCurvature(); } - template < class VertexType, class FaceContainerType, class EdgeContainerType > - bool HasPerVertexCurvatureDir (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType, EdgeContainerType > & m) + template < class VertexType, class ContainerType0, class ContainerType1 ,class ContainerType2> + bool HasPerVertexCurvatureDir (const TriMesh < vertex::vector_ocf< VertexType > , ContainerType0, ContainerType1, ContainerType2 > & m) { if(VertexType::HasCurvatureDirOcf()) return m.vert.IsCurvatureDirEnabled(); else return VertexType::HasCurvatureDir();