From 0aac58999664d93b077080373edcc4aed348d3db Mon Sep 17 00:00:00 2001 From: Paolo Cignoni Date: Fri, 29 Oct 2021 14:26:00 +0200 Subject: [PATCH] removed useless HG components from the vertex component set Replaced by much simpler attributes --- vcg/complex/base.h | 3 -- vcg/simplex/vertex/component.h | 49 ------------------------------ vcg/simplex/vertex/component_ocf.h | 44 --------------------------- 3 files changed, 96 deletions(-) diff --git a/vcg/complex/base.h b/vcg/complex/base.h index befda76c..b59e26e6 100644 --- a/vcg/complex/base.h +++ b/vcg/complex/base.h @@ -666,7 +666,6 @@ template < class VertexType> bool VertexVectorHasPerVertexColor (const std template < class VertexType> bool VertexVectorHasPerVertexMark (const std::vector &) { return VertexType::HasMark (); } template < class VertexType> bool VertexVectorHasPerVertexFlags (const std::vector &) { return VertexType::HasFlags (); } template < class VertexType> bool VertexVectorHasPerVertexRadius (const std::vector &) { return VertexType::HasRadius (); } -template < class VertexType> bool VertexVectorHasPerVertexCurvature (const std::vector &) { return VertexType::HasCurvature (); } template < class VertexType> bool VertexVectorHasPerVertexCurvatureDir(const std::vector &) { return VertexType::HasCurvatureDir(); } template < class VertexType> bool VertexVectorHasPerVertexTexCoord (const std::vector &) { return VertexType::HasTexCoord (); } @@ -676,7 +675,6 @@ template < class TriMeshType> bool HasPerVertexColor (const TriMeshType &m template < class TriMeshType> bool HasPerVertexMark (const TriMeshType &m) { return tri::VertexVectorHasPerVertexMark (m.vert); } template < class TriMeshType> bool HasPerVertexFlags (const TriMeshType &m) { return tri::VertexVectorHasPerVertexFlags (m.vert); } template < class TriMeshType> bool HasPerVertexRadius (const TriMeshType &m) { return tri::VertexVectorHasPerVertexRadius (m.vert); } -template < class TriMeshType> bool HasPerVertexCurvature (const TriMeshType &m) { return tri::VertexVectorHasPerVertexCurvature (m.vert); } template < class TriMeshType> bool HasPerVertexCurvatureDir(const TriMeshType &m) { return tri::VertexVectorHasPerVertexCurvatureDir(m.vert); } template < class TriMeshType> bool HasPerVertexTexCoord (const TriMeshType &m) { return tri::VertexVectorHasPerVertexTexCoord (m.vert); } @@ -877,7 +875,6 @@ template void RequirePerVertexColor (const MeshType &m) { template void RequirePerVertexMark (const MeshType &m) { if(!tri::HasPerVertexMark (m)) throw vcg::MissingComponentException("PerVertexMark "); } template void RequirePerVertexFlags (const MeshType &m) { if(!tri::HasPerVertexFlags (m)) throw vcg::MissingComponentException("PerVertexFlags "); } template void RequirePerVertexRadius (const MeshType &m) { if(!tri::HasPerVertexRadius (m)) throw vcg::MissingComponentException("PerVertexRadius "); } -template void RequirePerVertexCurvature (const MeshType &m) { if(!tri::HasPerVertexCurvature (m)) throw vcg::MissingComponentException("PerVertexCurvature "); } template void RequirePerVertexCurvatureDir(const MeshType &m) { if(!tri::HasPerVertexCurvatureDir(m)) throw vcg::MissingComponentException("PerVertexCurvatureDir"); } template void RequirePerVertexTexCoord (const MeshType &m) { if(!tri::HasPerVertexTexCoord (m)) throw vcg::MissingComponentException("PerVertexTexCoord "); } diff --git a/vcg/simplex/vertex/component.h b/vcg/simplex/vertex/component.h index dab25640..37f27f93 100644 --- a/vcg/simplex/vertex/component.h +++ b/vcg/simplex/vertex/component.h @@ -158,15 +158,8 @@ public: static bool HasVHAdjacency() { return false; } typedef float CurScalarType; - typedef float ScalarTypeCur; typedef Point3f CurVecType; 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 Kh() const { static float dummy = 0.f; assert(0); return dummy;} - float Kg() const { 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 CurvatureDirType; CurVecType &PD1() {static CurVecType v(0,0,0); assert(0);return v;} @@ -183,9 +176,7 @@ public: CurScalarType cK1() const {static ScalarType v = 0.0;assert(0);return v;} CurScalarType cK2() const {static ScalarType v = 0.0;assert(0);return v;} - static bool HasCurvature() { return false; } static bool HasCurvatureDir() { return false; } - inline bool IsCurvatureEnabled() const { return TT::VertexType::HasCurvature();} inline bool IsCurvatureDirEnabled() const { return TT::VertexType::HasCurvatureDir();} template < class RightValueType> @@ -428,46 +419,6 @@ template class Qualityd: public Quality { public: static void Name(std::vector & name){name.push_back(std::string("Qualityd"));TT::Name(name);} }; - /*-------------------------- Curvature ----------------------------------*/ - - /*! \brief \em Component: Per vertex basic \b curvature - This component keeps the mean an gaussian curvature for a vertex. Used by some of the algorithms of vcg::tri::UpdateCurvature to store the computed curvatures. - */ - template class Curvature: public TT { - public: - typedef Point2 CurvatureType; - typedef typename CurvatureType::ScalarType ScalarTypeCur; - const ScalarTypeCur &Kh() const { return _hk[0]; } - const ScalarTypeCur &Kg() const { return _hk[1]; } - ScalarTypeCur &Kh() { return _hk[0]; } - ScalarTypeCur &Kg() { return _hk[1]; } - ScalarTypeCur cKh() const { return _hk[0]; } - ScalarTypeCur cKg() const { return _hk[1]; } - - template < class RightValueType> - void ImportData(const RightValueType & rVert ) { - if(rVert.IsCurvatureEnabled()) { - Kh() = rVert.cKh(); - Kg() = rVert.cKg(); - } - TT::ImportData( rVert); - } - - static bool HasCurvature() { 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 ----------------------------------*/ /*! \brief \em Component: Per vertex \b curvature \b directions diff --git a/vcg/simplex/vertex/component_ocf.h b/vcg/simplex/vertex/component_ocf.h index 8750066c..4ad90edb 100644 --- a/vcg/simplex/vertex/component_ocf.h +++ b/vcg/simplex/vertex/component_ocf.h @@ -432,50 +432,6 @@ public: }; -///*-------------------------- CURVATURE ----------------------------------*/ - -template class CurvatureOcf: public TT { -public: - typedef Point2 CurvatureType; - typedef typename CurvatureType::ScalarType ScalarTypeCur; - - ScalarTypeCur &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0]; } - ScalarTypeCur &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1]; } - ScalarTypeCur cKh() const - { - assert((*this).Base().CurvatureEnabled); - return (*this).Base().CuV[(*this).Index()][0]; - } - - ScalarTypeCur cKg() const - { - assert((*this).Base().CurvatureEnabled); - return (*this).Base().CuV[(*this).Index()][1]; - } - - template - void ImportData(const RightVertexType & rightV){ - if((*this).IsCurvatureEnabled() && rightV.IsCurvatureEnabled()) - { - (*this).Base().CuV[(*this).Index()][0] = rightV.cKh(); - (*this).Base().CuV[(*this).Index()][1] = rightV.cKg(); - } - TT::ImportData(rightV); - } - - inline bool IsCurvatureEnabled( ) const - { - return this->Base().IsCurvatureEnabled(); - } - - static bool HasCurvature() { return true; } - static bool HasCurvatureOcf() { return true; } -}; - -template class CurvaturefOcf: public CurvatureOcf {public: static void Name(std::vector & name){name.push_back(std::string("CurvaturefOcf"));T::Name(name);} }; -template class CurvaturedOcf: public CurvatureOcf {public: static void Name(std::vector & name){name.push_back(std::string("CurvaturedOcf"));T::Name(name);} }; - - ///*-------------------------- CURVATURE DIR ----------------------------------*/ template