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 {
public:
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 * & FVp( const int i ) { return this->V(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 const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
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 * &FVp( const int i ) { return this->V(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 cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
static bool HasVertexRef() { return false; }
static bool HasFVAdjacency() { return false; }
typedef typename T::VertexType::NormalType NormalType;
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; }
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 HasFaceNormal() { return false; }
static bool HasWedgeNormalOcf() { return false; }
static bool HasFaceNormalOcf() { return false; }
typedef int WedgeTexCoordType;
typedef vcg::TexCoord2<float,1> TexCoordType;
@ -64,92 +61,75 @@ public:
TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;}
static bool HasWedgeTexCoord() { return false; }
static bool HasWedgeTexCoordOcf() { return false; }
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int cFlags() const { return 0; }
static bool HasFlags() { return false; }
static bool HasFlagsOcf() { return false; }
inline void InitIMark() { }
inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
inline int IMark() const {return 0;}
inline int &IMark() { assert(0); static int tmp=-1; return tmp;}
inline int cIMark() const {return 0;}
typedef int MarkType;
typedef float QualityType;
typedef Point3f Quality3Type;
typedef vcg::Color4b ColorType;
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 &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; }
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
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; }
ColorType &C() { 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 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 cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
Quality3Type &Q3() { 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 HasFaceColorOcf() { return false;}
static bool HasWedgeColor() { return false; }
static bool HasWedgeColorOcf() { return false; }
static bool HasFaceQuality() { return false; }
static bool HasFaceQualityOcf() { return false;}
static bool HasFaceQuality3() { return false; }
static bool HasFaceQuality3Ocf() { return false;}
static bool HasMark() { return false; }
static bool HasMarkOcf() { return false; }
static bool HasFaceMark() { return false; }
typedef int VFAdjType;
typename T::FacePointer &VFp(const 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 &FFp(const 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::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; }
typename T::EdgePointer const cFEp(const int) const { static typename T::EdgePointer const fp=0; return fp; }
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; }
char &VFi(const int j){(void)j; static char z=0; assert(0); return z;}
char &FFi(const int j){(void)j; static char z=0; assert(0); return z;}
const char &cVFi(const int j){(void)j; static char z=0; return z;}
const char &cFFi(const int j) const {(void)j; static char z=0; return z;}
typename T::FacePointer &VFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer cVFp(int) const { static typename T::FacePointer fp=0; return fp; }
typename T::FacePointer &FFp(int) { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer cFFp(int) const { static typename T::FacePointer fp=0; return fp; }
typename T::EdgePointer &FEp(int) { static typename T::EdgePointer fp=0; assert(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 cFHp() const { static typename T::HEdgePointer fp=0; assert(0);return fp; }
char &VFi(int) { static char z=0; assert(0); return z;}
char &FFi(int) { static char z=0; assert(0); return z;}
char cVFi(int) const { static char z=0; return z;}
char cFFi(int) const { static char z=0; return z;}
static bool HasVFAdjacency() { return false; }
static bool HasFFAdjacency() { return false; }
static bool HasFEAdjacency() { 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;
Point3f &PD1(){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;}
const Point3f &cPD2()const {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 cPD1() 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 &K2(){ static float dummy(0);assert(0);return dummy;}
const float &cK1()const { static float dummy(0);assert(0);return dummy;}
const float &cK2()const { 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 cK1() 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 HasCurvatureDirOcf() { return false; }
inline void SetVN(const int & /*n*/) {assert(0);}
static bool HasPolyInfo() { return false; }
template <class RightF>
void ImportData(const RightF & rightF) {T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
template <class RightValueType>
void ImportData(const RightValueType & rightF) {T::ImportData(rightF);}
inline void Alloc(const int & ns) {T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
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::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 * 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 * &V( const int j ) { assert(j>=0 && j<3); return v[j]; } /// \brief The pointer to the i-th vertex
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 const CoordType & P( 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 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 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 * & 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 * 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 * cV1( const int j ) const { return cV((j+1)%3);}
inline typename T::VertexType * cV2( const int j ) const { return cV((j+2)%3);}
@ -193,28 +168,24 @@ public:
inline CoordType & P0( const int j ) { return V(j)->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 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 & 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();}
// 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.
// if you are using ImportData for copying internally simplex you have to set up all the pointers by hand.
template <class RightF>
void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
// 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.
// if you are using ImportData for copying internally simplex you have to set up all the pointers by hand.
template <class RightValueType>
void ImportData(const RightValueType & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasVertexRef() { return true; }
static bool HasFVAdjacency() { return true; }
static bool HasFVAdjacency() { return true; }
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];
};
@ -227,49 +198,49 @@ void ComputeNormalizedNormal(T &f) { f.N().Import(vcg::NormalizedNormal<T>(f));
template <class A, class T> class NormalAbs: public T {
public:
typedef A NormalType;
NormalType &N() { return _norm; }
NormalType cN() const { return _norm; }
template <class RightF>
void ImportData(const RightF & rightF)
{
N().Import(rightF.cN());
T::ImportData( rightF);
}
inline NormalType &N() { return _norm; }
inline NormalType cN() const { return _norm; }
template <class RightValueType>
void ImportData(const RightValueType & rightF)
{
if(RightValueType::HasFaceNormal()) N().Import(rightF.cN());
T::ImportData( rightF);
}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasFaceNormal() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("NormalAbs"));T::Name(name);}
private:
NormalType _norm;
NormalType _norm;
};
template <class T> class WedgeNormal: public T {
public:
typedef typename T::VertexType::NormalType NormalType;
NormalType &WN(const int j) { return _wnorm[j]; }
const NormalType cWN(const int j) const { return _wnorm[j]; }
template <class RightF>
void ImportData(const RightF & rightF){ 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 Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; }
inline NormalType &WN(int j) { return _wnorm[j]; }
inline NormalType cWN(int j) const { return _wnorm[j]; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeNormal"));T::Name(name);}
private:
NormalType _wnorm[3];
NormalType _wnorm[3];
};
template <class A, class T> class WedgeRealNormal: public T {
public:
typedef A NormalType;
NormalType &WN(const int i) { return _wn[i]; }
NormalType const &cWN(const int i) const { return _wn[i]; }
template <class RightF>
void ImportData(const RightF & rightF){ 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 Dealloc(){T::Dealloc();}
inline NormalType &WN(int i) { return _wn[i]; }
inline NormalType cWN(int i) const { return _wn[i]; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeRealNormal"));T::Name(name);}
@ -299,19 +270,23 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class WedgeTexCoord: public T {
public:
typedef int WedgeTexCoordType;
typedef int WedgeTexCoordType;
typedef A TexCoordType;
TexCoordType &WT(const int i) { return _wt[i]; }
TexCoordType const &cWT(const int i) const { return _wt[i]; }
template <class RightF>
void ImportData(const RightF & rightF){ 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 Dealloc(){T::Dealloc();}
TexCoordType &WT(const int i) { return _wt[i]; }
TexCoordType cWT(const int i) const { return _wt[i]; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
static bool HasWedgeTexCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeTexCoord"));T::Name(name);}
private:
TexCoordType _wt[3];
TexCoordType _wt[3];
};
template <class TT> class WedgeTexCoord2s: public WedgeTexCoord<TexCoord2<short,1>, TT> {
@ -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 {
public:
BitFlags(){_flags=0;}
int &Flags() {return _flags; }
BitFlags():_flags(0) {}
int &Flags() {return _flags; }
int cFlags() const {return _flags; }
template <class RightF>
void ImportData(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportData(rightF);}
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
static bool HasFlags() { return true; }
@ -345,38 +324,48 @@ private:
int _flags;
};
/*-------------------------- Color Mark Quality ----------------------------------*/
/*-------------------------- Color ----------------------------------*/
template <class A, class T> class Color: public T {
public:
typedef A ColorType;
Color():_color(vcg::Color4b::White) {}
ColorType &C() { return _color; }
const ColorType &cC() const { return _color; }
template <class RightF>
void ImportData(const RightF & rightF){ C() = rightF.cC();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
ColorType &C() { return _color; }
ColorType cC() const { return _color; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
static bool HasFaceColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
private:
ColorType _color;
ColorType _color;
};
template <class A, class T> class WedgeColor: public T {
public:
typedef A ColorType;
ColorType &WC(const int i) { return _color[i]; }
const ColorType &WC(const int i) const { return _color[i]; }
const ColorType &cWC(const int i) const { return _color[i]; }
ColorType &WC(int i) { return _color[i]; }
ColorType cWC(int i) const { return _color[i]; }
template <class RightF>
void ImportData(const RightF & rightF){ if (RightF::HasWedgeColor()) { for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); } T::ImportData(rightF); } }
template <class RightValueType>
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 void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);}
private:
ColorType _color[3];
ColorType _color[3];
};
template <class T> class WedgeColor4b: public WedgeColor<vcg::Color4b, T> {
@ -393,14 +382,17 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class Quality: public T {
public:
typedef A QualityType;
QualityType &Q() { return _quality; }
const QualityType &cQ() const { return _quality; }
template <class RightF>
void ImportData(const RightF & rightF){ if(RightF::HasFaceQuality()) Q() = rightF.cQ();T::ImportData(rightF);}
QualityType &Q() { return _quality; }
QualityType cQ() const { return _quality; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
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);}
private:
QualityType _quality;
@ -419,18 +411,20 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::s
/*-------------------------- Quality3 ----------------------------------*/
template <class A, class T> class Quality3: public T {
public:
typedef vcg::Point3<A> Quality3Type;
Quality3Type &Q3() { return _quality; }
const Quality3Type &cQ3() const { return _quality; }
template <class RightF>
void ImportData(const RightF & rightF){ if(RightF::HasFaceQuality3()) Q3() = rightF.cQ3();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
typedef vcg::Point3<A> Quality3Type;
Quality3Type &Q3() { return _quality; }
Quality3Type cQ3() const { return _quality; }
template <class RightValueType>
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 Dealloc(){T::Dealloc();}
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);}
private:
Quality3Type _quality;
Quality3Type _quality;
};
template <class T> class Quality3s: public Quality3<short, T> {
@ -446,59 +440,63 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::s
/*-------------------------- INCREMENTAL 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 {
public:
static bool HasMark() { return true; }
inline int &IMark() { return _imark;}
inline int cIMark() const { return _imark;}
inline void InitIMark() { _imark = 0; }
inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;}
template <class RightF>
void ImportData(const RightF & rightF){ IMark() = rightF.IMark();T::ImportData(rightF);}
static bool HasFaceMark() { return true; }
template <class RightValueType>
void ImportData(const RightValueType & 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);}
private:
int _imark;
private:
int _imark;
};
/*-------------------------- Curvature Direction ----------------------------------*/
template <class S>
struct CurvatureDirBaseType{
typedef Point3<S> VecType;
typedef S ScalarType;
CurvatureDirBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values
};
template <class S>
struct CurvatureDirBaseType{
typedef Point3<S> VecType;
typedef S ScalarType;
CurvatureDirBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values
};
template <class A, class TT> class CurvatureDir: public TT {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
VecType &PD1(){ return _curv.max_dir;}
VecType &PD2(){ return _curv.min_dir;}
const VecType &cPD1() const {return _curv.max_dir;}
const VecType &cPD2() const {return _curv.min_dir;}
VecType &PD1() { return _curv.max_dir;}
VecType &PD2() { return _curv.min_dir;}
VecType cPD1() const { return _curv.max_dir;}
VecType cPD2() const { return _curv.min_dir;}
ScalarType &K1(){ return _curv.k1;}
ScalarType &K2(){ return _curv.k2;}
const ScalarType &cK1() const {return _curv.k1;}
const ScalarType &cK2()const {return _curv.k2;}
template < class LeftV>
void ImportData(const LeftV & left ) {
if(LeftV::HasCurvatureDir()) {
PD1() = left.cPD1(); PD2() = left.cPD2();
K1() = left.cK1(); K2() = left.cK2();
}
TT::ImportData( left);
}
ScalarType &K1() { return _curv.k1;}
ScalarType &K2() { return _curv.k2;}
ScalarType cK1() const {return _curv.k1;}
ScalarType cK2() const {return _curv.k2;}
template < class RightValueType>
void ImportData(const RightValueType & left ) {
if(RightValueType::HasCurvatureDir()) {
PD1() = left.cPD1(); PD2() = left.cPD2();
K1() = left.cK1(); K2() = left.cK2();
}
TT::ImportData( left);
}
static bool HasCurvatureDir() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
static bool HasCurvatureDir() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
private:
CurvatureDirType _curv;
@ -520,16 +518,14 @@ public:
_vfp[1]=0;
_vfp[2]=0;
}
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 const cVFp(const int j) const { 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 cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
char &VFi(const int j) {return _vfi[j]; }
template <class RightF>
void ImportData(const RightF & rightF){T::ImportData(rightF);}
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
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);}
private:
@ -548,16 +544,14 @@ public:
_efi[1]=-1;
_efi[2]=-1;
}
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 const cEFp(const int j) const { 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 cEFp(const int j) const { assert(j>=0 && j<3); return _efp[j]; }
char &VFi(const int j) {return _efi[j]; }
template <class RightF>
void ImportData(const RightF & rightF){T::ImportData(rightF);}
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
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);}
private:
@ -569,33 +563,31 @@ private:
/*----------------------------- FFADJ ------------------------------*/
template <class T> class FFAdj: public T {
public:
FFAdj(){
_ffp[0]=0;
_ffp[1]=0;
_ffp[2]=0;
}
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 const cFFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
char &FFi(const int j) { return _ffi[j]; }
const char &cFFi(const int j) const { return _ffi[j]; }
FFAdj(){
_ffp[0]=0;
_ffp[1]=0;
_ffp[2]=0;
}
typename T::FacePointer &FFp(const int j) { assert(j>=0 && j<3); return _ffp[j]; }
typename T::FacePointer cFFp(const int j) const { assert(j>=0 && j<3); return _ffp[j]; }
char &FFi(const int j) { 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 &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 const FFp2( const int j ) const { return FFp((j+2)%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 cFFp1( const int j ) const { return FFp((j+1)%3);}
typename T::FacePointer cFFp2( const int j ) const { return FFp((j+2)%3);}
template <class RightF>
void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
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);}
private:
typename T::FacePointer _ffp[3] ;
char _ffi[3] ;
typename T::FacePointer _ffp[3] ;
char _ffi[3] ;
};
@ -603,51 +595,51 @@ private:
template <class T> class FEAdj: public T {
public:
FEAdj(){
_fep[0]=0;
_fep[1]=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]; }
FEAdj(){
_fep[0]=0;
_fep[1]=0;
_fep[2]=0;
}
typename T::EdgePointer &FEp1( const int j ) { return FEp((j+1)%3);}
typename T::EdgePointer &FEp2( const int j ) { return FEp((j+2)%3);}
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);}
typename T::EdgePointer &FEp( int j) { assert(j>=0 && j<3); return _fep[j]; }
typename T::EdgePointer cFEp( int j) const { assert(j>=0 && j<3); return _fep[j]; }
template <class RightF>
void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
typename T::EdgePointer &FEp1( int j ) { return FEp((j+1)%3);}
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 Dealloc(){T::Dealloc();}
static bool HasFEAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("FEAdj"));T::Name(name);}
private:
typename T::EdgePointer _fep[3] ;
char _fei[3] ;
typename T::EdgePointer _fep[3] ;
char _fei[3] ;
};
/*----------------------------- FHADJ ------------------------------*/
template <class T> class FHAdj: public T {
public:
FHAdj(){_fh=0;}
typename T::HEdgePointer &FHp( ) { return _fh; }
typename T::HEdgePointer const cFHp( ) const { return _fh; }
FHAdj(){_fh=0;}
typename T::HEdgePointer &FHp( ) { return _fh; }
typename T::HEdgePointer cFHp( ) const { return _fh; }
template <class RightF>
void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasFHAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("FHAdj"));T::Name(name);}
template <class RightValueType>
void ImportData(const RightValueType & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();}
static bool HasFHAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("FHAdj"));T::Name(name);}
private:
typename T::HEdgePointer _fh ;
typename T::HEdgePointer _fh ;
};
/** @} */ // End Doxygen FaceComponentGroup
/** @} */ // End Doxygen FaceComponentGroup
} // end namespace face
}// end namespace vcg
#endif

View File

@ -390,12 +390,7 @@ public:
}; // end class vector_ocf
//template<> void EnableAttribute<typename VALUE_TYPE::NormalType>(){ NormalEnabled=true;}
/*------------------------- COORD -----------------------------------------*/
/*----------------------------- VFADJ ------------------------------*/
template <class T> class VFAdjOcf: public T {
public:
typename T::FacePointer &VFp(const int j) {
@ -422,83 +417,75 @@ public:
private:
};
/*----------------------------- FFADJ ------------------------------*/
template <class T> class FFAdjOcf: public T {
public:
typename T::FacePointer &FFp(const int j) {
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._fp[j];
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._fp[j];
}
typename T::FacePointer const FFp(const int j) const { return cFFp(j);}
typename T::FacePointer const cFFp(const int j) const {
if(! (*this).Base().FFAdjacencyEnabled ) return 0;
else return (*this).Base().AF[(*this).Index()]._fp[j];
typename T::FacePointer cFFp(const int j) const {
if(! (*this).Base().FFAdjacencyEnabled ) return 0;
else return (*this).Base().AF[(*this).Index()]._fp[j];
}
char &FFi(const int j) {
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._zp[j];
char &FFi(const int j) {
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._zp[j];
}
char cFFi(const int j) const {
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._zp[j];
assert((*this).Base().FFAdjacencyEnabled);
return (*this).Base().AF[(*this).Index()]._zp[j];
}
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 const FFp1( 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 & Neigh( const int j ) { return FFp(j);}
typename T::FacePointer const cNeigh( const int j ) const { return cFFp(j);}
unsigned int SizeNeigh(){return 3;}
template <class LeftF>
void ImportData(const LeftF & leftF){
T::ImportData(leftF);
}
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 cFFp1( const int j ) const { return FFp((j+1)%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 cNeigh( const int j ) const { return cFFp(j);}
unsigned int SizeNeigh(){return 3;}
template <class LeftF>
void ImportData(const LeftF & leftF){
T::ImportData(leftF);
}
static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcf() { return true; }
private:
};
/*------------------------- Normal -----------------------------------------*/
template <class A, class T> class NormalOcf: public T {
public:
typedef A NormalType;
static bool HasFaceNormal() { return true; }
static bool HasFaceNormalOcf() { return true; }
NormalType &N() {
NormalType &N() {
// 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()]; }
const NormalType &cN() const {
NormalType cN() const {
// 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()]; }
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled)
N() = leftF.cN();
T::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().NormalEnabled && LeftF::HasNormal())
N() = leftF.cN();
T::ImportData(leftF);
}
};
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
template <class T> class Normal3fOcf: public NormalOcf<vcg::Point3f, T> {};
template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
/*------------------------- CurvatureDir -----------------------------------------*/
template <class S>
struct CurvatureDirOcfBaseType{
typedef Point3<S> VecType;
@ -510,64 +497,64 @@ struct CurvatureDirOcfBaseType{
template <class A, class T> class CurvatureDirOcf: public T {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
static bool HasCurvatureDir() { return true; }
static bool HaCurvatureDirOcf() { return true; }
static bool HasCurvatureDirOcf() { return true; }
VecType &PD1(){
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir;
}
VecType &PD1() {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir;
}
VecType &PD2(){
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir;
}
VecType &PD2() {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir;
}
const VecType &cPD1() const {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir;
}
VecType cPD1() const {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir;
}
const VecType &cPD2() const {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir;
}
VecType cPD2() const {
assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir;
}
ScalarType &K1(){
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1;
}
ScalarType &K2(){
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2;
}
const ScalarType &cK1() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1;
}
const ScalarType &cK2() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2;
}
ScalarType &K1() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1;
}
ScalarType &K2() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2;
}
ScalarType cK1() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1;
}
ScalarType cK2() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2;
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().CurvatureDirEnabled && leftF.Base().CurvatureDirEnabled)
PD1() = leftF.cPD1();
PD2() = leftF.cPD2();
K1() = leftF.cK1();
K2() = leftF.cK2();
T::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().CurvatureDirEnabled && LeftF::HasCurvatureDir())
PD1() = leftF.cPD1();
PD2() = leftF.cPD2();
K1() = leftF.cK1();
K2() = leftF.cK2();
T::ImportData(leftF);
}
};
@ -579,30 +566,24 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
};
///*-------------------------- QUALITY ----------------------------------*/
template <class A, class T> class QualityOcf: public T {
public:
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 Q() const {
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 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)
Q() = leftF.cQ();
T::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().QualityEnabled && LeftF::HasFaceQuality())
Q() = leftF.cQ();
T::ImportData(leftF);
}
static bool HasFaceQuality() { return true; }
static bool HasFaceQualityOcf() { return true; }
};
@ -610,30 +591,24 @@ public:
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
///*-------------------------- COLOR ----------------------------------*/
template <class A, class T> class ColorOcf: public T {
public:
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 {
assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()];
}
const ColorType cC() const {
assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()];
ColorType cC() const {
assert((*this).Base().ColorEnabled);
return (*this).Base().CV[(*this).Index()];
}
template <class 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 )
C() = leftF.cC();
T::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().ColorEnabled && LeftF::HasFaceColor())
C() = leftF.cC();
T::ImportData(leftF);
}
static bool HasFaceColor() { return true; }
static bool HasFaceColorOcf() { return true; }
};
@ -641,46 +616,42 @@ public:
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
///*-------------------------- MARK ----------------------------------*/
template <class T> class MarkOcf: public T {
public:
inline int & IMark() {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
inline int &IMark() {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
inline int IMark() const {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
inline int cIMark() const {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
} ;
template <class 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)
IMark() = leftF.IMark();
T::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if((*this).Base().MarkEnabled && LeftF::HasFaceMark())
IMark() = leftF.cIMark();
T::ImportData(leftF);
}
static bool HasFaceMark() { return true; }
static bool HasFaceMarkOcf() { return true; }
inline void InitIMark() { IMark() = 0; }
};
///*-------------------------- WEDGE TEXCOORD ----------------------------------*/
template <class A, class TT> class WedgeTexCoordOcf: public TT {
public:
WedgeTexCoordOcf(){ }
typedef A TexCoordType;
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]; }
template <class 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)
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
TT::ImportData(leftF);
}
TexCoordType &WT(const int i) { 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>
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::HasWedgeTexCoord())
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
TT::ImportData(leftF);
}
static bool HasWedgeTexCoord() { return true; }
static bool HasWedgeTexCoordOcf() { return true; }
};
@ -688,20 +659,18 @@ public:
template <class T> class WedgeTexCoordfOcf: public WedgeTexCoordOcf<TexCoord2<float,1>, T> {};
///*-------------------------- WEDGE COLOR ----------------------------------*/
template <class A, class TT> class WedgeColorOcf: public TT {
public:
WedgeColorOcf(){ }
typedef A ColorType;
ColorType &WC(const int i) { 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>
void ImportData(const LeftF & leftF){
//if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeColorEnabled)
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
TT::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if(this->Base().WedgeColorEnabled && LeftF::HasWedgeColor())
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
TT::ImportData(leftF);
}
static bool HasWedgeColor() { return true; }
static bool HasWedgeColorOcf() { return true; }
};
@ -709,20 +678,18 @@ public:
template <class T> class WedgeColor4bOcf: public WedgeColorOcf<vcg::Color4b, T> {};
///*-------------------------- WEDGE NORMAL ----------------------------------*/
template <class A, class TT> class WedgeNormalOcf: public TT {
public:
WedgeNormalOcf(){ }
typedef A NormalType;
NormalType &WN(const int i) { 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>
void ImportData(const LeftF & leftF){
//if(this->Base().WedgeNormalEnabled && leftF.Base().WedgeNormalEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeNormalEnabled)
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
TT::ImportData(leftF);
}
template <class LeftF>
void ImportData(const LeftF & leftF){
if(this->Base().WedgeNormalEnabled && LeftF::HasWedgeNormal())
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
TT::ImportData(leftF);
}
static bool HasWedgeNormal() { return true; }
static bool HasWedgeNormalOcf() { return true; }
};
@ -732,38 +699,39 @@ template <class T> class WedgeNormal3fOcf: public WedgeNormalOcf<vcg::Point3f, T
template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T> {};
///*-------------------------- InfoOpt ----------------------------------*/
template < class T> class InfoOcf: public T {
public:
// You should never ever try to copy a vertex that has OCF stuff.
// use ImportData function.
inline InfoOcf &operator=(const InfoOcf & /*other*/) {
assert(0); return *this;
}
// You should never ever try to copy a vertex that has OCF stuff.
// use ImportData function.
inline InfoOcf &operator=(const InfoOcf & /*other*/) {
assert(0); return *this;
}
vector_ocf<typename T::FaceType> &Base() const { return *_ovp;}
template <class LeftF>
void ImportData(const LeftF & leftF){T::ImportData(leftF);}
template <class LeftF>
void ImportData(const LeftF & leftF){T::ImportData(leftF);}
static bool HasFaceColorOcf() { return false; }
static bool HasFaceNormalOcf() { return false; }
static bool HasFaceCurvatureDirOcf() { return false; }
static bool HasFaceMarkOcf() { return false; }
static bool HasWedgeTexCoordOcf() { return false; }
static bool HasFFAdjacencyOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; }
//static bool HasFaceQualityOcf() { return false; }
static bool HasFaceColorOcf() { return false; }
static bool HasFaceQualityOcf() { return false; }
static bool HasFaceNormalOcf() { return false; }
static bool HasFaceCurvatureDirOcf() { return false; }
static bool HasFaceMarkOcf() { return false; }
static bool HasWedgeTexCoordOcf() { return false; }
static bool HasWedgeColorOcf() { return false; }
static bool HasWedgeNormalOcf() { return false; }
static bool HasFFAdjacencyOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; }
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);
int tt2=tp- &*(_ovp->begin());
return tt2;
}
}
public:
// ovp Optional Vector Pointer
// Pointer to the base vector where each face element is stored.
// Pointer to the base vector where each face element is stored.
// used to access to the vectors of the other optional members.
vector_ocf<typename T::FaceType> *_ovp;
};

View File

@ -46,108 +46,94 @@ namespace vertex {
template <class TT> class EmptyCore: public TT {
public:
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; }
static bool HasFlags() { return false; }
typedef vcg::Point3f CoordType;
typedef CoordType::ScalarType ScalarType;
CoordType &P() { static CoordType coord(0, 0, 0); return coord; }
CoordType cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
CoordType &P() { assert(0); static CoordType coord(0, 0, 0); return coord; }
CoordType cP() const { assert(0); static CoordType coord(0, 0, 0); assert(0); return coord; }
static bool HasCoord() { return false; }
typedef vcg::Point3s NormalType;
NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
NormalType cN() const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
static bool HasNormal() { return false; }
static bool HasNormalOcf() { return false; }
NormalType &N() { assert(0); static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
NormalType cN() const { assert(0); static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
static bool HasNormal() { return false; }
typedef float QualityType;
QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
QualityType &Q() { assert(0); static QualityType dummyQuality(0); return dummyQuality; }
QualityType cQ() const { assert(0); static QualityType dummyQuality(0); return dummyQuality; }
static bool HasQuality() { return false; }
static bool HasQualityOcf() { return false; }
static bool IsQualityEnabled(const typename TT::VertexType *) { return false; }
typedef vcg::Color4b ColorType;
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 &C() { 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 HasColorOcf() { return false; }
static bool IsColorEnabled(const typename TT::VertexType *) { return false; }
typedef int MarkType;
inline void InitIMark() { }
inline int cIMark() const { assert(0); static int tmp=-1; return tmp;}
inline int &IMark() { assert(0); static int tmp=-1; return tmp;}
void InitIMark() { }
int cIMark() const { 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 HasMarkOcf() { return false; }
static bool IsMarkEnabled(const typename TT::VertexType *) { return false; }
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; }
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;
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 &T() { 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 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; }
int &VTi() { static int z = 0; return z; }
static bool HasVTAdjacency() { return false; }
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; }
int &VFi() {static int z=0; assert(0); return z;}
int cVFi() const {static int z=0; assert(0); return z;}
typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; }
typename TT::FacePointer cVFp() const { static typename TT::FacePointer fp=0; assert(0); return fp; }
int &VFi() { static int z=0; assert(0); return z;}
int cVFi() const { static int z=0; assert(0); return z;}
static bool HasVFAdjacency() { return false; }
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; }
int &VEi(){static int z=0; return z;}
typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; }
typename TT::EdgePointer cVEp() const { static typename TT::EdgePointer ep=0; assert(0); return ep; }
int &VEi() { static int z=0; return z;}
int cVEi() const { static int z=0; return z;}
static bool HasVEAdjacency() { return false; }
typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
const typename TT::HEdgePointer cVHp() const { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
int &VHi(){static int z=0; return z;}
static bool HasVHAdjacency() { return false; }
typename TT::HEdgePointer &VHp() { 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 cVHi() const { static int z=0; return z;}
static bool HasVHAdjacency() { return false; }
typedef Point3f VecType;
typedef Point2f CurvatureType;
float &Kh() { 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;}
const float &cKg() const { static float dummy = 0.f; assert(0); return dummy;}
typedef Point2f CurvatureType;
float &Kh() { static float dummy = 0.f; assert(0);return dummy;}
float &Kg() { static float dummy = 0.f; assert(0);return dummy;}
float cKh() 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;
VecType &PD1(){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;}
const VecType &cPD2() const {static VecType v(0,0,0); assert(0);return v;}
typedef CurvatureDirBaseType<float> CurvatureDirType;
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 cPD1() 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 &K2(){ static ScalarType v = 0.0;assert(0);return v;}
const 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 &K1() { static ScalarType v = 0.0;assert(0);return v;}
ScalarType &K2() { static ScalarType v = 0.0;assert(0);return v;}
ScalarType cK1() 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 HasCurvatureDir() { return false; }
static bool HasCurvatureOcf() { return false; }
static bool HasCurvatureDirOcf() { return false; }
static bool IsCurvatureDirEnabled(const typename TT::VertexType *) { return false; }
static bool IsCurvatureEnabled(const typename TT::VertexType *) { return false; }
template < class LeftV>
void ImportData(const LeftV & /*left*/ ) {
// TT::ImportData( left);
template < class RightValueType>
void ImportData(const RightValueType & /*rVert*/ ) {
// TT::ImportData( rVert);
}
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
@ -161,14 +147,13 @@ template <class A, class T> class Coord: public T {
public:
typedef A CoordType;
typedef typename A::ScalarType ScalarType;
CoordType &P() { return _coord; }
const CoordType &P() const { return _coord; }
const CoordType &cP() const { return _coord; }
inline CoordType &P() { return _coord; }
inline CoordType cP() const { return _coord; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportData( left); }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasCoord()) P().Import(rVert.cP()); T::ImportData( rVert); }
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);}
private:
CoordType _coord;
@ -189,17 +174,15 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class Normal: public T {
public:
typedef A NormalType;
NormalType &N() { return _norm; }
const NormalType &cN() const { return _norm; }
template < class LeftV>
void ImportData(const LeftV & left ){
if(LeftV::HasNormal())
N().Import(left.cN());
T::ImportData( left);
}
inline NormalType &N() { return _norm; }
inline NormalType cN() const { return _norm; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ){
if(RightValueType::HasNormal()) N().Import(rVert.cN());
T::ImportData( rVert);
}
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:
NormalType _norm;
@ -224,15 +207,13 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class Mark: public T {
public:
inline int cIMark() const { return _imark;}
inline int &IMark() { return _imark;}
static bool HasMark() { return true; }
static bool HasMarkOcc() { return true; }
inline void InitIMark() { _imark = 0; }
inline const int & cIMark() const { return _imark;}
inline int & IMark() { return _imark;}
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);}
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasMark()) IMark() = rVert.cIMark(); T::ImportData( rVert); }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private:
int _imark;
@ -250,9 +231,9 @@ template <class A, class TT> class TexCoord: public TT {
public:
typedef A TexCoordType;
TexCoordType &T() { return _t; }
const TexCoordType &cT() const { return _t; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportData( left); }
TexCoordType cT() const { return _t; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasTexCoord()) T() = rVert.cT(); TT::ImportData( rVert); }
static bool HasTexCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
@ -278,14 +259,14 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class BitFlags: public T {
public:
BitFlags(){_flags=0;}
BitFlags(){_flags=0;}
typedef int FlagType;
int &Flags() {return _flags; }
int cFlags() const {return _flags; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.cFlags(); T::ImportData( left); }
inline int &Flags() {return _flags; }
inline int cFlags() const {return _flags; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasFlags()) Flags() = rVert.cFlags(); T::ImportData( rVert); }
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);}
private:
int _flags;
@ -302,13 +283,12 @@ template <class A, class T> class Color: public T {
public:
Color():_color(vcg::Color4b::White) {}
typedef A ColorType;
ColorType &C() { return _color; }
const ColorType &C() const { return _color; }
const ColorType &cC() const { return _color; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportData( left); }
inline ColorType &C() { return _color; }
inline ColorType cC() const { return _color; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasColor()) C() = rVert.cC(); T::ImportData( rVert); }
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);}
private:
@ -330,12 +310,12 @@ The Quality Component is a generic place for storing a float. The term 'quality'
template <class A, class TT> class Quality: public TT {
public:
typedef A QualityType;
QualityType &Q() { return _quality; }
const QualityType & cQ() const {return _quality; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportData( left); }
inline QualityType &Q() { return _quality; }
inline QualityType cQ() const {return _quality; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasQuality()) Q() = rVert.cQ(); TT::ImportData( rVert); }
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);}
private:
QualityType _quality;
@ -358,19 +338,19 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
*/
template <class A, class TT> class Curvature: public TT {
public:
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
ScalarType &Kh(){ return _hk[0];}
ScalarType &Kg(){ return _hk[1];}
const ScalarType &cKh() const { return _hk[0];}
const ScalarType &cKg() const { return _hk[1];}
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
ScalarType &Kh() { return _hk[0];}
ScalarType &Kg() { return _hk[1];}
ScalarType cKh() const { return _hk[0];}
ScalarType cKg() const { return _hk[1];}
static bool HasCurvature() { return true; }
static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
static bool HasCurvature() { return true; }
static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
private:
Point2<A> _hk;
Point2<A> _hk;
};
@ -384,25 +364,25 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
/*-------------------------- Curvature Direction ----------------------------------*/
template <class TT> class EmptyCurvatureDir: public TT {
public:
typedef CurvatureDirBaseType<float> CurvatureDirType;
template <class TT> class EmptyCurvatureDir: public TT {
public:
typedef CurvatureDirBaseType<float> CurvatureDirType;
Point3f &PD1(){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;}
const Point3f &cPD2()const {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 cPD1() 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 &K2(){ static float dummy(0);assert(0);return dummy;}
const float &cK1()const { static float dummy(0);assert(0);return dummy;}
const float &cK2()const { 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 cK1() 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; }
template < class LeftV>
void ImportData(const LeftV & left ) { TT::ImportData( left); }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
static bool HasCurvatureDir() { return false; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { TT::ImportData( rVert); }
static void Name(std::vector<std::string> & name){TT::Name(name);}
};
/*! \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.
@ -423,13 +403,13 @@ public:
ScalarType &K2(){ return _curv.k2;}
const ScalarType &cK1() const {return _curv.k1;}
const ScalarType &cK2()const {return _curv.k2;}
template < class LeftV>
void ImportData(const LeftV & left ) {
if(LeftV::HasCurvatureDir()) {
PD1() = left.cPD1(); PD2() = left.cPD2();
K1() = left.cK1(); K2() = left.cK2();
template < class RightValueType>
void ImportData(const RightValueType & rVert ) {
if(RightValueType::HasCurvatureDir()) {
PD1() = rVert.cPD1(); PD2() = rVert.cPD2();
K1() = rVert.cK1(); K2() = rVert.cK2();
}
TT::ImportData( left);
TT::ImportData( rVert);
}
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.
*/
template <class A, class TT> class Radius: public TT {
public:
typedef A RadiusType;
RadiusType &R() { return _radius; }
const RadiusType & cR() const {return _radius; }
template < class LeftV>
void ImportData(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportData( left); }
static bool HasRadius() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
template <class A, class TT> class Radius: public TT {
public:
typedef A RadiusType;
RadiusType &R() { return _radius; }
RadiusType cR() const {return _radius; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { if(RightValueType::HasRadius()) R() = rVert.cR(); TT::ImportData( rVert); }
static bool HasRadius() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
private:
RadiusType _radius;
};
private:
RadiusType _radius;
};
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);}
@ -482,13 +462,13 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class VEAdj: public T {
public:
VEAdj(){_ep=0;_zp=-1;}
typename T::EdgePointer &VEp() {return _ep; }
typename T::EdgePointer const cVEp() const {return _ep; }
int &VEi() {return _zp; }
template < class LeftV>
void ImportData(const LeftV & left ) { T::ImportData( left); }
typename T::EdgePointer &VEp() {return _ep; }
typename T::EdgePointer cVEp() const {return _ep; }
int &VEi() {return _zp; }
int cVEi() const {return _zp; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
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);}
private:
@ -506,36 +486,34 @@ Note that if you use this component it is expected that on the Face you use also
\sa iterators
*/
template <class T> class VFAdj: public T {
public:
VFAdj(){_fp=0;_zp=-1;}
typename T::FacePointer &VFp() {return _fp; }
typename T::FacePointer const cVFp() const {return _fp; }
int &VFi() {return _zp; }
int const &cVFi() const {return _zp; }
template < class LeftV>
void ImportData(const LeftV & left ) { T::ImportData( left); }
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);}
template <class T> class VFAdj: public T {
public:
VFAdj(){_fp=0;_zp=-1;}
typename T::FacePointer &VFp() { return _fp; }
typename T::FacePointer cVFp() const { return _fp; }
int &VFi() { return _zp; }
int cVFi() const { return _zp; }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
static bool HasVFAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
private:
typename T::FacePointer _fp ;
int _zp ;
};
private:
typename T::FacePointer _fp ;
int _zp ;
};
/*----------------------------- VHADJ ------------------------------*/
template <class T> class VHAdj: public T {
public:
VHAdj(){_hp=0;_zp=-1;}
typename T::HEdgePointer &VHp() {return _hp; }
typename T::HEdgePointer cVHp() {return _hp; }
typename T::HEdgePointer &VHp() {return _hp; }
typename T::HEdgePointer cVHp() const {return _hp; }
int &VHi() {return _zp; }
template < class LeftV>
void ImportData(const LeftV & left ) { T::ImportData( left); }
template < class RightValueType>
void ImportData(const RightValueType & rVert ) { T::ImportData( rVert); }
static bool HasVHAdjacency() { return true; }
static bool HasVHAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);}
private:
@ -548,11 +526,10 @@ private:
template <class T> class VTAdj: public T {
public:
VTAdj() { _tp = 0; _zp=-1;}
typename T::TetraPointer &VTp() { return _tp; }
typename T::TetraPointer cVTp() { return _tp; }
typename T::TetraPointer &VTp() { return _tp; }
typename T::TetraPointer cVTp() const { return _tp; }
int &VTi() {return _zp; }
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); }
private:

View File

@ -126,7 +126,6 @@ void EnableQuality() {
QualityEnabled=true;
QV.resize((*this).size());
}
void DisableQuality() {
assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=false;
@ -139,7 +138,6 @@ void EnableColor() {
ColorEnabled=true;
CV.resize((*this).size());
}
void DisableColor() {
assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=false;
@ -152,7 +150,6 @@ void EnableMark() {
MarkEnabled=true;
MV.resize((*this).size());
}
void DisableMark() {
assert(VALUE_TYPE::HasMarkOcf());
MarkEnabled=false;
@ -165,7 +162,6 @@ void EnableNormal() {
NormalEnabled=true;
NV.resize((*this).size());
}
void DisableNormal() {
assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=false;
@ -179,7 +175,6 @@ void EnableVFAdjacency() {
VFAdjType zero; zero._fp=0; zero._zp=-1;
AV.resize((*this).size(),zero);
}
void DisableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=false;
@ -192,7 +187,6 @@ void EnableCurvature() {
CurvatureEnabled=true;
CuV.resize((*this).size());
}
void DisableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=false;
@ -205,7 +199,6 @@ void EnableCurvatureDir() {
CurvatureDirEnabled=true;
CuDV.resize((*this).size());
}
void DisableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=false;
@ -218,7 +211,6 @@ void EnableRadius() {
RadiusEnabled=true;
RadiusV.resize((*this).size());
}
void DisableRadius() {
assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=false;
@ -232,12 +224,12 @@ void EnableTexCoord() {
TexCoordEnabled=true;
TV.resize((*this).size());
}
void DisableTexCoord() {
assert(VALUE_TYPE::HasTexCoordOcf());
TexCoordEnabled=false;
TV.clear();
}
struct VFAdjType {
typename VALUE_TYPE::FacePointer _fp ;
int _zp ;
@ -274,17 +266,16 @@ public:
template <class T> class VFAdjOcf: public T {
public:
typename T::FacePointer &VFp() {
typename T::FacePointer &VFp() {
assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._fp;
}
typename T::FacePointer cVFp() const {
if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return (*this).Base().AV[(*this).Index()]._fp;
}
int &VFi() {
int &VFi() {
assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._zp;
}
@ -310,29 +301,18 @@ private:
template <class A, class T> class NormalOcf: public T {
public:
typedef A NormalType;
static bool HasNormal() { return true; }
static bool HasNormalOcf() { return true; }
typedef A NormalType;
static bool HasNormal() { return true; }
static bool HasNormalOcf() { return true; }
NormalType &N() {
// you cannot use Normals before enabling them with: yourmesh.vert.EnableNormal()
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()]; }
NormalType &N() { assert((*this).Base().NormalEnabled); return (*this).Base().NV[(*this).Index()]; }
NormalType cN() const { 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>
void ImportData(const LeftV & leftV){
if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled ) // copy the data only if they are enabled in both vertices
N().Import(leftV.cN());
T::ImportData(leftV);}
template <class LeftV>
void ImportData(const LeftV & leftV){
if((*this).Base().NormalEnabled && LeftV::HasNormal() )
N().Import(leftV.cN());
T::ImportData(leftV);}
};
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3sOcf"));T::Name(name);}};
@ -343,20 +323,19 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {public:
template <class A, class T> class ColorOcf: public T {
public:
typedef A ColorType;
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
const ColorType &C() const { return this->cC(); }
const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV>
void ImportData(const LeftV & leftV)
{
if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled ) // copy the data only if they are enabled in both vertices
C() = leftV.cC();
T::ImportData(leftV);
}
typedef A ColorType;
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
ColorType cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV>
void ImportData(const LeftV & leftV)
{
if((*this).Base().ColorEnabled && LeftV::HasColor() )
C() = leftV.cC();
T::ImportData(leftV);
}
static bool HasColor() { return true; }
static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; }
static bool HasColor() { return true; }
static bool HasColorOcf() { assert(!T::HasColorOcf()); return true; }
};
template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {
@ -367,19 +346,18 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class T> class QualityOcf: public T {
public:
typedef A QualityType;
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()]; }
template <class 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
Q() = leftV.cQ();
T::ImportData(leftV);
}
static bool HasQuality() { return true; }
static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
typedef A QualityType;
QualityType &Q() { 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>
void ImportData(const LeftV & leftV)
{
if((*this).Base().QualityEnabled && LeftV::HasQuality() ) // copy the data only if they are enabled in both vertices
Q() = leftV.cQ();
T::ImportData(leftV);
}
static bool HasQuality() { return true; }
static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
};
template <class T> class QualityfOcf: public QualityOcf<float, T> {
@ -392,19 +370,17 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class TexCoordOcf: public TT {
public:
typedef A TexCoordType;
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
const TexCoordType &T() const { return this->cT(); }
const TexCoordType &cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
template < class 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) // copy the data only if they are enabled in both vertices
T() = leftV.cT();
TT::ImportData(leftV);
}
static bool HasTexCoord() { return true; }
static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; }
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
TexCoordType cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
template < class LeftV>
void ImportData(const LeftV & leftV)
{
if((*this).Base().TexCoordEnabled && LeftV::HasTexCoord()) // copy the data only if they are enabled in both vertices
T() = leftV.cT();
TT::ImportData(leftV);
}
static bool HasTexCoord() { return true; }
static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; }
};
template <class T> class TexCoordfOcf: public TexCoordOcf<TexCoord2<float,1>, T> {
@ -415,29 +391,21 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class T> class MarkOcf: public T {
public:
typedef int MarkType;
inline int & IMark() {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
typedef int MarkType;
inline int &IMark() { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
inline int cIMark() const { assert((*this).Base().MarkEnabled); return (*this).Base().MV[(*this).Index()]; }
inline int IMark() const {
assert((*this).Base().MarkEnabled);
return (*this).Base().MV[(*this).Index()];
}
template <class 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) // copy the data only if they are enabled in both vertices
IMark() = leftV.cIMark();
T::ImportData(leftV);
}
static bool HasMark() { return true; }
static bool HasMarkOcf() { return true; }
inline void InitIMark() { IMark() = 0; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("IMark"));T::Name(name);}
template <class LeftV>
void ImportData(const LeftV & leftV)
{
if((*this).Base().MarkEnabled && LeftV::HasMark()) // copy the data only if they are enabled in both vertices
IMark() = leftV.cIMark();
T::ImportData(leftV);
}
static bool HasMark() { return true; }
static bool HasMarkOcf() { return true; }
inline void InitIMark() { IMark() = 0; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("IMark"));T::Name(name);}
};
@ -446,32 +414,26 @@ public:
template <class A, class TT> class CurvatureOcf: public TT {
public:
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType;
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];}
const 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 &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 cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
ScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
template <class 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::IsCurvatureEnabled(&leftV))
{
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
}
TT::ImportData(leftV);
}
template <class LeftV>
void ImportData(const LeftV & leftV){
if((*this).Base().CurvatureEnabled && LeftV::HasCurvature())
{
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
}
TT::ImportData(leftV);
}
static bool HasCurvature() { return true; }
static bool IsCurvatureEnabled(const typename TT::VertexType *v) { return v->Base().CurvatureEnabled; }
static bool HasCurvatureOcf() { return true; }
private:
static bool HasCurvatureOcf() { return true; }
};
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);} };
@ -492,39 +454,35 @@ struct CurvatureDirTypeOcf{
template <class A, class TT> class CurvatureDirOcf: public TT {
public:
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType;
typedef typename CurvatureDirType::ScalarType ScalarType;
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;}
const 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 &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 cPD1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_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 &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;}
const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
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 cK1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
ScalarType cK2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
template <class LeftV>
void ImportData(const LeftV & leftV){
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV!
if((*this).Base().CurvatureDirEnabled && LeftV::IsCurvatureDirEnabled(&leftV))
{
(*this).PD1() = leftV.cPD1();
(*this).PD2() = leftV.cPD2();
(*this).K1() = leftV.cK1();
(*this).K2() = leftV.cK2();
}
TT::ImportData(leftV);
void ImportData(const LeftV & leftV){
if((*this).Base().IsCurvatureDirEnabled() && LeftV::HasCurvatureDir())
{
(*this).PD1() = leftV.cPD1();
(*this).PD2() = leftV.cPD2();
(*this).K1() = leftV.cK1();
(*this).K2() = leftV.cK2();
}
TT::ImportData(leftV);
}
static bool HasCurvatureDir() { return true; }
static bool HasCurvatureDirOcf() { return true; }
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> {
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirfOcf"));T::Name(name);}
@ -538,26 +496,23 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class RadiusOcf: public TT {
public:
typedef A RadiusType;
typedef RadiusType ScalarType;
typedef A RadiusType;
typedef RadiusType ScalarType;
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 &R() { 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>
void ImportData(const LeftV & leftV)
{
//if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled ) // WRONG I do not know anything about leftV!
if ((*this).Base().RadiusEnabled)
(*this).Base().RadiusV[(*this).Index()] = leftV.cR();
TT::ImportData(leftV);
}
template <class LeftV>
void ImportData(const LeftV & leftV)
{
if ((*this).Base().RadiusEnabled && LeftV::HasRadius())
(*this).Base().RadiusV[(*this).Index()] = leftV.cR();
TT::ImportData(leftV);
}
static bool HasRadius() { return true; }
static bool HasRadiusOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
private:
static bool HasRadius() { return true; }
static bool HasRadiusOcf() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcf")); TT::Name(name);}
};
template <class T> class RadiusfOcf: public RadiusOcf<float, T> {};
@ -585,6 +540,11 @@ public:
vector_ocf<typename T::VertexType> *_ovp;
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 HasVFAdjacencyOcf() { return false; }
};