added missing functions

IsCurvatureDirEnabled
EnableCurvatureDir

and debugged CurvatureDirTypeOcf, which
returned wrong values and [MAJOR] wasted
8 floats per vertex every time it was included in the type (enabled or not)
This commit is contained in:
ganovelli 2008-10-24 09:54:23 +00:00
parent 3a5b6ed2f3
commit d5113f6204
1 changed files with 18 additions and 4 deletions

View File

@ -277,7 +277,7 @@ void DisableVFAdjacency() {
AV.clear();
}
bool IsCurvatureEnabled() const {return CurvatureEnabled;}
void EnableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=true;
@ -290,6 +290,7 @@ void DisableCurvature() {
CuV.clear();
}
bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;}
void EnableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=true;
@ -525,9 +526,9 @@ public:
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;}
VecType &PD2(){ assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_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;}
const VecType &cPD2() const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuV[(*this).Index()].min_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;}
@ -538,7 +539,6 @@ public:
static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirOcf"));TT::Name(name);}
private:
CurvatureDirType _curv;
};
@ -613,6 +613,20 @@ namespace tri
else return VertexType::HasQuality();
}
template < class VertexType, class FaceContainerType >
bool HasPerVertexCurvature (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType > & m)
{
if(VertexType::HasCurvatureOcf()) return m.vert.IsCurvatureEnabled();
else return VertexType::HasCurvature();
}
template < class VertexType, class FaceContainerType >
bool HasPerVertexCurvatureDir (const TriMesh < vertex::vector_ocf< VertexType > , FaceContainerType > & m)
{
if(VertexType::HasCurvatureDirOcf()) return m.vert.IsCurvatureDirEnabled();
else return VertexType::HasCurvatureDir();
}
template < class VertexType >
void ReorderVert( std::vector<size_t> &newVertIndex, vertex::vector_ocf< VertexType > &vertVec)
{