[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
This commit is contained in:
parent
0a74ba11a5
commit
261ff53ab1
|
@ -62,12 +62,12 @@ we have to build the type a step a time (deriving from a single ancestor at a ti
|
|||
|
||||
*/
|
||||
template <class UserTypes>
|
||||
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;
|
||||
|
|
|
@ -253,33 +253,6 @@ private:
|
|||
typename T::VertexPointer _vp[2] ;
|
||||
};
|
||||
|
||||
/*----------------------------- HEVADJ ------------------------------*/
|
||||
template <class T> 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<std::string> & name){ T::Name(name);}
|
||||
};
|
||||
|
||||
template <class T> 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<std::string> & name){name.push_back(std::string("HEVAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::VertexPointer _vp ;
|
||||
};
|
||||
|
||||
/*----------------------------- EEADJ ------------------------------*/
|
||||
template <class T> class EmptyEEAdj: public T {
|
||||
|
@ -312,6 +285,35 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/*----------------------------- EHADJ ------------------------------*/
|
||||
template <class T> 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<std::string> & name){ T::Name(name);}
|
||||
};
|
||||
|
||||
template <class T> 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<std::string> & name){name.push_back(std::string("EHAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::EdgePointer _hp ;
|
||||
};
|
||||
|
||||
/*----------------------------- ETADJ ------------------------------*/
|
||||
|
||||
|
||||
|
@ -342,86 +344,6 @@ private:
|
|||
|
||||
|
||||
|
||||
/*----------------------------- HENextADJ ------------------------------*/
|
||||
template <class T> 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<std::string> & name){ T::Name(name);}
|
||||
};
|
||||
|
||||
template <class T> 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<std::string> & name){name.push_back(std::string("HENextAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::EdgePointer _nep ;
|
||||
};
|
||||
|
||||
/*----------------------------- HEOppADJ ------------------------------*/
|
||||
template <class T> 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<std::string> & name){ T::Name(name);}
|
||||
};
|
||||
|
||||
template <class T> 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<std::string> & name){name.push_back(std::string("HEOpptAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::EdgePointer _oep ;
|
||||
|
||||
};
|
||||
/*----------------------------- HEPrevADJ ------------------------------*/
|
||||
template <class T> 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<std::string> & name){ T::Name(name);}
|
||||
};
|
||||
|
||||
template <class T> 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<std::string> & name){name.push_back(std::string("HEPrevAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::EdgePointer _pep ;
|
||||
};
|
||||
/*----------------------------- EFADJ ------------------------------*/
|
||||
|
||||
template <class T> class EmptyEFAdj: public T {
|
||||
|
@ -454,36 +376,6 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/*----------------------------- EFADJ ------------------------------*/
|
||||
/**
|
||||
HEdgeData keep all the data for the half edge
|
||||
*/
|
||||
template <class T>
|
||||
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 T>
|
||||
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
|
||||
|
|
|
@ -103,6 +103,7 @@ First Really Working version
|
|||
#include <vcg/space/color4.h>
|
||||
|
||||
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<std::string> & name){T::Name(name);}
|
||||
|
||||
|
@ -648,6 +653,25 @@ private:
|
|||
char _fei[3] ;
|
||||
};
|
||||
|
||||
|
||||
/*----------------------------- FHADJ ------------------------------*/
|
||||
|
||||
template <class T> class FHAdj: public T {
|
||||
public:
|
||||
FHAdj(){_fh=0;}
|
||||
typename T::HEdgePointer &FHp( ) { return _fh; }
|
||||
typename T::HEdgePointer const cFHp( ) const { return _fh; }
|
||||
|
||||
template <class RightF>
|
||||
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<std::string> & name){name.push_back(std::string("FHAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::FacePointer _fh ;
|
||||
};
|
||||
} // end namespace face
|
||||
}// end namespace vcg
|
||||
#endif
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -42,6 +42,9 @@ template <class T> 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 T> 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 T> 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 T> 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 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]; }
|
||||
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<this->VN()); 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 && j<this->VN()); return _vpoly[j]->P(); }
|
||||
inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline CoordType & P( const int j ) { assert(j>=0 && j<this->VN()); return _vpoly[j]->P(); }
|
||||
inline const CoordType & P( const int j ) const { assert(j>=0 && j<this->VN()); return _vpoly[j]->cP(); }
|
||||
inline const CoordType &cP( const int j ) const { assert(j>=0 && j<this->VN()); 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 <class LeftF>
|
||||
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<std::string> & name){name.push_back(std::string("PFEAdj"));T::Name(name);}
|
||||
|
||||
//private:
|
||||
typename T::EdgePointer *_fepP ;
|
||||
typename T::EdgePointer *_fepP ;
|
||||
};
|
||||
|
||||
/*----------------------------- PFEADJ ------------------------------*/
|
||||
|
||||
template <class T> class PFHEAdj: public T {
|
||||
/*----------------------------- PFHADJ ------------------------------*/
|
||||
|
||||
template <class T> 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 <class LeftF>
|
||||
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<std::string> & 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<std::string> & 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
|
||||
|
|
|
@ -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 T> 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<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);}
|
||||
|
||||
private:
|
||||
typename T::HEdgePointer _hp ;
|
||||
int _zp ;
|
||||
};
|
||||
|
||||
/*----------------------------- VTADJ ------------------------------*/
|
||||
|
||||
template <class T> class VTAdj: public T {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue