Improved component documentation. Added IsVFInitialized, VFClear function for VF component. Clarified the difference between null and uninitialized for a VF component.

This commit is contained in:
Paolo Cignoni 2013-03-13 14:02:03 +00:00
parent 6950be4594
commit 4665f36e40
2 changed files with 71 additions and 25 deletions

View File

@ -116,7 +116,13 @@ public:
char &FFi(int) { static char z=0; assert(0); return z;}
char cVFi(int) const { static char z=0; assert(0); return z;}
char cFFi(int) const { static char z=0; assert(0); return z;}
bool IsVFInitialized(const int j) const {return static_cast<const typename T::FaceType *>(this)->cVFi(j)!=-1;}
void VFClear(int j) {
if(IsVFInitialized(j)) {
static_cast<typename T::FacePointer>(this)->VFp(j)=0;
static_cast<typename T::FacePointer>(this)->VFi(j)=-1;
}
}
static bool HasVFAdjacency() { return false; }
static bool HasFFAdjacency() { return false; }
static bool HasFEAdjacency() { return false; }
@ -402,8 +408,8 @@ public:
Q() = rightF.cQ();
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);}
private:
@ -524,12 +530,31 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
};
/*----------------------------- VFADJ ------------------------------*/
/*! \brief \em Component: Per Face \b Vertex-Face adjacency relation
It stores a pointer to the next face of the list of faces incident on a vertex that is stored in a distributed way on the faces themselves.
Note that if you use this component it is expected that on the Vertex you use also the corresponding vcg::vertex::VFAdj component.
Note that for this component we have three class of values:
- \b valid: a valid pointer in the range of the vector of faces
- \b null: a null pointer, used to indicate the end of the list
- \b uninitialized: a special value that you can test/set with the IsVFInitialized()/VFClear() functions;
it is used to indicate when the VF Topology is not computed.
\sa vcg::tri::UpdateTopology for functions that compute this relation
\sa vcg::vertex::VFAdj
\sa iterators
*/
template <class T> class VFAdj: public T {
public:
VFAdj(){
_vfp[0]=0;
_vfp[1]=0;
_vfp[2]=0;
_vfi[0]=-1;
_vfi[1]=-1;
_vfi[2]=-1;
}
typename T::FacePointer &VFp(const int j) { assert(j>=0 && j<3); return _vfp[j]; }
typename T::FacePointer cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
@ -537,8 +562,8 @@ public:
char cVFi(const int j)const {return _vfi[j]; }
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasVFAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
@ -575,6 +600,19 @@ private:
/*----------------------------- FFADJ ------------------------------*/
/*! \brief \em Component: Per Face \b Face-Face adjacency relation
It encodes the adjacency of faces through edges; for 2-manifold edges it just point to the other face,
and for non manifold edges (where more than 2 faces share the same edge) it stores a pointer to the next
face of the ring of faces incident on a edge.
Note that border faces points to themselves.
NULL pointer is used as a special value to indicate when the FF Topology is not computed.
\sa vcg::tri::UpdateTopology for functions that compute this relation
\sa vcg::vertex::VFAdj
\sa iterators
*/
template <class T> class FFAdj: public T {
public:
FFAdj(){

View File

@ -101,9 +101,16 @@ public:
typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; }
typename TT::FacePointer cVFp() const { static typename TT::FacePointer fp=0; assert(0); return fp; }
int &VFi() { static int z=0; assert(0); return z;}
int cVFi() const { static int z=0; assert(0); return z;}
static bool HasVFAdjacency() { return false; }
int &VFi() { static int z=-1; assert(0); return z;}
int cVFi() const { static int z=-1; assert(0); return z;}
static bool HasVFAdjacency() { return false; }
bool IsVFInitialized() const {return static_cast<const typename TT::VertexType *>(this)->cVFi()!=-1;}
void VFClear() {
if(IsVFInitialized()) {
static_cast<typename TT::VertexPointer>(this)->VFp()=0;
static_cast<typename TT::VertexPointer>(this)->VFi()=-1;
}
}
typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; }
typename TT::EdgePointer cVEp() const { static typename TT::EdgePointer ep=0; assert(0); return ep; }
@ -229,7 +236,7 @@ public:
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private:
int _imark;
int _imark;
};
/*-------------------------- TEXCOORD ----------------------------------------*/
@ -249,7 +256,7 @@ public:
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(rVert.IsTexCoordEnabled()) T() = rVert.cT(); TT::ImportData( rVert); }
static bool HasTexCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
private:
TexCoordType _t;
@ -311,7 +318,7 @@ private:
};
template <class TT> class Color4b: public Color<vcg::Color4b, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
};
/*-------------------------- Quality ----------------------------------*/
@ -396,8 +403,8 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class CurvatureDir: public TT {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ return _curv.max_dir;}
VecType &PD2(){ return _curv.min_dir;}
@ -485,10 +492,11 @@ private:
/*----------------------------- VFADJ ------------------------------*/
/*! \brief \em Component: Per vertex \b Vertex-Face adjacency relation
It stores a pointer to the first Face of a list of Faces that is stored in a distributed way on the faces themselves.
It stores a pointer to the first face of a list of faces that is stored in a distributed way on the faces themselves.
Note that if you use this component it is expected that on the Face you use also the corresponding vcg::face::VFAdj component.
\sa vcg::tri::UpdateTopology for functions that compute this relation
\sa vcg::face::VFAdj
\sa iterators
*/