added curvature and curvatruredir (compiled .net 2005 and gcc)
This commit is contained in:
parent
b457b0c978
commit
bd36c63923
|
@ -24,6 +24,12 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.11 2008/02/04 21:26:49 ganovelli
|
||||
added ImportLocal which imports all local attributes into vertexplus and faceplus.
|
||||
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
|
||||
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
|
||||
Added some function for const attributes
|
||||
|
||||
Revision 1.10 2007/03/12 15:37:21 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
|
@ -113,7 +119,9 @@ class VertexBase: public vert::EmptyTexCoord<
|
|||
vert::EmptyNormal<
|
||||
vert::EmptyBitFlags<
|
||||
vert::EmptyCoord<
|
||||
VertexTypeHolder <BVT, BET, BFT, BTT> > > > > > > >{
|
||||
vert::EmptyCurvature<
|
||||
vert::EmptyCurvatureDir<
|
||||
VertexTypeHolder <BVT, BET, BFT, BTT> > > > > > > > > >{
|
||||
};
|
||||
|
||||
// Metaprogramming Core
|
||||
|
@ -142,12 +150,27 @@ template <class BVT, class BET, typename BFT,class BTT,
|
|||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E >
|
||||
class VertexArity5: public E<VertexArity4<BVT,BET,BFT,BTT, A, B, C, D> > {};
|
||||
|
||||
template <class BVT, class BET, typename BFT,class BTT,
|
||||
template <typename> class A, template <typename> class B,
|
||||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E, template <typename> class F >
|
||||
class VertexArity6: public F<VertexArity5<BVT,BET,BFT,BTT, A, B, C, D, E> > {};
|
||||
|
||||
template <class BVT, class BET, typename BFT,class BTT,
|
||||
template <typename> class A, template <typename> class B,
|
||||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E, template <typename> class F,
|
||||
template <typename> class G>
|
||||
class VertexArity7: public G<VertexArity6<BVT,BET,BFT,BTT, A, B, C, D, E, F> > {};
|
||||
|
||||
template <class BVT, class BET, typename BFT,class BTT,
|
||||
template <typename> class A, template <typename> class B,
|
||||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E, template <typename> class F,
|
||||
template <typename> class G, template <typename> class H>
|
||||
class VertexArity8: public H<VertexArity7<BVT,BET,BFT,BTT, A, B, C, D, E, F, G > > {};
|
||||
|
||||
/* The Real Big Vertex class;
|
||||
|
||||
The class __VertexArityMax__ is the one that is the Last to be derived,
|
||||
|
@ -164,8 +187,9 @@ template <class BVT, class BET, typename BFT,class BTT,
|
|||
template <typename> class A, template <typename> class B,
|
||||
template <typename> class C, template <typename> class D,
|
||||
template <typename> class E, template <typename> class F,
|
||||
template <typename> class G>
|
||||
class VertexArityMax: public G<VertexArity6<BVT,BET,BFT,BTT, A, B, C, D, E, F> > {
|
||||
template <typename> class G, template <typename> class H,
|
||||
template <typename> class I>
|
||||
class VertexArityMax: public I<VertexArity8<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H> > {
|
||||
|
||||
// ----- Flags stuff -----
|
||||
public:
|
||||
|
@ -290,22 +314,25 @@ template <class BVT, class BET, class BFT, class BTT,
|
|||
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
||||
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
||||
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
||||
template <typename> class G = DefaultDeriver >
|
||||
class VertexSimp3: public VertexArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G> {};
|
||||
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
||||
template <typename> class I = DefaultDeriver>
|
||||
class VertexSimp3: public VertexArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I> {};
|
||||
|
||||
template <class BVT, class BET, class BFT,
|
||||
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
||||
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
||||
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
||||
template <typename> class G = DefaultDeriver >
|
||||
class VertexSimp2: public VertexArityMax<BVT,BET,BFT,DumTT, A, B, C, D, E, F, G> {};
|
||||
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
||||
template <typename> class I = DefaultDeriver>
|
||||
class VertexSimp2: public VertexArityMax<BVT,BET,BFT,DumTT, A, B, C, D, E, F, G, H, I> {};
|
||||
|
||||
template <class BVT, class BET,
|
||||
template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
|
||||
template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
|
||||
template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
|
||||
template <typename> class G = DefaultDeriver >
|
||||
class VertexSimp1: public VertexArityMax<BVT,BET,DumFT,DumTT, A, B, C, D, E, F, G> {};
|
||||
template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
|
||||
template <typename> class I = DefaultDeriver>
|
||||
class VertexSimp1: public VertexArityMax<BVT,BET,DumFT,DumTT, A, B, C, D, E, F, G, H, I> {};
|
||||
|
||||
}// end namespace
|
||||
#endif
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.25 2008/02/05 10:11:34 cignoni
|
||||
A small typo (a T:: instead of TT::)
|
||||
|
||||
Revision 1.24 2008/02/04 21:26:49 ganovelli
|
||||
added ImportLocal which imports all local attributes into vertexplus and faceplus.
|
||||
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
|
||||
|
@ -72,7 +75,7 @@ Revision 1.11 2005/11/01 18:17:52 cignoni
|
|||
Added an assert(0) in all the accesses to empty components
|
||||
|
||||
Revision 1.10 2005/10/15 16:24:10 ganovelli
|
||||
Working release (compilata solo su MSVC), component_occ è migrato da component_opt
|
||||
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
|
||||
|
||||
Revision 1.9 2005/10/14 13:30:07 cignoni
|
||||
Added constant access functions and reflective functions (HasSomething stuff)
|
||||
|
@ -362,6 +365,108 @@ template <class TT> class Qualityd: public Quality<double, TT> {
|
|||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
|
||||
};
|
||||
|
||||
/*-------------------------- Curvature ----------------------------------*/
|
||||
|
||||
template <class TT> class EmptyCurvature: public TT {
|
||||
public:
|
||||
typedef vcg::Point2<float> CurvatureType;
|
||||
|
||||
float &H() {static float dummy = 0.f; return dummy;;}
|
||||
float &K() { static float dummy = 0.f; return dummy;}
|
||||
const float &cH() const {static float dummy = 0.f; return dummy;;}
|
||||
const float &cK()const { static float dummy = 0.f; return dummy;}
|
||||
void SetHK(const float & h,const float & k) { }
|
||||
|
||||
static bool HasCurvatureOcc() { return false; }
|
||||
static bool HasCurvatureOcf() { return false; }
|
||||
static bool HasCurvature() { return false; }
|
||||
static void Name(std::vector<std::string> & name){TT::Name(name);}
|
||||
};
|
||||
|
||||
template <class A, class TT> class Curvature: public TT {
|
||||
public:
|
||||
typedef Point2<A> CurvatureType;
|
||||
typedef typename CurvatureType::ScalarType ScalarType;
|
||||
ScalarType &H(){ return _hk[0];}
|
||||
ScalarType &K(){ return _hk[1];}
|
||||
const ScalarType &cH() const { return _hk[0];}
|
||||
const ScalarType &cK() const { return _hk[1];}
|
||||
|
||||
static bool HasCurvature() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
|
||||
|
||||
private:
|
||||
Point2<A> _hk;
|
||||
};
|
||||
|
||||
|
||||
template <class T> class Curvaturef: public Curvature< float, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvaturef"));T::Name(name);}
|
||||
};
|
||||
template <class T> class Curvatured: public Curvature<double , T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvatured"));T::Name(name);}
|
||||
};
|
||||
|
||||
/*-------------------------- Curvature Direction ----------------------------------*/
|
||||
|
||||
template <class S>
|
||||
struct CurvatureDirType{
|
||||
typedef Point3<S> VecType;
|
||||
typedef S ScalarType;
|
||||
CurvatureDirType () {}
|
||||
Point3<S>max_dir,min_dir; // max and min curvature direction
|
||||
S k1,k2;// max and min curvature values
|
||||
};
|
||||
|
||||
template <class TT> class EmptyCurvatureDir: public TT {
|
||||
public:
|
||||
typedef CurvatureDirType<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;}
|
||||
|
||||
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;}
|
||||
|
||||
static bool HasCurvatureDir() { return false; }
|
||||
static void Name(std::vector<std::string> & name){TT::Name(name);}
|
||||
};
|
||||
|
||||
template <class A, class TT> class CurvatureDir: public TT {
|
||||
public:
|
||||
typedef A CurvatureDirType;
|
||||
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;}
|
||||
|
||||
ScalarType &K1(){ return _curv.k1;}
|
||||
ScalarType &K2(){ return _curv.k2;}
|
||||
const ScalarType &cK1() const {return _curv.k1;}
|
||||
const ScalarType &cK2()const {return _curv.k2;}
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
|
||||
template <class T> class CurvatureDirf: public CurvatureDir<CurvatureDirType<float>, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
|
||||
};
|
||||
template <class T> class CurvatureDird: public CurvatureDir<CurvatureDirType<double>, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
|
||||
};
|
||||
|
||||
/*----------------------------- VFADJ ------------------------------*/
|
||||
|
||||
|
||||
|
|
|
@ -24,8 +24,11 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.2 2007/03/12 15:37:21 tarini
|
||||
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
|
||||
|
||||
Revision 1.1 2005/10/15 16:24:10 ganovelli
|
||||
Working release (compilata solo su MSVC), component_occ è migrato da component_opt
|
||||
Working release (compilata solo su MSVC), component_occ <EFBFBD> migrato da component_opt
|
||||
|
||||
|
||||
|
||||
|
@ -51,6 +54,7 @@ template <class A, class T> class CoordOcc: public T {
|
|||
public:
|
||||
typedef A CoordType;
|
||||
typedef typename CoordType::ScalarType ScalarType;
|
||||
typedef typename T::VertType VertType;
|
||||
CoordType &P() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
||||
CoordType &UberP() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
|
||||
};
|
||||
|
@ -63,6 +67,7 @@ template <class T> class Coord3dOcc: public CoordOcc<vcg::Point3d, T> {};
|
|||
template <class A, class T> class NormalOcc: public T {
|
||||
public:
|
||||
typedef A NormalType;
|
||||
typedef typename T::VertType VertType;
|
||||
NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
|
||||
/*private:
|
||||
NormalType _norm; */
|
||||
|
@ -74,11 +79,13 @@ template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
|
|||
|
||||
/*-------------------------- TEXCOORD ----------------------------------------*/
|
||||
|
||||
template <class A, class T> class TexCoordOcc: public T {
|
||||
template <class A, class TT> class TexCoordOcc: public TT {
|
||||
public:
|
||||
typedef A TexCoordType;
|
||||
typedef typename TT::VertType VertType;
|
||||
TexCoordType &T() {return CAT< vector_occ<VertType>,TexCoordType>::Instance()->Get((VertType*)this); }
|
||||
static bool HasTexCoord() { return true; }
|
||||
static bool HasTexCoordOcc() { return true; }
|
||||
|
||||
/* private:
|
||||
TexCoordType _t; */
|
||||
|
@ -92,11 +99,13 @@ template <class T> class TexCoord2dOcc: public TexCoordOcc<TexCoord2<double,1>,
|
|||
|
||||
template <class T> class FlagOcc: public T {
|
||||
public:
|
||||
typedef typename T::VertType VertType;
|
||||
int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
|
||||
const int Flags() const {return _flags; }
|
||||
/*
|
||||
private:
|
||||
int _flags; */
|
||||
const int Flags() const {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
|
||||
static bool HasFlags() {return true;}
|
||||
static bool HasFlagsOcc() {return true;}
|
||||
|
||||
|
||||
};
|
||||
|
||||
///*-------------------------- COLOR ----------------------------------*/
|
||||
|
@ -104,6 +113,7 @@ private:
|
|||
template <class A, class T> class ColorOcc: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
typedef typename T::VertType VertType;
|
||||
ColorType &C() { return CAT< vector_occ<VertType>,ColorType>::Instance()->Get((VertType*)this); }
|
||||
static bool HasColor() { return true; }
|
||||
/*private:
|
||||
|
@ -117,6 +127,7 @@ template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
|
|||
template <class A, class T> class QualityOcc: public T {
|
||||
public:
|
||||
typedef A QualityType;
|
||||
typedef typename T::VertType VertType;
|
||||
QualityType &Q() { return CAT< vector_occ<VertType>,QualityType>::Instance()->Get((VertType*)this);}
|
||||
static bool HasQuality() { return true; }
|
||||
|
||||
|
@ -128,11 +139,92 @@ template <class T> class QualitysOcc: public QualityOcc<short, T> {};
|
|||
template <class T> class QualityfOcc: public QualityOcc<float, T> {};
|
||||
template <class T> class QualitydOcc: public QualityOcc<double, T> {};
|
||||
//
|
||||
|
||||
///*-------------------------- Curvature ----------------------------------*/
|
||||
|
||||
template <class A, class TT> class CurvatureOcc: public TT {
|
||||
public:
|
||||
typedef Point2<A> CurvatureTypeOcc;
|
||||
typedef typename TT::VertType VertType;
|
||||
typedef typename CurvatureTypeOcc::ScalarType ScalarType;
|
||||
|
||||
ScalarType &H(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
|
||||
ScalarType &K(){ return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
|
||||
const ScalarType &cH() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];}
|
||||
const ScalarType &cK() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
|
||||
|
||||
template <class LeftV>
|
||||
void ImportLocal(const LeftV & leftV){
|
||||
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH();
|
||||
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK();
|
||||
TT::ImporLocal(leftV);
|
||||
}
|
||||
|
||||
static bool HasCurvature() { return true; }
|
||||
static bool HasCurvatureOcc() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcc"));TT::Name(name);}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
template <class T> class CurvaturefOcc: public CurvatureOcc<float, T> {
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcc"));T::Name(name);}
|
||||
};
|
||||
template <class T> class CurvaturedOcc: public CurvatureOcc<double, T> {
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturedOcc"));T::Name(name);}
|
||||
};
|
||||
|
||||
|
||||
/*-------------------------- Curvature Direction ----------------------------------*/
|
||||
|
||||
template <class S>
|
||||
struct CurvatureDirTypeOcc{
|
||||
typedef Point3<S> VecType;
|
||||
typedef S ScalarType;
|
||||
CurvatureDirTypeOcc () {}
|
||||
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 CurvatureDirOcc: public TT {
|
||||
public:
|
||||
typedef A CurvatureDirTypeOcc;
|
||||
typedef typename CurvatureDirTypeOcc::VecType VecType;
|
||||
typedef typename CurvatureDirTypeOcc::ScalarType ScalarType;
|
||||
typedef typename TT::VertType VertType;
|
||||
|
||||
VecType &PD1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
|
||||
VecType &PD2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
|
||||
const VecType &cPD1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
|
||||
const VecType &cPD2() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
|
||||
|
||||
ScalarType &K1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
|
||||
ScalarType &K2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
|
||||
const ScalarType &cK1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
|
||||
const ScalarType &cK2()const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
|
||||
|
||||
static bool HasCurvatureDir() { return true; }
|
||||
static bool HasCurvatureDirOcc() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
|
||||
|
||||
};
|
||||
|
||||
|
||||
template <class T> class CurvatureDirfOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<float>, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
|
||||
};
|
||||
template <class T> class CurvatureDirdOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<double>, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
|
||||
};
|
||||
|
||||
///*----------------------------- VFADJ ------------------------------*/
|
||||
|
||||
template <class T> class VFAdjOcc: public T {
|
||||
public:
|
||||
typename T::FacePointer &Fp() {return CAT< vector_occ<VertType>,T::FacePointer>::Instance()->Get((VertType*)this); }
|
||||
typedef typename T::VertType VertType;
|
||||
typedef typename T::FacePointer FacePointer;
|
||||
FacePointer &Fp() {return CAT< vector_occ<VertType>,FacePointer>::Instance()->Get((VertType*)this); }
|
||||
int &Zp() {return _zp; }
|
||||
static bool HasVFAdjacency() { return true; }
|
||||
private:
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
History
|
||||
|
||||
$Log: not supported by cvs2svn $
|
||||
Revision 1.14 2008/03/11 09:22:07 cignoni
|
||||
Completed the garbage collecting functions CompactVertexVector and CompactFaceVector.
|
||||
|
||||
Revision 1.13 2008/02/05 20:42:43 cignoni
|
||||
Other small typos
|
||||
|
||||
|
@ -103,6 +106,8 @@ public:
|
|||
ColorEnabled=false;
|
||||
NormalEnabled=false;
|
||||
VFAdjacencyEnabled=false;
|
||||
CurvatureEnabled = false;
|
||||
|
||||
}
|
||||
|
||||
// override di tutte le funzioni che possono spostare
|
||||
|
@ -216,6 +221,30 @@ void DisableVFAdjacency() {
|
|||
}
|
||||
|
||||
|
||||
void EnableCurvature() {
|
||||
assert(VALUE_TYPE::HasCurvatureOcf());
|
||||
CurvatureEnabled=true;
|
||||
CuV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableCurvature() {
|
||||
assert(VALUE_TYPE::HasCurvatureOcf());
|
||||
CurvatureEnabled=false;
|
||||
CuV.clear();
|
||||
}
|
||||
|
||||
void EnableCurvatureDir() {
|
||||
assert(VALUE_TYPE::HasCurvatureDirOcf());
|
||||
CurvatureDirEnabled=true;
|
||||
CuDV.resize((*this).size());
|
||||
}
|
||||
|
||||
void DisableCurvatureDir() {
|
||||
assert(VALUE_TYPE::HasCurvatureDirOcf());
|
||||
CurvatureDirEnabled=false;
|
||||
CuDV.clear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct VFAdjType {
|
||||
|
@ -225,6 +254,8 @@ struct VFAdjType {
|
|||
|
||||
public:
|
||||
std::vector<typename VALUE_TYPE::QualityType> QV;
|
||||
std::vector<typename VALUE_TYPE::CurvatureType> CuV;
|
||||
std::vector<typename VALUE_TYPE::CurvatureDirType> CuDV;
|
||||
std::vector<typename VALUE_TYPE::ColorType> CV;
|
||||
std::vector<typename VALUE_TYPE::NormalType> NV;
|
||||
std::vector<struct VFAdjType> AV;
|
||||
|
@ -233,6 +264,9 @@ public:
|
|||
bool ColorEnabled;
|
||||
bool NormalEnabled;
|
||||
bool VFAdjacencyEnabled;
|
||||
bool CurvatureEnabled;
|
||||
bool CurvatureDirEnabled;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -246,17 +280,17 @@ template <class T> class VFAdjOcf: public T {
|
|||
public:
|
||||
typename T::FacePointer &VFp() {
|
||||
assert((*this).Base().VFAdjacencyEnabled);
|
||||
return (*this).Base().AV[(*this).Index()()]._fp;
|
||||
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;
|
||||
else return (*this).Base().AV[(*this).Index()]._fp;
|
||||
}
|
||||
|
||||
int &VFi() {
|
||||
assert((*this).Base().VFAdjacencyEnabled);
|
||||
return (*this).Base().AV[(*this).Index()()]._zp;
|
||||
return (*this).Base().AV[(*this).Index()]._zp;
|
||||
}
|
||||
template <class LeftV>
|
||||
void ImportLocal(const LeftV & leftV){VFp() = NULL; VFi() = -1; T::ImporLocal(leftV);}
|
||||
|
@ -297,8 +331,8 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
|
|||
template <class A, class T> class ColorOcf: public T {
|
||||
public:
|
||||
typedef A ColorType;
|
||||
ColorType &C() { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()()]; }
|
||||
const ColorType &cC() const { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()()]; }
|
||||
ColorType &C() { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()]; }
|
||||
const ColorType &cC() const { assert((*this).Base().NormalEnabled); return (*this).Base().CV[(*this).Index()]; }
|
||||
template <class LeftV>
|
||||
void ImportLocal(const LeftV & leftV){ C() = leftV.cC(); T::ImporLocal(leftV);}
|
||||
static bool HasColor() { return true; }
|
||||
|
@ -312,7 +346,7 @@ template <class T> class Color4bOcf: public ColorOcf<vcg::Color4b, T> {};
|
|||
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()]; }
|
||||
template <class LeftV>
|
||||
void ImportLocal(const LeftV & leftV){ Q() = leftV.cQ(); T::ImporLocal(leftV);}
|
||||
static bool HasQuality() { return true; }
|
||||
|
@ -322,6 +356,75 @@ public:
|
|||
template <class T> class QualityfOcf: public QualityOcf<float, T> {};
|
||||
|
||||
|
||||
///*-------------------------- CURVATURE ----------------------------------*/
|
||||
|
||||
template <class A, class TT> class CurvatureOcf: public TT {
|
||||
public:
|
||||
typedef Point2<A> CurvatureType;
|
||||
typedef typename CurvatureType::ScalarType ScalarType;
|
||||
|
||||
ScalarType &H(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
|
||||
ScalarType &K(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
|
||||
const ScalarType &cH() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
|
||||
const ScalarType &cK() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
|
||||
|
||||
template <class LeftV>
|
||||
void ImportLocal(const LeftV & leftV){
|
||||
(*this).Base().CuV[(*this).Index()][0] = leftV.cH();
|
||||
(*this).Base().CuV[(*this).Index()][1] = leftV.cK(); TT::ImporLocal(leftV);}
|
||||
|
||||
static bool HasCurvatureOcf() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcf"));TT::Name(name);}
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
template <class T> class CurvaturefOcf: public CurvatureOcf<float, T> {};
|
||||
template <class T> class CurvaturedOcf: public CurvatureOcf<double, T> {};
|
||||
|
||||
|
||||
///*-------------------------- CURVATURE DIR ----------------------------------*/
|
||||
|
||||
template <class S>
|
||||
struct CurvatureDirTypeOcf{
|
||||
typedef Point3<S> VecType;
|
||||
typedef S ScalarType;
|
||||
CurvatureDirTypeOcf () {}
|
||||
Point3<S>max_dir,min_dir;
|
||||
S k1,k2;
|
||||
};
|
||||
|
||||
|
||||
template <class A, class TT> class CurvatureDirOcf: public TT {
|
||||
public:
|
||||
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()].max_dir;}
|
||||
const VecType &cPD1() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuV[(*this).Index()].max_dir;}
|
||||
const VecType &cPD2() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuV[(*this).Index()].max_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;}
|
||||
|
||||
static bool HasCurvatureDirOcf() { return true; }
|
||||
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
|
||||
|
||||
private:
|
||||
CurvatureDirType _curv;
|
||||
};
|
||||
|
||||
|
||||
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);}
|
||||
};
|
||||
template <class T> class CurvatureDirdOcf: public CurvatureDirOcf<CurvatureDirTypeOcf<double>, T> {
|
||||
public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirdOcf"));T::Name(name);}
|
||||
};
|
||||
///*-------------------------- InfoOpt ----------------------------------*/
|
||||
|
||||
template < class T> class InfoOcf: public T {
|
||||
|
|
Loading…
Reference in New Issue