Cleaned up names, now Kg() gives back Gaussian Curvature (k1*k2), while Kh() gives back Mean Curvature 1/2(k1+k2)

This commit is contained in:
Paolo Cignoni 2008-04-04 10:26:12 +00:00
parent 89a4321cdf
commit 46096f6b64
3 changed files with 34 additions and 25 deletions

View File

@ -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 <vcg/simplex/face/pos.h>
#include <vcg/simplex/face/jumping_pos.h>
#include <vcg/container/simple_temporary_data.h>
#include <vcg/complex/trimesh/update/normal.h>
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<float>::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;
}
}

View File

@ -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 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) { }
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 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];}
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<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}

View File

@ -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<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];}
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 <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);}
(*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<std::string> & name){name.push_back(std::string("CurvatureOcf"));TT::Name(name);}