HEAVY CHANGE:

The vertex and face component (natural and optional) have been cleaned and reordered.
Particular care has been devoted to have common behaviour in the import, const access, and so. 
If you get compilation errors probably it is due to the fact that if you really need constant access to a member you have to use the "c" prefixed member (e.g. if you access to normal of a constant vertex you should use the cN() member.
This commit is contained in:
Paolo Cignoni 2012-11-15 19:04:08 +00:00
parent 41e7a19fd1
commit 5c266a7ccb
4 changed files with 674 additions and 777 deletions

View File

@ -36,27 +36,24 @@ namespace face {
template <class T> class EmptyCore: public T { template <class T> class EmptyCore: public T {
public: public:
inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * &V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * & FVp( const int i ) { return this->V(i); } inline typename T::VertexType * &FVp( const int i ) { return this->V(i); }
inline typename T::VertexType * cFVp( const int i ) const { return this->cV(i); } inline typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline typename T::CoordType &P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline typename T::CoordType cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
static bool HasVertexRef() { return false; } static bool HasVertexRef() { return false; }
static bool HasFVAdjacency() { return false; } static bool HasFVAdjacency() { return false; }
typedef typename T::VertexType::NormalType NormalType; typedef typename T::VertexType::NormalType NormalType;
NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
const NormalType &cN() const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } NormalType cN() const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
const NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
static bool HasWedgeNormal() { return false; } static bool HasWedgeNormal() { return false; }
static bool HasFaceNormal() { return false; } static bool HasFaceNormal() { return false; }
static bool HasWedgeNormalOcf() { return false; }
static bool HasFaceNormalOcf() { return false; }
typedef int WedgeTexCoordType; typedef int WedgeTexCoordType;
typedef vcg::TexCoord2<float,1> TexCoordType; typedef vcg::TexCoord2<float,1> TexCoordType;
@ -64,16 +61,14 @@ public:
TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;} TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;}
static bool HasWedgeTexCoord() { return false; } static bool HasWedgeTexCoord() { return false; }
static bool HasWedgeTexCoordOcf() { return false; }
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int cFlags() const { return 0; } int cFlags() const { return 0; }
static bool HasFlags() { return false; } static bool HasFlags() { return false; }
static bool HasFlagsOcf() { return false; }
inline void InitIMark() { } inline void InitIMark() { }
inline int & IMark() { assert(0); static int tmp=-1; return tmp;} inline int &IMark() { assert(0); static int tmp=-1; return tmp;}
inline int IMark() const {return 0;} inline int cIMark() const {return 0;}
typedef int MarkType; typedef int MarkType;
typedef float QualityType; typedef float QualityType;
@ -81,75 +76,60 @@ public:
typedef vcg::Color4b ColorType; typedef vcg::Color4b ColorType;
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
ColorType &WC(const int) { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType &WC(const int) { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
const ColorType &cWC(const int) const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType cWC(const int) const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
Quality3Type &Q3() { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; } Quality3Type &Q3() { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
const Quality3Type &cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; } Quality3Type cQ3() const { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; }
static bool HasFaceColor() { return false; } static bool HasFaceColor() { return false; }
static bool HasFaceColorOcf() { return false;}
static bool HasWedgeColor() { return false; } static bool HasWedgeColor() { return false; }
static bool HasWedgeColorOcf() { return false; }
static bool HasFaceQuality() { return false; } static bool HasFaceQuality() { return false; }
static bool HasFaceQualityOcf() { return false;}
static bool HasFaceQuality3() { return false; } static bool HasFaceQuality3() { return false; }
static bool HasFaceQuality3Ocf() { return false;} static bool HasFaceMark() { return false; }
static bool HasMark() { return false; }
static bool HasMarkOcf() { return false; }
typedef int VFAdjType; typedef int VFAdjType;
typename T::FacePointer &VFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; } typename T::FacePointer &VFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer const cVFp(const int) const { static typename T::FacePointer const fp=0; return fp; } typename T::FacePointer cVFp(int) const { static typename T::FacePointer fp=0; return fp; }
typename T::FacePointer &FFp(const int) { static typename T::FacePointer fp=0; assert(0); return fp; } typename T::FacePointer &FFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; } typename T::FacePointer cFFp(int) const { static typename T::FacePointer fp=0; return fp; }
typename T::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; } typename T::EdgePointer &FEp(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; } typename T::EdgePointer cFEp(int) const { static typename T::EdgePointer fp=0; return fp; }
typename T::HEdgePointer &FHp() { static typename T::HEdgePointer fp=0; assert(0); return fp; } typename T::HEdgePointer &FHp() { static typename T::HEdgePointer fp=0; assert(0); return fp; }
typename T::HEdgePointer const cFHp() const { static typename T::HEdgePointer const fp=0; assert(0);return fp; } typename T::HEdgePointer cFHp() const { static typename T::HEdgePointer fp=0; assert(0);return fp; }
char &VFi(const int j){(void)j; static char z=0; assert(0); return z;} char &VFi(int) { static char z=0; assert(0); return z;}
char &FFi(const int j){(void)j; static char z=0; assert(0); return z;} char &FFi(int) { static char z=0; assert(0); return z;}
const char &cVFi(const int j){(void)j; static char z=0; return z;} char cVFi(int) const { static char z=0; return z;}
const char &cFFi(const int j) const {(void)j; static char z=0; return z;} char cFFi(int) const { static char z=0; return z;}
static bool HasVFAdjacency() { return false; } static bool HasVFAdjacency() { return false; }
static bool HasFFAdjacency() { return false; } static bool HasFFAdjacency() { return false; }
static bool HasFEAdjacency() { return false; } static bool HasFEAdjacency() { return false; }
static bool HasFHAdjacency() { return false; } static bool HasFHAdjacency() { return false; }
static bool HasFFAdjacencyOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; }
static bool HasFEAdjacencyOcf() { return false; }
static bool HasFHAdjacencyOcf() { return false; }
typedef int CurvatureDirType; typedef int CurvatureDirType;
Point3f &PD1(){static Point3f dummy(0,0,0); return dummy;} Point3f &PD1() { static Point3f dummy(0,0,0); return dummy;}
Point3f &PD2(){static Point3f dummy(0,0,0); return dummy;} Point3f &PD2() { static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD1() const {static Point3f dummy(0,0,0); return dummy;} Point3f cPD1() const { static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD2()const {static Point3f dummy(0,0,0); return dummy;} Point3f cPD2() const { static Point3f dummy(0,0,0); return dummy;}
float &K1(){ static float dummy(0);assert(0);return dummy;} float &K1() { static float dummy(0); assert(0); return dummy;}
float &K2(){ static float dummy(0);assert(0);return dummy;} float &K2() { static float dummy(0); assert(0); return dummy;}
const float &cK1()const { static float dummy(0);assert(0);return dummy;} float cK1() const { static float dummy(0); assert(0); return dummy;}
const float &cK2()const { static float dummy(0);assert(0);return dummy;} float cK2() const { static float dummy(0); assert(0); return dummy;}
static bool HasCurvatureDir() { return false; } static bool HasCurvatureDir() { return false; }
static bool HasCurvatureDirOcf() { return false; }
inline void SetVN(const int & /*n*/) {assert(0);} inline void SetVN(const int & /*n*/) {assert(0);}
static bool HasPolyInfo() { return false; } static bool HasPolyInfo() { return false; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF) {T::ImportData(rightF);} void ImportData(const RightValueType & rightF) {T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns) {T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -172,20 +152,15 @@ public:
typedef typename T::VertexType::CoordType CoordType; typedef typename T::VertexType::CoordType CoordType;
typedef typename T::VertexType::ScalarType ScalarType; typedef typename T::VertexType::ScalarType ScalarType;
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3); return v[j]; } /// \brief The pointer to the i-th vertex inline typename T::VertexType * &V( const int j ) { assert(j>=0 && j<3); return v[j]; } /// \brief The pointer to the i-th vertex
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; } inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline CoordType & P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); } /// \brief Shortcut: the position of the i-th vertex (equivalent to \c V(i)->P() ) inline CoordType &P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); } /// \brief Shortcut: the position of the i-th vertex (equivalent to \c V(i)->P() )
inline const CoordType & P( const int j ) const { assert(j>=0 && j<3); return v[j]->cP(); } inline CoordType cP( const int j ) const { assert(j>=0 && j<3); return v[j]->cP(); }
inline const CoordType &cP( const int j ) const { assert(j>=0 && j<3); return v[j]->cP(); }
inline typename T::VertexType * & V0( const int j ) { return V(j);} /** \brief Return the pointer to the j-th vertex of the face. */ inline typename T::VertexType * & V0( const int j ) { return V(j);} /** \brief Return the pointer to the j-th vertex of the face. */
inline typename T::VertexType * & V1( const int j ) { return V((j+1)%3);} /** \brief Return the pointer to the ((j+1)%3)-th vertex of the face. */ inline typename T::VertexType * & V1( const int j ) { return V((j+1)%3);} /** \brief Return the pointer to the ((j+1)%3)-th vertex of the face. */
inline typename T::VertexType * & V2( const int j ) { return V((j+2)%3);} /** \brief Return the pointer to the ((j+2)%3)-th vertex of the face. */ inline typename T::VertexType * & V2( const int j ) { return V((j+2)%3);} /** \brief Return the pointer to the ((j+2)%3)-th vertex of the face. */
inline typename T::VertexType * V0( const int j ) const { return V(j);}
inline typename T::VertexType * V1( const int j ) const { return V((j+1)%3);}
inline typename T::VertexType * V2( const int j ) const { return V((j+2)%3);}
inline typename T::VertexType * cV0( const int j ) const { return cV(j);} inline typename T::VertexType * cV0( const int j ) const { return cV(j);}
inline typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);} inline typename T::VertexType * cV1( const int j ) const { return cV((j+1)%3);}
inline typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);} inline typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
@ -193,9 +168,6 @@ public:
inline CoordType & P0( const int j ) { return V(j)->P();} inline CoordType & P0( const int j ) { return V(j)->P();}
inline CoordType & P1( const int j ) { return V((j+1)%3)->P();} inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}
inline CoordType & P2( const int j ) { return V((j+2)%3)->P();} inline CoordType & P2( const int j ) { return V((j+2)%3)->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)%3)->P();}
inline const CoordType & P2( const int j ) const { return V((j+2)%3)->P();}
inline const CoordType & cP0( const int j ) const { return cV(j)->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)%3)->P();} inline const CoordType & cP1( const int j ) const { return cV((j+1)%3)->P();}
inline const CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();} inline const CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();}
@ -203,8 +175,8 @@ public:
// Small comment about the fact that the pointers are zero filled. // Small comment about the fact that the pointers are zero filled.
// The importLocal is meant for copyng stuff between very different meshes, so copying the pointers would be meaningless. // The importLocal is meant for copyng stuff between very different meshes, so copying the pointers would be meaningless.
// if you are using ImportData for copying internally simplex you have to set up all the pointers by hand. // if you are using ImportData for copying internally simplex you have to set up all the pointers by hand.
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ T::ImportData(rightF);} void ImportData(const RightValueType & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
@ -213,8 +185,7 @@ public:
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
private:
private:
typename T::VertexType *v[3]; typename T::VertexType *v[3];
}; };
@ -227,12 +198,12 @@ void ComputeNormalizedNormal(T &f) { f.N().Import(vcg::NormalizedNormal<T>(f));
template <class A, class T> class NormalAbs: public T { template <class A, class T> class NormalAbs: public T {
public: public:
typedef A NormalType; typedef A NormalType;
NormalType &N() { return _norm; } inline NormalType &N() { return _norm; }
NormalType cN() const { return _norm; } inline NormalType cN() const { return _norm; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF) void ImportData(const RightValueType & rightF)
{ {
N().Import(rightF.cN()); if(RightValueType::HasFaceNormal()) N().Import(rightF.cN());
T::ImportData( rightF); T::ImportData( rightF);
} }
@ -248,10 +219,10 @@ private:
template <class T> class WedgeNormal: public T { template <class T> class WedgeNormal: public T {
public: public:
typedef typename T::VertexType::NormalType NormalType; typedef typename T::VertexType::NormalType NormalType;
NormalType &WN(const int j) { return _wnorm[j]; } inline NormalType &WN(int j) { return _wnorm[j]; }
const NormalType cWN(const int j) const { return _wnorm[j]; } inline NormalType cWN(int j) const { return _wnorm[j]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);} void ImportData(const RightValueType & rightF){ if(RightValueType::HasWedgeNormal()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
@ -264,10 +235,10 @@ private:
template <class A, class T> class WedgeRealNormal: public T { template <class A, class T> class WedgeRealNormal: public T {
public: public:
typedef A NormalType; typedef A NormalType;
NormalType &WN(const int i) { return _wn[i]; } inline NormalType &WN(int i) { return _wn[i]; }
NormalType const &cWN(const int i) const { return _wn[i]; } inline NormalType cWN(int i) const { return _wn[i]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);} void ImportData(const RightValueType & rightF){ if(RightValueType::HasWedgeNormal()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
@ -302,9 +273,13 @@ public:
typedef int WedgeTexCoordType; typedef int WedgeTexCoordType;
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &WT(const int i) { return _wt[i]; } TexCoordType &WT(const int i) { return _wt[i]; }
TexCoordType const &cWT(const int i) const { return _wt[i]; } TexCoordType cWT(const int i) const { return _wt[i]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); } T::ImportData(rightF);} void ImportData(const RightValueType & rightF){
if(RightValueType::HasWedgeTexCoord())
for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); }
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeTexCoord() { return true; } static bool HasWedgeTexCoord() { return true; }
@ -331,11 +306,15 @@ This component stores a 32 bit array of bit flags. These bit flags are used for
*/ */
template <class T> class BitFlags: public T { template <class T> class BitFlags: public T {
public: public:
BitFlags(){_flags=0;} BitFlags():_flags(0) {}
int &Flags() {return _flags; } int &Flags() {return _flags; }
int cFlags() const {return _flags; } int cFlags() const {return _flags; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportData(rightF);} void ImportData(const RightValueType & rightF){
if(RightValueType::HasFlags())
Flags() = rightF.cFlags();
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
@ -345,15 +324,19 @@ private:
int _flags; int _flags;
}; };
/*-------------------------- Color Mark Quality ----------------------------------*/ /*-------------------------- Color ----------------------------------*/
template <class A, class T> class Color: public T { template <class A, class T> class Color: public T {
public: public:
typedef A ColorType; typedef A ColorType;
Color():_color(vcg::Color4b::White) {} Color():_color(vcg::Color4b::White) {}
ColorType &C() { return _color; } ColorType &C() { return _color; }
const ColorType &cC() const { return _color; } ColorType cC() const { return _color; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ C() = rightF.cC();T::ImportData(rightF);} void ImportData(const RightValueType & rightF){
if(RightValueType::HasFaceColor())
C() = rightF.cC();
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceColor() { return true; } static bool HasFaceColor() { return true; }
@ -366,12 +349,18 @@ private:
template <class A, class T> class WedgeColor: public T { template <class A, class T> class WedgeColor: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &WC(const int i) { return _color[i]; } ColorType &WC(int i) { return _color[i]; }
const ColorType &WC(const int i) const { return _color[i]; } ColorType cWC(int i) const { return _color[i]; }
const ColorType &cWC(const int i) const { return _color[i]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ if (RightF::HasWedgeColor()) { for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); } T::ImportData(rightF); } } void ImportData(const RightValueType & rightF){
if (RightValueType::HasWedgeColor())
{
for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); }
}
T::ImportData(rightF);
}
static bool HasWedgeColor() { return true; } static bool HasWedgeColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);}
@ -394,13 +383,16 @@ template <class A, class T> class Quality: public T {
public: public:
typedef A QualityType; typedef A QualityType;
QualityType &Q() { return _quality; } QualityType &Q() { return _quality; }
const QualityType &cQ() const { return _quality; } QualityType cQ() const { return _quality; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ if(RightF::HasFaceQuality()) Q() = rightF.cQ();T::ImportData(rightF);} void ImportData(const RightValueType & rightF){
if(RightValueType::HasFaceQuality())
Q() = rightF.cQ();
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceQuality() { return true; } static bool HasFaceQuality() { return true; }
static bool HasFaceQualityOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));T::Name(name);}
private: private:
QualityType _quality; QualityType _quality;
@ -421,13 +413,15 @@ template <class A, class T> class Quality3: public T {
public: public:
typedef vcg::Point3<A> Quality3Type; typedef vcg::Point3<A> Quality3Type;
Quality3Type &Q3() { return _quality; } Quality3Type &Q3() { return _quality; }
const Quality3Type &cQ3() const { return _quality; } Quality3Type cQ3() const { return _quality; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){ if(RightF::HasFaceQuality3()) Q3() = rightF.cQ3();T::ImportData(rightF);} void ImportData(const RightValueType & rightF){
if(RightValueType::HasFaceQuality3()) Q3() = rightF.cQ3();
T::ImportData(rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceQuality3() { return true; } static bool HasFaceQuality3() { return true; }
static bool HasFaceQuality3Occ() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality3"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality3"));T::Name(name);}
private: private:
Quality3Type _quality; Quality3Type _quality;
@ -446,32 +440,36 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::s
/*-------------------------- INCREMENTAL MARK ----------------------------------------*/ /*-------------------------- INCREMENTAL MARK ----------------------------------------*/
/*! \brief Per vertex \b Incremental \b Mark /*! \brief Per vertex \b Incremental \b Mark
It is just an int that allows to efficently un-mark the whole mesh. \sa UnmarkAll It is just an \c int that allows to efficently (in constant time) un-mark the whole mesh. \sa UnmarkAll
*/ */
template <class T> class Mark: public T { template <class T> class Mark: public T {
public: public:
static bool HasMark() { return true; } inline int &IMark() { return _imark;}
inline int cIMark() const { return _imark;}
inline void InitIMark() { _imark = 0; } inline void InitIMark() { _imark = 0; }
inline int & IMark() { return _imark;} static bool HasFaceMark() { return true; }
inline const int & IMark() const {return _imark;} template <class RightValueType>
template <class RightF> void ImportData(const RightValueType & rightF){
void ImportData(const RightF & rightF){ IMark() = rightF.IMark();T::ImportData(rightF);} if(RightValueType::HasFaceMark())
IMark() = rightF.cIMark();
T::ImportData(rightF);
}
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
int _imark; int _imark;
}; };
/*-------------------------- Curvature Direction ----------------------------------*/ /*-------------------------- Curvature Direction ----------------------------------*/
template <class S> template <class S>
struct CurvatureDirBaseType{ struct CurvatureDirBaseType{
typedef Point3<S> VecType; typedef Point3<S> VecType;
typedef S ScalarType; typedef S ScalarType;
CurvatureDirBaseType () {} CurvatureDirBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values S k1,k2;// max and min curvature values
}; };
template <class A, class TT> class CurvatureDir: public TT { template <class A, class TT> class CurvatureDir: public TT {
public: public:
@ -479,18 +477,18 @@ public:
typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ return _curv.max_dir;} VecType &PD1() { return _curv.max_dir;}
VecType &PD2(){ return _curv.min_dir;} VecType &PD2() { return _curv.min_dir;}
const VecType &cPD1() const {return _curv.max_dir;} VecType cPD1() const { return _curv.max_dir;}
const VecType &cPD2() const {return _curv.min_dir;} VecType cPD2() const { return _curv.min_dir;}
ScalarType &K1(){ return _curv.k1;} ScalarType &K1() { return _curv.k1;}
ScalarType &K2(){ return _curv.k2;} ScalarType &K2() { return _curv.k2;}
const ScalarType &cK1() const {return _curv.k1;} ScalarType cK1() const {return _curv.k1;}
const ScalarType &cK2()const {return _curv.k2;} ScalarType cK2() const {return _curv.k2;}
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { void ImportData(const RightValueType & left ) {
if(LeftV::HasCurvatureDir()) { if(RightValueType::HasCurvatureDir()) {
PD1() = left.cPD1(); PD2() = left.cPD2(); PD1() = left.cPD1(); PD2() = left.cPD2();
K1() = left.cK1(); K2() = left.cK2(); K1() = left.cK1(); K2() = left.cK2();
} }
@ -521,15 +519,13 @@ public:
_vfp[2]=0; _vfp[2]=0;
} }
typename T::FacePointer &VFp(const int j) { assert(j>=0 && j<3); return _vfp[j]; } typename T::FacePointer &VFp(const int j) { assert(j>=0 && j<3); return _vfp[j]; }
typename T::FacePointer const VFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; } typename T::FacePointer cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
char &VFi(const int j) {return _vfi[j]; } char &VFi(const int j) {return _vfi[j]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){T::ImportData(rightF);} void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
private: private:
@ -549,15 +545,13 @@ public:
_efi[2]=-1; _efi[2]=-1;
} }
typename T::FacePointer &EFp(const int j) { assert(j>=0 && j<3); return _efp[j]; } typename T::FacePointer &EFp(const int j) { assert(j>=0 && j<3); return _efp[j]; }
typename T::FacePointer const EFp(const int j) const { assert(j>=0 && j<3); return _efp[j]; } typename T::FacePointer cEFp(const int j) const { assert(j>=0 && j<3); return _efp[j]; }
typename T::FacePointer const cEFp(const int j) const { assert(j>=0 && j<3); return _efp[j]; }
char &VFi(const int j) {return _efi[j]; } char &VFi(const int j) {return _efi[j]; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){T::ImportData(rightF);} void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasEFAdjacency() { return true; } static bool HasEFAdjacency() { return true; }
static bool HasEFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);}
private: private:
@ -575,22 +569,20 @@ public:
_ffp[2]=0; _ffp[2]=0;
} }
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<3); return _ffp[j]; } typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<3); return _ffp[j]; }
typename T::FacePointer const FFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; } typename T::FacePointer cFFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
typename T::FacePointer const cFFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
char &FFi(const int j) { return _ffi[j]; } char &FFi(const int j) { return _ffi[j]; }
const char &cFFi(const int j) const { return _ffi[j]; } char cFFi(const int j) const { return _ffi[j]; }
typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);} typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);}
typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);} typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);}
typename T::FacePointer const FFp1( const int j ) const { return FFp((j+1)%3);} typename T::FacePointer cFFp1( const int j ) const { return FFp((j+1)%3);}
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);} typename T::FacePointer cFFp2( const int j ) const { return FFp((j+2)%3);}
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){T::ImportData(rightF);} void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("FFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("FFAdj"));T::Name(name);}
private: private:
@ -608,17 +600,17 @@ public:
_fep[1]=0; _fep[1]=0;
_fep[2]=0; _fep[2]=0;
} }
typename T::EdgePointer &FEp(const int j) { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer const FEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer const cFEp(const int j) const { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer &FEp1( const int j ) { return FEp((j+1)%3);} typename T::EdgePointer &FEp( int j) { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer &FEp2( const int j ) { return FEp((j+2)%3);} typename T::EdgePointer cFEp( int j) const { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer const FEp1( const int j ) const { return FEp((j+1)%3);}
typename T::EdgePointer const FEp2( const int j ) const { return FEp((j+2)%3);}
template <class RightF> typename T::EdgePointer &FEp1( int j ) { return FEp((j+1)%3);}
void ImportData(const RightF & rightF){T::ImportData(rightF);} typename T::EdgePointer &FEp2( int j ) { return FEp((j+2)%3);}
typename T::EdgePointer FEp1( int j ) const { return FEp((j+1)%3);}
typename T::EdgePointer FEp2( int j ) const { return FEp((j+2)%3);}
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFEAdjacency() { return true; } static bool HasFEAdjacency() { return true; }
@ -635,10 +627,10 @@ template <class T> class FHAdj: public T {
public: public:
FHAdj(){_fh=0;} FHAdj(){_fh=0;}
typename T::HEdgePointer &FHp( ) { return _fh; } typename T::HEdgePointer &FHp( ) { return _fh; }
typename T::HEdgePointer const cFHp( ) const { return _fh; } typename T::HEdgePointer cFHp( ) const { return _fh; }
template <class RightF> template <class RightValueType>
void ImportData(const RightF & rightF){T::ImportData(rightF);} void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFHAdjacency() { return true; } static bool HasFHAdjacency() { return true; }
@ -647,7 +639,7 @@ public:
private: private:
typename T::HEdgePointer _fh ; typename T::HEdgePointer _fh ;
}; };
/** @} */ // End Doxygen FaceComponentGroup /** @} */ // End Doxygen FaceComponentGroup
} // end namespace face } // end namespace face
}// end namespace vcg }// end namespace vcg
#endif #endif

View File

@ -390,12 +390,7 @@ public:
}; // end class vector_ocf }; // end class vector_ocf
//template<> void EnableAttribute<typename VALUE_TYPE::NormalType>(){ NormalEnabled=true;}
/*------------------------- COORD -----------------------------------------*/
/*----------------------------- VFADJ ------------------------------*/ /*----------------------------- VFADJ ------------------------------*/
template <class T> class VFAdjOcf: public T { template <class T> class VFAdjOcf: public T {
public: public:
typename T::FacePointer &VFp(const int j) { typename T::FacePointer &VFp(const int j) {
@ -422,9 +417,8 @@ public:
private: private:
}; };
/*----------------------------- FFADJ ------------------------------*/ /*----------------------------- FFADJ ------------------------------*/
template <class T> class FFAdjOcf: public T { template <class T> class FFAdjOcf: public T {
public: public:
typename T::FacePointer &FFp(const int j) { typename T::FacePointer &FFp(const int j) {
@ -432,8 +426,7 @@ public:
return (*this).Base().AF[(*this).Index()]._fp[j]; return (*this).Base().AF[(*this).Index()]._fp[j];
} }
typename T::FacePointer const FFp(const int j) const { return cFFp(j);} typename T::FacePointer cFFp(const int j) const {
typename T::FacePointer const cFFp(const int j) const {
if(! (*this).Base().FFAdjacencyEnabled ) return 0; if(! (*this).Base().FFAdjacencyEnabled ) return 0;
else return (*this).Base().AF[(*this).Index()]._fp[j]; else return (*this).Base().AF[(*this).Index()]._fp[j];
} }
@ -449,11 +442,11 @@ public:
typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);} typename T::FacePointer &FFp1( const int j ) { return FFp((j+1)%3);}
typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);} typename T::FacePointer &FFp2( const int j ) { return FFp((j+2)%3);}
typename T::FacePointer const FFp1( const int j ) const { return FFp((j+1)%3);} typename T::FacePointer cFFp1( const int j ) const { return FFp((j+1)%3);}
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);} typename T::FacePointer cFFp2( const int j ) const { return FFp((j+2)%3);}
typename T::FacePointer & Neigh( const int j ) { return FFp(j);} typename T::FacePointer &Neigh( const int j ) { return FFp(j);}
typename T::FacePointer const cNeigh( const int j ) const { return cFFp(j);} typename T::FacePointer cNeigh( const int j ) const { return cFFp(j);}
unsigned int SizeNeigh(){return 3;} unsigned int SizeNeigh(){return 3;}
template <class LeftF> template <class LeftF>
@ -462,12 +455,9 @@ public:
} }
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcf() { return true; } static bool HasFFAdjacencyOcf() { return true; }
private:
}; };
/*------------------------- Normal -----------------------------------------*/ /*------------------------- Normal -----------------------------------------*/
template <class A, class T> class NormalOcf: public T { template <class A, class T> class NormalOcf: public T {
public: public:
typedef A NormalType; typedef A NormalType;
@ -478,27 +468,24 @@ public:
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; } return (*this).Base().NV[(*this).Index()]; }
const NormalType &cN() const { NormalType cN() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; } return (*this).Base().NV[(*this).Index()]; }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled) if((*this).Base().NormalEnabled && LeftF::HasNormal())
N() = leftF.cN(); N() = leftF.cN();
T::ImportData(leftF); T::ImportData(leftF);
} }
}; };
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {}; template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {}; template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {}; template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
/*------------------------- CurvatureDir -----------------------------------------*/ /*------------------------- CurvatureDir -----------------------------------------*/
template <class S> template <class S>
struct CurvatureDirOcfBaseType{ struct CurvatureDirOcfBaseType{
typedef Point3<S> VecType; typedef Point3<S> VecType;
@ -515,44 +502,44 @@ public:
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::ScalarType ScalarType;
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }
static bool HaCurvatureDirOcf() { return true; } static bool HasCurvatureDirOcf() { return true; }
VecType &PD1(){ VecType &PD1() {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir; return (*this).Base().CDV[(*this).Index()].max_dir;
} }
VecType &PD2(){ VecType &PD2() {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir; return (*this).Base().CDV[(*this).Index()].min_dir;
} }
const VecType &cPD1() const { VecType cPD1() const {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir; return (*this).Base().CDV[(*this).Index()].max_dir;
} }
const VecType &cPD2() const { VecType cPD2() const {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir; return (*this).Base().CDV[(*this).Index()].min_dir;
} }
ScalarType &K1(){ ScalarType &K1() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1; return (*this).Base().CDV[(*this).Index()].k1;
} }
ScalarType &K2(){ ScalarType &K2() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2; return (*this).Base().CDV[(*this).Index()].k2;
} }
const ScalarType &cK1() const { ScalarType cK1() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1; return (*this).Base().CDV[(*this).Index()].k1;
} }
const ScalarType &cK2() const { ScalarType cK2() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2; return (*this).Base().CDV[(*this).Index()].k2;
@ -561,7 +548,7 @@ public:
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
if((*this).Base().CurvatureDirEnabled && leftF.Base().CurvatureDirEnabled) if((*this).Base().CurvatureDirEnabled && LeftF::HasCurvatureDir())
PD1() = leftF.cPD1(); PD1() = leftF.cPD1();
PD2() = leftF.cPD2(); PD2() = leftF.cPD2();
K1() = leftF.cK1(); K1() = leftF.cK1();
@ -579,7 +566,6 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
}; };
///*-------------------------- QUALITY ----------------------------------*/ ///*-------------------------- QUALITY ----------------------------------*/
template <class A, class T> class QualityOcf: public T { template <class A, class T> class QualityOcf: public T {
public: public:
typedef A QualityType; typedef A QualityType;
@ -587,19 +573,14 @@ public:
assert((*this).Base().QualityEnabled); assert((*this).Base().QualityEnabled);
return (*this).Base().QV[(*this).Index()]; return (*this).Base().QV[(*this).Index()];
} }
const QualityType Q() const { QualityType cQ() const {
assert((*this).Base().QualityEnabled);
return (*this).Base().QV[(*this).Index()];
}
const QualityType cQ() const {
assert((*this).Base().QualityEnabled); assert((*this).Base().QualityEnabled);
return (*this).Base().QV[(*this).Index()]; return (*this).Base().QV[(*this).Index()];
} }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)// WRONG I do not know anything about leftV! if((*this).Base().QualityEnabled && LeftF::HasFaceQuality())
if((*this).Base().QualityEnabled)
Q() = leftF.cQ(); Q() = leftF.cQ();
T::ImportData(leftF); T::ImportData(leftF);
} }
@ -610,7 +591,6 @@ public:
template <class T> class QualityfOcf: public QualityOcf<float, T> {}; template <class T> class QualityfOcf: public QualityOcf<float, T> {};
///*-------------------------- COLOR ----------------------------------*/ ///*-------------------------- COLOR ----------------------------------*/
template <class A, class T> class ColorOcf: public T { template <class A, class T> class ColorOcf: public T {
public: public:
typedef A ColorType; typedef A ColorType;
@ -618,19 +598,14 @@ public:
assert((*this).Base().ColorEnabled); assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }
const ColorType C() const { ColorType cC() const {
assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()];
}
const ColorType cC() const {
assert((*this).Base().ColorEnabled); assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()]; return (*this).Base().CV[(*this).Index()];
} }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)// WRONG I do not know anything about leftV! if((*this).Base().ColorEnabled && LeftF::HasFaceColor())
if((*this).Base().ColorEnabled )
C() = leftF.cC(); C() = leftF.cC();
T::ImportData(leftF); T::ImportData(leftF);
} }
@ -641,24 +616,21 @@ public:
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {}; template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
///*-------------------------- MARK ----------------------------------*/ ///*-------------------------- MARK ----------------------------------*/
template <class T> class MarkOcf: public T { template <class T> class MarkOcf: public T {
public: public:
inline int & IMark() { inline int &IMark() {
assert((*this).Base().MarkEnabled); assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()]; return (*this).Base().MV[(*this).Index()];
} }
inline int cIMark() const {
inline int IMark() const {
assert((*this).Base().MarkEnabled); assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()]; return (*this).Base().MV[(*this).Index()];
} ; } ;
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)// WRONG I do not know anything about leftV! if((*this).Base().MarkEnabled && LeftF::HasFaceMark())
if((*this).Base().MarkEnabled) IMark() = leftF.cIMark();
IMark() = leftF.IMark();
T::ImportData(leftF); T::ImportData(leftF);
} }
static bool HasFaceMark() { return true; } static bool HasFaceMark() { return true; }
@ -667,17 +639,16 @@ public:
}; };
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/ ///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
template <class A, class TT> class WedgeTexCoordOcf: public TT { template <class A, class TT> class WedgeTexCoordOcf: public TT {
public: public:
WedgeTexCoordOcf(){ } WedgeTexCoordOcf(){ }
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV! //if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeTexEnabled) if(this->Base().WedgeTexEnabled && LeftF::HasWedgeTexCoord())
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); } { WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
TT::ImportData(leftF); TT::ImportData(leftF);
} }
@ -688,7 +659,6 @@ public:
template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {}; template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
///*-------------------------- WEDGE COLOR ----------------------------------*/ ///*-------------------------- WEDGE COLOR ----------------------------------*/
template <class A, class TT> class WedgeColorOcf: public TT { template <class A, class TT> class WedgeColorOcf: public TT {
public: public:
WedgeColorOcf(){ } WedgeColorOcf(){ }
@ -697,8 +667,7 @@ public:
const ColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } const ColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV! if(this->Base().WedgeColorEnabled && LeftF::HasWedgeColor())
if(this->Base().WedgeColorEnabled)
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); } { WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
TT::ImportData(leftF); TT::ImportData(leftF);
} }
@ -709,7 +678,6 @@ public:
template <class T> class WedgeColor4bOcf: public WedgeColorOcf<vcg::Color4b, T> {}; template <class T> class WedgeColor4bOcf: public WedgeColorOcf<vcg::Color4b, T> {};
///*-------------------------- WEDGE NORMAL ----------------------------------*/ ///*-------------------------- WEDGE NORMAL ----------------------------------*/
template <class A, class TT> class WedgeNormalOcf: public TT { template <class A, class TT> class WedgeNormalOcf: public TT {
public: public:
WedgeNormalOcf(){ } WedgeNormalOcf(){ }
@ -718,8 +686,7 @@ public:
NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
template <class LeftF> template <class LeftF>
void ImportData(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeNormalEnabled && leftF.Base().WedgeNormalEnabled) // WRONG I do not know anything about leftV! if(this->Base().WedgeNormalEnabled && LeftF::HasWedgeNormal())
if(this->Base().WedgeNormalEnabled)
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); } { WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
TT::ImportData(leftF); TT::ImportData(leftF);
} }
@ -732,7 +699,6 @@ template <class T> class WedgeNormal3fOcf: public WedgeNormalOcf<vcg::Point3f, T
template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T> {}; template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T> {};
///*-------------------------- InfoOpt ----------------------------------*/ ///*-------------------------- InfoOpt ----------------------------------*/
template < class T> class InfoOcf: public T { template < class T> class InfoOcf: public T {
public: public:
// You should never ever try to copy a vertex that has OCF stuff. // You should never ever try to copy a vertex that has OCF stuff.
@ -748,13 +714,15 @@ public:
void ImportData(const LeftF & leftF){T::ImportData(leftF);} void ImportData(const LeftF & leftF){T::ImportData(leftF);}
static bool HasFaceColorOcf() { return false; } static bool HasFaceColorOcf() { return false; }
static bool HasFaceQualityOcf() { return false; }
static bool HasFaceNormalOcf() { return false; } static bool HasFaceNormalOcf() { return false; }
static bool HasFaceCurvatureDirOcf() { return false; } static bool HasFaceCurvatureDirOcf() { return false; }
static bool HasFaceMarkOcf() { return false; } static bool HasFaceMarkOcf() { return false; }
static bool HasWedgeTexCoordOcf() { return false; } static bool HasWedgeTexCoordOcf() { return false; }
static bool HasWedgeColorOcf() { return false; }
static bool HasWedgeNormalOcf() { return false; }
static bool HasFFAdjacencyOcf() { return false; } static bool HasFFAdjacencyOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; }
//static bool HasFaceQualityOcf() { return false; }
inline int Index() const { inline int Index() const {
typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this); typename T::FaceType const *tp=static_cast<typename T::FaceType const *>(this);

View File

@ -46,56 +46,46 @@ namespace vertex {
template <class TT> class EmptyCore: public TT { template <class TT> class EmptyCore: public TT {
public: public:
typedef int FlagType; typedef int FlagType;
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { assert(0); static int dummyflags(0); return dummyflags; }
int cFlags() const { assert(0); return 0; } int cFlags() const { assert(0); return 0; }
static bool HasFlags() { return false; } static bool HasFlags() { return false; }
typedef vcg::Point3f CoordType; typedef vcg::Point3f CoordType;
typedef CoordType::ScalarType ScalarType; typedef CoordType::ScalarType ScalarType;
CoordType &P() { static CoordType coord(0, 0, 0); return coord; } CoordType &P() { assert(0); static CoordType coord(0, 0, 0); return coord; }
CoordType cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; } CoordType cP() const { assert(0); static CoordType coord(0, 0, 0); assert(0); return coord; }
static bool HasCoord() { return false; } static bool HasCoord() { return false; }
typedef vcg::Point3s NormalType; typedef vcg::Point3s NormalType;
NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType &N() { assert(0); static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
NormalType cN() const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType cN() const { assert(0); static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
static bool HasNormal() { return false; } static bool HasNormal() { return false; }
static bool HasNormalOcf() { return false; }
typedef float QualityType; typedef float QualityType;
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType &Q() { assert(0); static QualityType dummyQuality(0); return dummyQuality; }
const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType cQ() const { assert(0); static QualityType dummyQuality(0); return dummyQuality; }
static bool HasQuality() { return false; } static bool HasQuality() { return false; }
static bool HasQualityOcf() { return false; }
static bool IsQualityEnabled(const typename TT::VertexType *) { return false; }
typedef vcg::Color4b ColorType; typedef vcg::Color4b ColorType;
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
static bool HasColor() { return false; } static bool HasColor() { return false; }
static bool HasColorOcf() { return false; }
static bool IsColorEnabled(const typename TT::VertexType *) { return false; }
typedef int MarkType; typedef int MarkType;
inline void InitIMark() { } void InitIMark() { }
inline int cIMark() const { assert(0); static int tmp=-1; return tmp;} int cIMark() const { assert(0); static int tmp=-1; return tmp;}
inline int &IMark() { assert(0); static int tmp=-1; return tmp;} int &IMark() { assert(0); static int tmp=-1; return tmp;}
static bool HasMark() { return false; } static bool HasMark() { return false; }
static bool HasMarkOcf() { return false; }
static bool IsMarkEnabled(const typename TT::VertexType *) { return false; }
typedef ScalarType RadiusType; typedef ScalarType RadiusType;
RadiusType &R() { static ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; } RadiusType &R() { static ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
RadiusType cR() const { static const ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; } RadiusType cR() const { static const ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
static bool HasRadius() { return false; } static bool HasRadius() { return false; }
static bool HasRadiusOcf() { return false; }
static bool IsRadiusEnabled(const typename TT::VertexType *) { return false; }
typedef vcg::TexCoord2<float,1> TexCoordType; typedef vcg::TexCoord2<float,1> TexCoordType;
TexCoordType &T() { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; } TexCoordType &T() { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; }
const TexCoordType &cT() const { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; } TexCoordType cT() const { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; }
static bool HasTexCoord() { return false; } static bool HasTexCoord() { return false; }
static bool IsTexCoordEnabled(const typename TT::VertexType *) { return false; }
typename TT::TetraPointer &VTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; } typename TT::TetraPointer &VTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
typename TT::TetraPointer cVTp() const { static typename TT::TetraPointer tp = 0; assert(0); return tp; } typename TT::TetraPointer cVTp() const { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
@ -103,51 +93,47 @@ public:
static bool HasVTAdjacency() { return false; } static bool HasVTAdjacency() { return false; }
typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; } typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; }
const typename TT::FacePointer cVFp() const { 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 &VFi() { static int z=0; assert(0); return z;}
int cVFi() const {static int z=0; assert(0); return z;} int cVFi() const { static int z=0; assert(0); return z;}
static bool HasVFAdjacency() { return false; } static bool HasVFAdjacency() { return false; }
typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; } typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; }
const typename TT::EdgePointer cVEp() const { 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; }
int &VEi(){static int z=0; return z;} int &VEi() { static int z=0; return z;}
int cVEi() const { static int z=0; return z;}
static bool HasVEAdjacency() { return false; } static bool HasVEAdjacency() { return false; }
typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; } typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
const typename TT::HEdgePointer cVHp() const { static typename TT::HEdgePointer ep=0; assert(0); return ep; } typename TT::HEdgePointer cVHp() const { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
int &VHi(){static int z=0; return z;} int &VHi() { static int z=0; return z;}
int cVHi() const { static int z=0; return z;}
static bool HasVHAdjacency() { return false; } static bool HasVHAdjacency() { return false; }
typedef Point3f VecType; typedef Point3f VecType;
typedef Point2f CurvatureType; typedef Point2f CurvatureType;
float &Kh() { static float dummy = 0.f; assert(0);return dummy;} float &Kh() { static float dummy = 0.f; assert(0);return dummy;}
float &Kg() { static float dummy = 0.f; assert(0);return dummy;} float &Kg() { static float dummy = 0.f; assert(0);return dummy;}
const float &cKh() const { static float dummy = 0.f; assert(0); return dummy;} float cKh() const { static float dummy = 0.f; assert(0); return dummy;}
const float &cKg() const { static float dummy = 0.f; assert(0); return dummy;} float cKg() const { static float dummy = 0.f; assert(0); return dummy;}
typedef CurvatureDirBaseType<float> CurvatureDirType; typedef CurvatureDirBaseType<float> CurvatureDirType;
VecType &PD1(){static VecType v(0,0,0); assert(0);return v;} VecType &PD1() {static VecType v(0,0,0); assert(0);return v;}
VecType &PD2(){static VecType v(0,0,0); assert(0);return v;} VecType &PD2() {static VecType v(0,0,0); assert(0);return v;}
const VecType &cPD1() const {static VecType v(0,0,0); assert(0);return v;} VecType cPD1() const {static VecType v(0,0,0); assert(0);return v;}
const VecType &cPD2() const {static VecType v(0,0,0); assert(0);return v;} VecType cPD2() const {static VecType v(0,0,0); assert(0);return v;}
ScalarType &K1(){ static ScalarType v = 0.0;assert(0);return v;} ScalarType &K1() { static ScalarType v = 0.0;assert(0);return v;}
ScalarType &K2(){ static ScalarType v = 0.0;assert(0);return v;} ScalarType &K2() { static ScalarType v = 0.0;assert(0);return v;}
const ScalarType &cK1() const {static ScalarType v = 0.0;assert(0);return v;} ScalarType cK1() const {static ScalarType v = 0.0;assert(0);return v;}
const ScalarType &cK2()const {static ScalarType v = 0.0;assert(0);return v;} ScalarType cK2() const {static ScalarType v = 0.0;assert(0);return v;}
static bool HasCurvature() { return false; } static bool HasCurvature() { return false; }
static bool HasCurvatureDir() { return false; } static bool HasCurvatureDir() { return false; }
static bool HasCurvatureOcf() { return false; }
static bool HasCurvatureDirOcf() { return false; }
static bool IsCurvatureDirEnabled(const typename TT::VertexType *) { return false; } template < class RightValueType>
static bool IsCurvatureEnabled(const typename TT::VertexType *) { return false; } void ImportData(const RightValueType & /*rVert*/ ) {
// TT::ImportData( rVert);
template < class LeftV>
void ImportData(const LeftV & /*left*/ ) {
// TT::ImportData( left);
} }
static void Name(std::vector<std::string> & name){TT::Name(name);} static void Name(std::vector<std::string> & name){TT::Name(name);}
}; };
@ -161,12 +147,11 @@ template <class A, class T> class Coord: public T {
public: public:
typedef A CoordType; typedef A CoordType;
typedef typename A::ScalarType ScalarType; typedef typename A::ScalarType ScalarType;
CoordType &P() { return _coord; } inline CoordType &P() { return _coord; }
const CoordType &P() const { return _coord; } inline CoordType cP() const { return _coord; }
const CoordType &cP() const { return _coord; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportData( left); } void ImportData(const RightValueType & rVert ) { if(RightValueType::HasCoord()) P().Import(rVert.cP()); T::ImportData( rVert); }
static bool HasCoord() { return true; } static bool HasCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
@ -189,16 +174,14 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class Normal: public T { template <class A, class T> class Normal: public T {
public: public:
typedef A NormalType; typedef A NormalType;
NormalType &N() { return _norm; } inline NormalType &N() { return _norm; }
const NormalType &cN() const { return _norm; } inline NormalType cN() const { return _norm; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ){ void ImportData(const RightValueType & rVert ){
if(LeftV::HasNormal()) if(RightValueType::HasNormal()) N().Import(rVert.cN());
N().Import(left.cN()); T::ImportData( rVert);
T::ImportData( left);
} }
static bool HasNormal() { return true; } static bool HasNormal() { return true; }
// static bool HasNormalOcf() { return false; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
private: private:
@ -224,14 +207,12 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class Mark: public T { template <class T> class Mark: public T {
public: public:
inline int cIMark() const { return _imark;}
inline int &IMark() { return _imark;}
static bool HasMark() { return true; } static bool HasMark() { return true; }
static bool HasMarkOcc() { return true; }
inline void InitIMark() { _imark = 0; } inline void InitIMark() { _imark = 0; }
inline const int & cIMark() const { return _imark;} template < class RightValueType>
inline int & IMark() { return _imark;} void ImportData(const RightValueType & rVert ) { if(RightValueType::HasMark()) IMark() = rVert.cIMark(); T::ImportData( rVert); }
inline const int & IMark() const {return _imark;}
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasMark()) IMark() = left.cIMark(); T::ImportData( left); }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
@ -250,9 +231,9 @@ template <class A, class TT> class TexCoord: public TT {
public: public:
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &T() { return _t; } TexCoordType &T() { return _t; }
const TexCoordType &cT() const { return _t; } TexCoordType cT() const { return _t; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportData( left); } void ImportData(const RightValueType & rVert ) { if(RightValueType::HasTexCoord()) T() = rVert.cT(); TT::ImportData( rVert); }
static bool HasTexCoord() { return true; } 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);}
@ -280,10 +261,10 @@ template <class T> class BitFlags: public T {
public: public:
BitFlags(){_flags=0;} BitFlags(){_flags=0;}
typedef int FlagType; typedef int FlagType;
int &Flags() {return _flags; } inline int &Flags() {return _flags; }
int cFlags() const {return _flags; } inline int cFlags() const {return _flags; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.cFlags(); T::ImportData( left); } void ImportData(const RightValueType & rVert ) { if(RightValueType::HasFlags()) Flags() = rVert.cFlags(); T::ImportData( rVert); }
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
@ -302,11 +283,10 @@ template <class A, class T> class Color: public T {
public: public:
Color():_color(vcg::Color4b::White) {} Color():_color(vcg::Color4b::White) {}
typedef A ColorType; typedef A ColorType;
ColorType &C() { return _color; } inline ColorType &C() { return _color; }
const ColorType &C() const { return _color; } inline ColorType cC() const { return _color; }
const ColorType &cC() const { return _color; } template < class RightValueType>
template < class LeftV> void ImportData(const RightValueType & rVert ) { if(RightValueType::HasColor()) C() = rVert.cC(); T::ImportData( rVert); }
void ImportData(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportData( left); }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static bool IsColorEnabled(typename T::VertexType *) { return true; } static bool IsColorEnabled(typename T::VertexType *) { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
@ -330,10 +310,10 @@ The Quality Component is a generic place for storing a float. The term 'quality'
template <class A, class TT> class Quality: public TT { template <class A, class TT> class Quality: public TT {
public: public:
typedef A QualityType; typedef A QualityType;
QualityType &Q() { return _quality; } inline QualityType &Q() { return _quality; }
const QualityType & cQ() const {return _quality; } inline QualityType cQ() const {return _quality; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportData( left); } void ImportData(const RightValueType & rVert ) { if(RightValueType::HasQuality()) Q() = rVert.cQ(); TT::ImportData( rVert); }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
@ -360,10 +340,10 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
public: public:
typedef Point2<A> CurvatureType; typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType; typedef typename CurvatureType::ScalarType ScalarType;
ScalarType &Kh(){ return _hk[0];} ScalarType &Kh() { return _hk[0];}
ScalarType &Kg(){ return _hk[1];} ScalarType &Kg() { return _hk[1];}
const ScalarType &cKh() const { return _hk[0];} ScalarType cKh() const { return _hk[0];}
const ScalarType &cKg() const { return _hk[1];} ScalarType cKg() const { return _hk[1];}
static bool HasCurvature() { return true; } static bool HasCurvature() { return true; }
static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; } static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; }
@ -384,25 +364,25 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
/*-------------------------- Curvature Direction ----------------------------------*/ /*-------------------------- Curvature Direction ----------------------------------*/
template <class TT> class EmptyCurvatureDir: public TT { template <class TT> class EmptyCurvatureDir: public TT {
public: public:
typedef CurvatureDirBaseType<float> CurvatureDirType; typedef CurvatureDirBaseType<float> CurvatureDirType;
Point3f &PD1(){static Point3f dummy(0,0,0); return dummy;} Point3f &PD1() { static Point3f dummy(0,0,0); return dummy;}
Point3f &PD2(){static Point3f dummy(0,0,0); return dummy;} Point3f &PD2() { static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD1() const {static Point3f dummy(0,0,0); return dummy;} Point3f cPD1() const { static Point3f dummy(0,0,0); return dummy;}
const Point3f &cPD2()const {static Point3f dummy(0,0,0); return dummy;} Point3f cPD2() const { static Point3f dummy(0,0,0); return dummy;}
float &K1(){ static float dummy(0);assert(0);return dummy;} float &K1() { static float dummy(0);assert(0);return dummy;}
float &K2(){ static float dummy(0);assert(0);return dummy;} float &K2() { static float dummy(0);assert(0);return dummy;}
const float &cK1()const { static float dummy(0);assert(0);return dummy;} float cK1() const { static float dummy(0);assert(0);return dummy;}
const float &cK2()const { static float dummy(0);assert(0);return dummy;} float cK2() const { static float dummy(0);assert(0);return dummy;}
static bool HasCurvatureDir() { return false; } static bool HasCurvatureDir() { return false; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { TT::ImportData( left); } void ImportData(const RightValueType & rVert ) { TT::ImportData( rVert); }
static void Name(std::vector<std::string> & name){TT::Name(name);} static void Name(std::vector<std::string> & name){TT::Name(name);}
}; };
/*! \brief \em Component: Per vertex \b curvature \b directions /*! \brief \em Component: Per vertex \b curvature \b directions
This component keep the principal curvature directions. Used by some of the algorithms of vcg::tri::UpdateCurvature to store the computed curvatures. This component keep the principal curvature directions. Used by some of the algorithms of vcg::tri::UpdateCurvature to store the computed curvatures.
@ -423,13 +403,13 @@ public:
ScalarType &K2(){ return _curv.k2;} ScalarType &K2(){ return _curv.k2;}
const ScalarType &cK1() const {return _curv.k1;} const ScalarType &cK1() const {return _curv.k1;}
const ScalarType &cK2()const {return _curv.k2;} const ScalarType &cK2()const {return _curv.k2;}
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { void ImportData(const RightValueType & rVert ) {
if(LeftV::HasCurvatureDir()) { if(RightValueType::HasCurvatureDir()) {
PD1() = left.cPD1(); PD2() = left.cPD2(); PD1() = rVert.cPD1(); PD2() = rVert.cPD2();
K1() = left.cK1(); K2() = left.cK2(); K1() = rVert.cK1(); K2() = rVert.cK2();
} }
TT::ImportData( left); TT::ImportData( rVert);
} }
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }
@ -452,19 +432,19 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
This component keep a floating point value meant to be the average distance from the surrounding vertices. Used in point clouds by some of the point splatting and MLS surface algorithms. This component keep a floating point value meant to be the average distance from the surrounding vertices. Used in point clouds by some of the point splatting and MLS surface algorithms.
*/ */
template <class A, class TT> class Radius: public TT { template <class A, class TT> class Radius: public TT {
public: public:
typedef A RadiusType; typedef A RadiusType;
RadiusType &R() { return _radius; } RadiusType &R() { return _radius; }
const RadiusType & cR() const {return _radius; } RadiusType cR() const {return _radius; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportData( left); } void ImportData(const RightValueType & rVert ) { if(RightValueType::HasRadius()) R() = rVert.cR(); TT::ImportData( rVert); }
static bool HasRadius() { return true; } static bool HasRadius() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
private: private:
RadiusType _radius; RadiusType _radius;
}; };
template <class TT> class Radiusf: public Radius<float, TT> { template <class TT> class Radiusf: public Radius<float, TT> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Radiusf"));TT::Name(name);} public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Radiusf"));TT::Name(name);}
@ -483,12 +463,12 @@ template <class T> class VEAdj: public T {
public: public:
VEAdj(){_ep=0;_zp=-1;} VEAdj(){_ep=0;_zp=-1;}
typename T::EdgePointer &VEp() {return _ep; } typename T::EdgePointer &VEp() {return _ep; }
typename T::EdgePointer const cVEp() const {return _ep; } typename T::EdgePointer cVEp() const {return _ep; }
int &VEi() {return _zp; } int &VEi() {return _zp; }
template < class LeftV> int cVEi() const {return _zp; }
void ImportData(const LeftV & left ) { T::ImportData( left); } template < class RightValueType>
void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
static bool HasVEAdjacency() { return true; } static bool HasVEAdjacency() { return true; }
static bool HasVEAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
private: private:
@ -506,23 +486,22 @@ Note that if you use this component it is expected that on the Face you use also
\sa iterators \sa iterators
*/ */
template <class T> class VFAdj: public T { template <class T> class VFAdj: public T {
public: public:
VFAdj(){_fp=0;_zp=-1;} VFAdj(){_fp=0;_zp=-1;}
typename T::FacePointer &VFp() {return _fp; } typename T::FacePointer &VFp() { return _fp; }
typename T::FacePointer const cVFp() const {return _fp; } typename T::FacePointer cVFp() const { return _fp; }
int &VFi() {return _zp; } int &VFi() { return _zp; }
int const &cVFi() const {return _zp; } int cVFi() const { return _zp; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { T::ImportData( left); } void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
private: private:
typename T::FacePointer _fp ; typename T::FacePointer _fp ;
int _zp ; int _zp ;
}; };
/*----------------------------- VHADJ ------------------------------*/ /*----------------------------- VHADJ ------------------------------*/
@ -530,12 +509,11 @@ template <class T> class VHAdj: public T {
public: public:
VHAdj(){_hp=0;_zp=-1;} VHAdj(){_hp=0;_zp=-1;}
typename T::HEdgePointer &VHp() {return _hp; } typename T::HEdgePointer &VHp() {return _hp; }
typename T::HEdgePointer cVHp() {return _hp; } typename T::HEdgePointer cVHp() const {return _hp; }
int &VHi() {return _zp; } int &VHi() {return _zp; }
template < class LeftV> template < class RightValueType>
void ImportData(const LeftV & left ) { T::ImportData( left); } void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
static bool HasVHAdjacency() { return true; } 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);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);}
private: private:
@ -549,10 +527,9 @@ template <class T> class VTAdj: public T {
public: public:
VTAdj() { _tp = 0; _zp=-1;} VTAdj() { _tp = 0; _zp=-1;}
typename T::TetraPointer &VTp() { return _tp; } typename T::TetraPointer &VTp() { return _tp; }
typename T::TetraPointer cVTp() { return _tp; } typename T::TetraPointer cVTp() const { return _tp; }
int &VTi() {return _zp; } int &VTi() {return _zp; }
static bool HasVTAdjacency() { return true; } static bool HasVTAdjacency() { return true; }
static bool HasVTAdjacencyOcc() { return true; }
static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); } static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
private: private:

View File

@ -126,7 +126,6 @@ void EnableQuality() {
QualityEnabled=true; QualityEnabled=true;
QV.resize((*this).size()); QV.resize((*this).size());
} }
void DisableQuality() { void DisableQuality() {
assert(VALUE_TYPE::HasQualityOcf()); assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=false; QualityEnabled=false;
@ -139,7 +138,6 @@ void EnableColor() {
ColorEnabled=true; ColorEnabled=true;
CV.resize((*this).size()); CV.resize((*this).size());
} }
void DisableColor() { void DisableColor() {
assert(VALUE_TYPE::HasColorOcf()); assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=false; ColorEnabled=false;
@ -152,7 +150,6 @@ void EnableMark() {
MarkEnabled=true; MarkEnabled=true;
MV.resize((*this).size()); MV.resize((*this).size());
} }
void DisableMark() { void DisableMark() {
assert(VALUE_TYPE::HasMarkOcf()); assert(VALUE_TYPE::HasMarkOcf());
MarkEnabled=false; MarkEnabled=false;
@ -165,7 +162,6 @@ void EnableNormal() {
NormalEnabled=true; NormalEnabled=true;
NV.resize((*this).size()); NV.resize((*this).size());
} }
void DisableNormal() { void DisableNormal() {
assert(VALUE_TYPE::HasNormalOcf()); assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=false; NormalEnabled=false;
@ -179,7 +175,6 @@ void EnableVFAdjacency() {
VFAdjType zero; zero._fp=0; zero._zp=-1; VFAdjType zero; zero._fp=0; zero._zp=-1;
AV.resize((*this).size(),zero); AV.resize((*this).size(),zero);
} }
void DisableVFAdjacency() { void DisableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf()); assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=false; VFAdjacencyEnabled=false;
@ -192,7 +187,6 @@ void EnableCurvature() {
CurvatureEnabled=true; CurvatureEnabled=true;
CuV.resize((*this).size()); CuV.resize((*this).size());
} }
void DisableCurvature() { void DisableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf()); assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=false; CurvatureEnabled=false;
@ -205,7 +199,6 @@ void EnableCurvatureDir() {
CurvatureDirEnabled=true; CurvatureDirEnabled=true;
CuDV.resize((*this).size()); CuDV.resize((*this).size());
} }
void DisableCurvatureDir() { void DisableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf()); assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=false; CurvatureDirEnabled=false;
@ -218,7 +211,6 @@ void EnableRadius() {
RadiusEnabled=true; RadiusEnabled=true;
RadiusV.resize((*this).size()); RadiusV.resize((*this).size());
} }
void DisableRadius() { void DisableRadius() {
assert(VALUE_TYPE::HasRadiusOcf()); assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=false; RadiusEnabled=false;
@ -232,12 +224,12 @@ void EnableTexCoord() {
TexCoordEnabled=true; TexCoordEnabled=true;
TV.resize((*this).size()); TV.resize((*this).size());
} }
void DisableTexCoord() { void DisableTexCoord() {
assert(VALUE_TYPE::HasTexCoordOcf()); assert(VALUE_TYPE::HasTexCoordOcf());
TexCoordEnabled=false; TexCoordEnabled=false;
TV.clear(); TV.clear();
} }
struct VFAdjType { struct VFAdjType {
typename VALUE_TYPE::FacePointer _fp ; typename VALUE_TYPE::FacePointer _fp ;
int _zp ; int _zp ;
@ -278,7 +270,6 @@ public:
assert((*this).Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._fp; return (*this).Base().AV[(*this).Index()]._fp;
} }
typename T::FacePointer cVFp() const { typename T::FacePointer cVFp() const {
if(! (*this).Base().VFAdjacencyEnabled ) return 0; if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return (*this).Base().AV[(*this).Index()]._fp; else return (*this).Base().AV[(*this).Index()]._fp;
@ -314,23 +305,12 @@ public:
static bool HasNormal() { return true; } static bool HasNormal() { return true; }
static bool HasNormalOcf() { return true; } static bool HasNormalOcf() { return true; }
NormalType &N() { NormalType &N() { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal() NormalType cN() const { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; }
const NormalType &N() const {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; }
const NormalType &cN() const {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().NV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV){ void ImportData(const LeftV & leftV){
if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled ) // copy the data only if they are enabled in both vertices if((*this).Base().NormalEnabled && LeftV::HasNormal() )
N().Import(leftV.cN()); N().Import(leftV.cN());
T::ImportData(leftV);} T::ImportData(leftV);}
}; };
@ -345,12 +325,11 @@ template <class A, class T> class ColorOcf: public T {
public: public:
typedef A ColorType; typedef A ColorType;
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; } ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
const ColorType &C() const { return this->cC(); } ColorType cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled ) // copy the data only if they are enabled in both vertices if((*this).Base().ColorEnabled && LeftV::HasColor() )
C() = leftV.cC(); C() = leftV.cC();
T::ImportData(leftV); T::ImportData(leftV);
} }
@ -369,12 +348,11 @@ template <class A, class T> class QualityOcf: public T {
public: public:
typedef A QualityType; typedef A QualityType;
QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; } QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
const QualityType &cQ() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; } QualityType cQ() const { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
// if((*this).Base().QualityEnabled && leftV.Base().QualityEnabled ) // copy the data only if they are enabled in both vertices if((*this).Base().QualityEnabled && LeftV::HasQuality() ) // copy the data only if they are enabled in both vertices
if((*this).Base().QualityEnabled && leftV.HasQuality() ) // copy the data only if they are enabled in both vertices
Q() = leftV.cQ(); Q() = leftV.cQ();
T::ImportData(leftV); T::ImportData(leftV);
} }
@ -393,13 +371,11 @@ template <class A, class TT> class TexCoordOcf: public TT {
public: public:
typedef A TexCoordType; typedef A TexCoordType;
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; } TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
const TexCoordType &T() const { return this->cT(); } TexCoordType cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
const TexCoordType &cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
template < class LeftV> template < class LeftV>
void ImportData(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if((*this).Base().TexCoordEnabled && leftV.Base().TexCoordEnabled ) // WRONG I do not know anything about leftV! if((*this).Base().TexCoordEnabled && LeftV::HasTexCoord()) // copy the data only if they are enabled in both vertices
if((*this).Base().TexCoordEnabled) // copy the data only if they are enabled in both vertices
T() = leftV.cT(); T() = leftV.cT();
TT::ImportData(leftV); TT::ImportData(leftV);
} }
@ -416,21 +392,13 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class MarkOcf: public T { template <class T> class MarkOcf: public T {
public: public:
typedef int MarkType; typedef int MarkType;
inline int & IMark() { inline int &IMark() { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
assert((*this).Base().MarkEnabled); inline int cIMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
return (*this).Base().MV[(*this).Index()];
}
inline int IMark() const {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // WRONG I do not know anything about leftV! if((*this).Base().MarkEnabled && LeftV::HasMark()) // copy the data only if they are enabled in both vertices
if((*this).Base().MarkEnabled) // copy the data only if they are enabled in both vertices
IMark() = leftV.cIMark(); IMark() = leftV.cIMark();
T::ImportData(leftV); T::ImportData(leftV);
} }
@ -451,13 +419,12 @@ public:
ScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} ScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
ScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} ScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
const ScalarType &cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} ScalarType cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
const ScalarType &cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} ScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV){ void ImportData(const LeftV & leftV){
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV! if((*this).Base().CurvatureEnabled && LeftV::HasCurvature())
if((*this).Base().CurvatureEnabled && LeftV::IsCurvatureEnabled(&leftV))
{ {
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh(); (*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg(); (*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
@ -466,12 +433,7 @@ public:
} }
static bool HasCurvature() { return true; } static bool HasCurvature() { return true; }
static bool IsCurvatureEnabled(const typename TT::VertexType *v) { return v->Base().CurvatureEnabled; }
static bool HasCurvatureOcf() { return true; } static bool HasCurvatureOcf() { return true; }
private:
}; };
template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcf"));T::Name(name);} }; template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcf"));T::Name(name);} };
@ -496,20 +458,19 @@ public:
typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;} VecType &PD1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
VecType &PD2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;} VecType &PD2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
const VecType &cPD1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;} VecType cPD1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
const VecType &cPD2() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;} VecType cPD2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
ScalarType &K1(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;} ScalarType &K1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
ScalarType &K2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;} ScalarType &K2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
const ScalarType &cK1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;} ScalarType cK1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;} ScalarType cK2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV){ void ImportData(const LeftV & leftV){
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV! if((*this).Base().IsCurvatureDirEnabled() && LeftV::HasCurvatureDir())
if((*this).Base().CurvatureDirEnabled && LeftV::IsCurvatureDirEnabled(&leftV))
{ {
(*this).PD1() = leftV.cPD1(); (*this).PD1() = leftV.cPD1();
(*this).PD2() = leftV.cPD2(); (*this).PD2() = leftV.cPD2();
@ -521,10 +482,7 @@ public:
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }
static bool HasCurvatureDirOcf() { return true; } static bool HasCurvatureDirOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
};
private:
};
template <class T> class CurvatureDirfOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<float>, T> { template <class T> class CurvatureDirfOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<float>, T> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);} public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);}
@ -541,14 +499,13 @@ public:
typedef A RadiusType; typedef A RadiusType;
typedef RadiusType ScalarType; typedef RadiusType ScalarType;
RadiusType &R(){ assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];} RadiusType &R() { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];} RadiusType cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
template <class LeftV> template <class LeftV>
void ImportData(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled ) // WRONG I do not know anything about leftV! if ((*this).Base().RadiusEnabled && LeftV::HasRadius())
if ((*this).Base().RadiusEnabled)
(*this).Base().RadiusV[(*this).Index()] = leftV.cR(); (*this).Base().RadiusV[(*this).Index()] = leftV.cR();
TT::ImportData(leftV); TT::ImportData(leftV);
} }
@ -556,8 +513,6 @@ public:
static bool HasRadius() { return true; } static bool HasRadius() { return true; }
static bool HasRadiusOcf() { return true; } static bool HasRadiusOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
private:
}; };
template <class T> class RadiusfOcf: public RadiusOcf<float, T> {}; template <class T> class RadiusfOcf: public RadiusOcf<float, T> {};
@ -585,6 +540,11 @@ public:
vector_ocf<typename T::VertexType> *_ovp; vector_ocf<typename T::VertexType> *_ovp;
static bool HasQualityOcf() { return false; } static bool HasQualityOcf() { return false; }
static bool HasRadiusOcf() { return false; }
static bool HasColorOcf() { return false; }
static bool HasNormalOcf() { return false; }
static bool HasCurvatureOcf() { return false; }
static bool HasCurvatureDirOcf() { return false; }
static bool HasTexCoordOcf() { return false; } static bool HasTexCoordOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; }
}; };