From 46096f6b64fb7e948edfde0220136f4919e32d8c Mon Sep 17 00:00:00 2001 From: cignoni Date: Fri, 4 Apr 2008 10:26:12 +0000 Subject: [PATCH] Cleaned up names, now Kg() gives back Gaussian Curvature (k1*k2), while Kh() gives back Mean Curvature 1/2(k1+k2) --- vcg/complex/trimesh/update/curvature.h | 24 ++++++++++++++---------- vcg/simplex/vertexplus/component.h | 20 +++++++++++--------- vcg/simplex/vertexplus/component_ocf.h | 15 +++++++++------ 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/vcg/complex/trimesh/update/curvature.h b/vcg/complex/trimesh/update/curvature.h index 07654163..c3f6c622 100644 --- a/vcg/complex/trimesh/update/curvature.h +++ b/vcg/complex/trimesh/update/curvature.h @@ -23,6 +23,9 @@ /**************************************************************************** History $Log: not supported by cvs2svn $ +Revision 1.5 2008/03/25 11:00:56 ganovelli +fixed bugs sign of principal direction and mean curvature value + Revision 1.4 2008/03/17 11:29:59 ganovelli taubin and desbrun estimates added (-> see vcg/simplex/vertexplus/component.h [component_ocf.h|component_occ.h ] @@ -49,6 +52,7 @@ the vertex #include #include #include +#include namespace vcg { namespace tri { @@ -289,8 +293,8 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer { (TDAreaPtr)[*vi].A = 0.0; (TDContr)[*vi] =typename MeshType::CoordType(0.0,0.0,0.0); - (*vi).H() = 0.0; - (*vi).K() = (float)(2.0 * M_PI); + (*vi).Kh() = 0.0; + (*vi).Kg() = (float)(2.0 * M_PI); } for(fi=m.face.begin();fi!=m.face.end();++fi) if( !(*fi).IsD()) @@ -337,9 +341,9 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer TDContr[(*fi).V(1)] += ( e01v * (1.0/tan(angle2)) - e12v * (1.0/tan(angle0)) ) / 4.0; TDContr[(*fi).V(2)] += ( e12v * (1.0/tan(angle0)) - e20v * (1.0/tan(angle1)) ) / 4.0; - (*fi).V(0)->K() -= angle0; - (*fi).V(1)->K() -= angle1; - (*fi).V(2)->K() -= angle2; + (*fi).V(0)->Kg() -= angle0; + (*fi).V(1)->Kg() -= angle1; + (*fi).V(2)->Kg() -= angle2; for(int i=0;i<3;i++) @@ -355,7 +359,7 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer hp1.FlipV(); hp1.NextB(); e2=hp1.v->cP() - hp.v->cP(); - (*fi).V(i)->K() -= math::Abs(Angle(e1,e2)); + (*fi).V(i)->Kg() -= math::Abs(Angle(e1,e2)); } } } @@ -364,13 +368,13 @@ Discrete Differential-Geometry Operators for Triangulated 2-Manifolds Mark Meyer { if((TDAreaPtr)[*vi].A<=std::numeric_limits::epsilon()) { - (*vi).H() = 0; - (*vi).K() = 0; + (*vi).Kh() = 0; + (*vi).Kg() = 0; } else { - (*vi).H() = (((TDContr)[*vi]* (*vi).cN()>0)?1.0:-1.0)*((TDContr)[*vi] / (TDAreaPtr) [*vi].A).Norm(); - (*vi).K() /= (TDAreaPtr)[*vi].A; + (*vi).Kh() = (((TDContr)[*vi]* (*vi).cN()>0)?1.0:-1.0)*((TDContr)[*vi] / (TDAreaPtr) [*vi].A).Norm(); + (*vi).Kg() /= (TDAreaPtr)[*vi].A; } } diff --git a/vcg/simplex/vertexplus/component.h b/vcg/simplex/vertexplus/component.h index a2e93c91..7c1f4b9e 100644 --- a/vcg/simplex/vertexplus/component.h +++ b/vcg/simplex/vertexplus/component.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.27 2008/04/03 23:12:28 cignoni +compacted two pair of empty components to shorten derivation chains + Revision 1.26 2008/03/17 11:39:14 ganovelli added curvature and curvatruredir (compiled .net 2005 and gcc) @@ -365,11 +368,10 @@ template class EmptyCurvature: public TT { public: typedef vcg::Point2 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) { } + float &Kh() {static float dummy = 0.f; return dummy;;} + float &Kg() { static float dummy = 0.f; return dummy;} + const float &cKh() const {static float dummy = 0.f; return dummy;;} + const float &cKg()const { static float dummy = 0.f; return dummy;} static bool HasCurvatureOcc() { return false; } static bool HasCurvatureOcf() { return false; } @@ -381,10 +383,10 @@ template class Curvature: public TT { public: typedef Point2 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];} + 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 void Name(std::vector & name){name.push_back(std::string("Curvature"));TT::Name(name);} diff --git a/vcg/simplex/vertexplus/component_ocf.h b/vcg/simplex/vertexplus/component_ocf.h index 7ddb48a2..ce4fb690 100644 --- a/vcg/simplex/vertexplus/component_ocf.h +++ b/vcg/simplex/vertexplus/component_ocf.h @@ -24,6 +24,9 @@ History $Log: not supported by cvs2svn $ +Revision 1.16 2008/04/03 23:15:40 cignoni +added optional mark and cleaned up some nasty type bugs. + Revision 1.15 2008/03/17 11:39:15 ganovelli added curvature and curvatruredir (compiled .net 2005 and gcc) @@ -421,15 +424,15 @@ public: typedef Point2 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];} + 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];} template void ImportLocal(const LeftV & leftV){ -(*this).Base().CuV[(*this).Index()][0] = leftV.cH(); -(*this).Base().CuV[(*this).Index()][1] = leftV.cK(); TT::ImporLocal(leftV);} +(*this).Base().CuV[(*this).Index()][0] = leftV.cKh(); +(*this).Base().CuV[(*this).Index()][1] = leftV.cKg(); TT::ImporLocal(leftV);} static bool HasCurvatureOcf() { return true; } static void Name(std::vector & name){name.push_back(std::string("CurvatureOcf"));TT::Name(name);}