From 749f67c3b605a39eb9fe717833c02ebdc93c46a3 Mon Sep 17 00:00:00 2001 From: ganovelli Date: Wed, 28 Mar 2012 11:56:10 +0000 Subject: [PATCH] added curvature direction --- vcg/simplex/vertex/component.h | 73 ++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 34 deletions(-) diff --git a/vcg/simplex/vertex/component.h b/vcg/simplex/vertex/component.h index add544d6..63e12a8f 100644 --- a/vcg/simplex/vertex/component.h +++ b/vcg/simplex/vertex/component.h @@ -36,41 +36,16 @@ All the Components that can be added to a vertex should be defined in the namesp */ - /*-------------------------- Curvature ----------------------------------*/ + /*------------------------- Base Classes -----------------------------------------*/ - template - struct CurvatureDirBaseType{ - typedef Point3 VecType; - typedef S ScalarType; - CurvatureDirBaseType () {} - Point3max_dir,min_dir; // max and min curvature direction - S k1,k2;// max and min curvature values - }; - - template class Curvature: public TT { - public: - typedef Point2 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];} - - static bool HasCurvature() { return true; } - static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; } - static void Name(std::vector & name){name.push_back(std::string("Curvature"));TT::Name(name);} - - private: - Point2 _hk; - }; - - - template class Curvaturef: public Curvature< float, T> { - public: static void Name(std::vector & name){name.push_back(std::string("Curvaturef"));T::Name(name);} - }; - template class Curvatured: public Curvature { - public: static void Name(std::vector & name){name.push_back(std::string("Curvatured"));T::Name(name);} - }; + template + struct CurvatureDirBaseType{ + typedef Point3 VecType; + typedef S ScalarType; + CurvatureDirBaseType () {} + Point3max_dir,min_dir; // max and min curvature direction + S k1,k2;// max and min curvature values + }; /*------------------------- EMPTY CORE COMPONENTS -----------------------------------------*/ @@ -350,6 +325,34 @@ template class Qualityd: public Quality { public: static void Name(std::vector & name){name.push_back(std::string("Qualityd"));TT::Name(name);} }; + /*-------------------------- Curvature ----------------------------------*/ + + + + template class Curvature: public TT { + public: + typedef Point2 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];} + + static bool HasCurvature() { return true; } + static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; } + static void Name(std::vector & name){name.push_back(std::string("Curvature"));TT::Name(name);} + + private: + Point2 _hk; + }; + + + template class Curvaturef: public Curvature< float, T> { + public: static void Name(std::vector & name){name.push_back(std::string("Curvaturef"));T::Name(name);} + }; + template class Curvatured: public Curvature { + public: static void Name(std::vector & name){name.push_back(std::string("Curvatured"));T::Name(name);} + }; /*-------------------------- Curvature Direction ----------------------------------*/ @@ -508,6 +511,8 @@ private: int _zp ; }; + + } // end namespace vert }// end namespace vcg #endif