Cleaned up various type name clashes. There were some components that wrongly re-defined <ScalarType> covering the real <ScalarType> of the simplex. Renamed to something less ambiguous (like CurScalarType for denoting the scalar type used inside curvature types).

This commit is contained in:
Paolo Cignoni 2014-06-19 08:31:51 +00:00
parent 4fbbfe4f86
commit 4198a3bd7c
4 changed files with 189 additions and 190 deletions

View File

@ -217,7 +217,7 @@ class TriMesh
inline int HN() const { return hn; } inline int HN() const { return hn; }
/// Bounding box of the mesh /// Bounding box of the mesh
Box3<ScalarType> bbox; Box3<typename TriMesh::VertexType::CoordType::ScalarType> bbox;
/// Nomi di textures /// Nomi di textures
// //

View File

@ -483,8 +483,8 @@ private:
/*-------------------------- Curvature Direction ----------------------------------*/ /*-------------------------- Curvature Direction ----------------------------------*/
template <class S> template <class S>
struct CurvatureDirBaseType{ struct CurvatureDirBaseType{
typedef Point3<S> VecType; typedef Point3<S> CurVecType;
typedef S ScalarType; typedef S CurScalarType;
CurvatureDirBaseType () {} CurvatureDirBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction Point3<S>max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values S k1,k2;// max and min curvature values
@ -493,18 +493,18 @@ struct CurvatureDirBaseType{
template <class A, class TT> class CurvatureDir: public TT { template <class A, class TT> class CurvatureDir: public TT {
public: public:
typedef A CurvatureDirType; typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::VecType CurVecType;
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::ScalarType CurScalarType;
VecType &PD1() { return _curv.max_dir;} CurVecType &PD1() { return _curv.max_dir;}
VecType &PD2() { return _curv.min_dir;} CurVecType &PD2() { return _curv.min_dir;}
VecType cPD1() const { return _curv.max_dir;} CurVecType cPD1() const { return _curv.max_dir;}
VecType cPD2() const { return _curv.min_dir;} CurVecType cPD2() const { return _curv.min_dir;}
ScalarType &K1() { return _curv.k1;} CurScalarType &K1() { return _curv.k1;}
ScalarType &K2() { return _curv.k2;} CurScalarType &K2() { return _curv.k2;}
ScalarType cK1() const {return _curv.k1;} CurScalarType cK1() const {return _curv.k1;}
ScalarType cK2() const {return _curv.k2;} CurScalarType cK2() const {return _curv.k2;}
template < class RightValueType> template < class RightValueType>
void ImportData(const RightValueType & rightF ) { void ImportData(const RightValueType & rightF ) {
if(rightF.IsCurvatureDirEnabled()) { if(rightF.IsCurvatureDirEnabled()) {

View File

@ -494,59 +494,59 @@ template <class T> class Normal3dOcf: public NormalOcf<vcg::Point3d, T> {};
/*------------------------- CurvatureDir -----------------------------------------*/ /*------------------------- CurvatureDir -----------------------------------------*/
template <class S> template <class S>
struct CurvatureDirOcfBaseType{ struct CurvatureDirOcfBaseType{
typedef Point3<S> VecType; typedef Point3<S> CurVecType;
typedef S ScalarType; typedef S CurScalarType;
CurvatureDirOcfBaseType () {} CurvatureDirOcfBaseType () {}
Point3<S>max_dir,min_dir; // max and min curvature direction CurVecType max_dir,min_dir; // max and min curvature direction
S k1,k2;// max and min curvature values CurScalarType k1,k2;// max and min curvature values
}; };
template <class A, class T> class CurvatureDirOcf: public T { template <class A, class T> class CurvatureDirOcf: public T {
public: public:
typedef A CurvatureDirType; typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::VecType CurVecType;
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::ScalarType CurScalarType;
inline bool IsCurvatureDirEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); } inline bool IsCurvatureDirEnabled( ) const { return this->Base().IsCurvatureDirEnabled(); }
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }
static bool HasCurvatureDirOcf() { return true; } static bool HasCurvatureDirOcf() { return true; }
VecType &PD1() { CurVecType &PD1() {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir; return (*this).Base().CDV[(*this).Index()].max_dir;
} }
VecType &PD2() { CurVecType &PD2() {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir; return (*this).Base().CDV[(*this).Index()].min_dir;
} }
VecType cPD1() const { CurVecType cPD1() const {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].max_dir; return (*this).Base().CDV[(*this).Index()].max_dir;
} }
VecType cPD2() const { CurVecType cPD2() const {
assert((*this).Base().CurvatureDirEnabled); assert((*this).Base().CurvatureDirEnabled);
return (*this).Base().CDV[(*this).Index()].min_dir; return (*this).Base().CDV[(*this).Index()].min_dir;
} }
ScalarType &K1() { CurScalarType &K1() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1; return (*this).Base().CDV[(*this).Index()].k1;
} }
ScalarType &K2() { CurScalarType &K2() {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2; return (*this).Base().CDV[(*this).Index()].k2;
} }
ScalarType cK1() const { CurScalarType cK1() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k1; return (*this).Base().CDV[(*this).Index()].k1;
} }
ScalarType cK2() const { CurScalarType cK2() const {
// you cannot use Normals before enabling them with: yourmesh.face.EnableNormal() // you cannot use Normals before enabling them with: yourmesh.face.EnableNormal()
assert((*this).Base().NormalEnabled); assert((*this).Base().NormalEnabled);
return (*this).Base().CDV[(*this).Index()].k2; return (*this).Base().CDV[(*this).Index()].k2;

View File

@ -35,15 +35,15 @@ compare with OCC(Optional Component Compact)
#endif #endif
namespace vcg { namespace vcg {
namespace vertex { namespace vertex {
/* /*
All the Components that can be added to a vertex should be defined in the namespace vert: All the Components that can be added to a vertex should be defined in the namespace vert:
*/ */
template <class VALUE_TYPE> template <class VALUE_TYPE>
class vector_ocf: public std::vector<VALUE_TYPE> { class vector_ocf: public std::vector<VALUE_TYPE> {
typedef std::vector<VALUE_TYPE> BaseType; typedef std::vector<VALUE_TYPE> BaseType;
typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator; typedef typename vector_ocf<VALUE_TYPE>::iterator ThisTypeIterator;
public: public:
vector_ocf():std::vector<VALUE_TYPE>() vector_ocf():std::vector<VALUE_TYPE>()
@ -79,164 +79,164 @@ public:
void pop_back(); void pop_back();
void resize(const unsigned int & _size) void resize(const unsigned int & _size)
{ {
const unsigned int oldsize = BaseType::size(); const unsigned int oldsize = BaseType::size();
BaseType::resize(_size); BaseType::resize(_size);
if(oldsize<_size){ if(oldsize<_size){
ThisTypeIterator firstnew = BaseType::begin(); ThisTypeIterator firstnew = BaseType::begin();
advance(firstnew,oldsize); advance(firstnew,oldsize);
_updateOVP(firstnew,(*this).end()); _updateOVP(firstnew,(*this).end());
} }
if (ColorEnabled) CV.resize(_size); if (ColorEnabled) CV.resize(_size);
if (QualityEnabled) QV.resize(_size,0); if (QualityEnabled) QV.resize(_size,0);
if (MarkEnabled) MV.resize(_size); if (MarkEnabled) MV.resize(_size);
if (NormalEnabled) NV.resize(_size); if (NormalEnabled) NV.resize(_size);
if (TexCoordEnabled) TV.resize(_size); if (TexCoordEnabled) TV.resize(_size);
if (VFAdjacencyEnabled) AV.resize(_size); if (VFAdjacencyEnabled) AV.resize(_size);
if (CurvatureEnabled) CuV.resize(_size); if (CurvatureEnabled) CuV.resize(_size);
if (CurvatureDirEnabled) CuDV.resize(_size); if (CurvatureDirEnabled) CuDV.resize(_size);
if (RadiusEnabled) RadiusV.resize(_size); if (RadiusEnabled) RadiusV.resize(_size);
} }
void reserve(const unsigned int & _size) void reserve(const unsigned int & _size)
{ {
BaseType::reserve(_size); BaseType::reserve(_size);
if (ColorEnabled) CV.reserve(_size); if (ColorEnabled) CV.reserve(_size);
if (QualityEnabled) QV.reserve(_size); if (QualityEnabled) QV.reserve(_size);
if (MarkEnabled) MV.reserve(_size); if (MarkEnabled) MV.reserve(_size);
if (NormalEnabled) NV.reserve(_size); if (NormalEnabled) NV.reserve(_size);
if (TexCoordEnabled) TV.reserve(_size); if (TexCoordEnabled) TV.reserve(_size);
if (VFAdjacencyEnabled) AV.reserve(_size); if (VFAdjacencyEnabled) AV.reserve(_size);
if (CurvatureEnabled) CuV.reserve(_size); if (CurvatureEnabled) CuV.reserve(_size);
if (CurvatureDirEnabled) CuDV.reserve(_size); if (CurvatureDirEnabled) CuDV.reserve(_size);
if (RadiusEnabled) RadiusV.reserve(_size); if (RadiusEnabled) RadiusV.reserve(_size);
} }
void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend) void _updateOVP(ThisTypeIterator lbegin, ThisTypeIterator lend)
{ {
ThisTypeIterator vi; ThisTypeIterator vi;
for(vi=lbegin;vi!=lend;++vi) for(vi=lbegin;vi!=lend;++vi)
(*vi)._ovp=this; (*vi)._ovp=this;
} }
//////////////////////////////////////// ////////////////////////////////////////
// Enabling Eunctions // Enabling Eunctions
bool IsQualityEnabled() const {return QualityEnabled;} bool IsQualityEnabled() const {return QualityEnabled;}
void EnableQuality() { void EnableQuality() {
assert(VALUE_TYPE::HasQualityOcf()); assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=true; QualityEnabled=true;
QV.resize((*this).size(),0); QV.resize((*this).size(),0);
} }
void DisableQuality() { void DisableQuality() {
assert(VALUE_TYPE::HasQualityOcf()); assert(VALUE_TYPE::HasQualityOcf());
QualityEnabled=false; QualityEnabled=false;
QV.clear(); QV.clear();
} }
bool IsColorEnabled() const {return ColorEnabled;} bool IsColorEnabled() const {return ColorEnabled;}
void EnableColor() { void EnableColor() {
assert(VALUE_TYPE::HasColorOcf()); assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=true; ColorEnabled=true;
CV.resize((*this).size()); CV.resize((*this).size());
} }
void DisableColor() { void DisableColor() {
assert(VALUE_TYPE::HasColorOcf()); assert(VALUE_TYPE::HasColorOcf());
ColorEnabled=false; ColorEnabled=false;
CV.clear(); CV.clear();
} }
bool IsMarkEnabled() const {return MarkEnabled;} bool IsMarkEnabled() const {return MarkEnabled;}
void EnableMark() { void EnableMark() {
assert(VALUE_TYPE::HasMarkOcf()); assert(VALUE_TYPE::HasMarkOcf());
MarkEnabled=true; MarkEnabled=true;
MV.resize((*this).size(),0); MV.resize((*this).size(),0);
} }
void DisableMark() { void DisableMark() {
assert(VALUE_TYPE::HasMarkOcf()); assert(VALUE_TYPE::HasMarkOcf());
MarkEnabled=false; MarkEnabled=false;
MV.clear(); MV.clear();
} }
bool IsNormalEnabled() const {return NormalEnabled;} bool IsNormalEnabled() const {return NormalEnabled;}
void EnableNormal() { void EnableNormal() {
assert(VALUE_TYPE::HasNormalOcf()); assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=true; NormalEnabled=true;
NV.resize((*this).size()); NV.resize((*this).size());
} }
void DisableNormal() { void DisableNormal() {
assert(VALUE_TYPE::HasNormalOcf()); assert(VALUE_TYPE::HasNormalOcf());
NormalEnabled=false; NormalEnabled=false;
NV.clear(); NV.clear();
} }
bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;} bool IsVFAdjacencyEnabled() const {return VFAdjacencyEnabled;}
void EnableVFAdjacency() { void EnableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf()); assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=true; VFAdjacencyEnabled=true;
VFAdjType zero; zero._fp=0; zero._zp=-1; VFAdjType zero; zero._fp=0; zero._zp=-1;
AV.resize((*this).size(),zero); AV.resize((*this).size(),zero);
} }
void DisableVFAdjacency() { void DisableVFAdjacency() {
assert(VALUE_TYPE::HasVFAdjacencyOcf()); assert(VALUE_TYPE::HasVFAdjacencyOcf());
VFAdjacencyEnabled=false; VFAdjacencyEnabled=false;
AV.clear(); AV.clear();
} }
bool IsCurvatureEnabled() const {return CurvatureEnabled;} bool IsCurvatureEnabled() const {return CurvatureEnabled;}
void EnableCurvature() { void EnableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf()); assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=true; CurvatureEnabled=true;
CuV.resize((*this).size()); CuV.resize((*this).size());
} }
void DisableCurvature() { void DisableCurvature() {
assert(VALUE_TYPE::HasCurvatureOcf()); assert(VALUE_TYPE::HasCurvatureOcf());
CurvatureEnabled=false; CurvatureEnabled=false;
CuV.clear(); CuV.clear();
} }
bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;} bool IsCurvatureDirEnabled() const {return CurvatureDirEnabled;}
void EnableCurvatureDir() { void EnableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf()); assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=true; CurvatureDirEnabled=true;
CuDV.resize((*this).size()); CuDV.resize((*this).size());
} }
void DisableCurvatureDir() { void DisableCurvatureDir() {
assert(VALUE_TYPE::HasCurvatureDirOcf()); assert(VALUE_TYPE::HasCurvatureDirOcf());
CurvatureDirEnabled=false; CurvatureDirEnabled=false;
CuDV.clear(); CuDV.clear();
} }
bool IsRadiusEnabled() const {return RadiusEnabled;} bool IsRadiusEnabled() const {return RadiusEnabled;}
void EnableRadius() { void EnableRadius() {
assert(VALUE_TYPE::HasRadiusOcf()); assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=true; RadiusEnabled=true;
RadiusV.resize((*this).size()); RadiusV.resize((*this).size());
} }
void DisableRadius() { void DisableRadius() {
assert(VALUE_TYPE::HasRadiusOcf()); assert(VALUE_TYPE::HasRadiusOcf());
RadiusEnabled=false; RadiusEnabled=false;
RadiusV.clear(); RadiusV.clear();
} }
bool IsTexCoordEnabled() const {return TexCoordEnabled;} bool IsTexCoordEnabled() const {return TexCoordEnabled;}
void EnableTexCoord() { void EnableTexCoord() {
assert(VALUE_TYPE::HasTexCoordOcf()); assert(VALUE_TYPE::HasTexCoordOcf());
TexCoordEnabled=true; TexCoordEnabled=true;
TV.resize((*this).size()); TV.resize((*this).size());
} }
void DisableTexCoord() { void DisableTexCoord() {
assert(VALUE_TYPE::HasTexCoordOcf()); assert(VALUE_TYPE::HasTexCoordOcf());
TexCoordEnabled=false; TexCoordEnabled=false;
TV.clear(); TV.clear();
} }
struct VFAdjType { struct VFAdjType {
typename VALUE_TYPE::FacePointer _fp ; typename VALUE_TYPE::FacePointer _fp ;
int _zp ; int _zp ;
}; };
public: public:
std::vector<typename VALUE_TYPE::ColorType> CV; std::vector<typename VALUE_TYPE::ColorType> CV;
@ -269,14 +269,14 @@ public:
template <class T> class VFAdjOcf: public T { template <class T> class VFAdjOcf: public T {
public: public:
typename T::FacePointer &VFp() { typename T::FacePointer &VFp() {
assert((*this).Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
return (*this).Base().AV[(*this).Index()]._fp; return (*this).Base().AV[(*this).Index()]._fp;
} }
typename T::FacePointer cVFp() const { typename T::FacePointer cVFp() const {
if(! (*this).Base().VFAdjacencyEnabled ) return 0; if(! (*this).Base().VFAdjacencyEnabled ) return 0;
else return (*this).Base().AV[(*this).Index()]._fp; else return (*this).Base().AV[(*this).Index()]._fp;
} }
int &VFi() { int &VFi() {
assert((*this).Base().VFAdjacencyEnabled); assert((*this).Base().VFAdjacencyEnabled);
@ -428,12 +428,12 @@ public:
template <class A, class TT> class CurvatureOcf: public TT { template <class A, class TT> class CurvatureOcf: public TT {
public: public:
typedef Point2<A> CurvatureType; typedef Point2<A> CurvatureType;
typedef typename CurvatureType::ScalarType ScalarType; typedef typename CurvatureType::ScalarType CurScalarType;
ScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} CurScalarType &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];} CurScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
ScalarType cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} CurScalarType cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];}
ScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} CurScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
template <class RightVertexType> template <class RightVertexType>
void ImportData(const RightVertexType & rightV){ void ImportData(const RightVertexType & rightV){
@ -458,29 +458,29 @@ template <class T> class CurvaturedOcf: public CurvatureOcf<double, T> {public:
template <class S> template <class S>
struct CurvatureDirTypeOcf{ struct CurvatureDirTypeOcf{
typedef Point3<S> VecType; typedef Point3<S> CurVecType;
typedef S ScalarType; typedef S CurScalarType;
CurvatureDirTypeOcf () {} CurvatureDirTypeOcf () {}
Point3<S>max_dir,min_dir; CurVecType max_dir,min_dir;
S k1,k2; CurScalarType k1,k2;
}; };
template <class A, class TT> class CurvatureDirOcf: public TT { template <class A, class TT> class CurvatureDirOcf: public TT {
public: public:
typedef A CurvatureDirType; typedef A CurvatureDirType;
typedef typename CurvatureDirType::VecType VecType; typedef typename CurvatureDirType::CurVecType CurVecType;
typedef typename CurvatureDirType::ScalarType ScalarType; typedef typename CurvatureDirType::CurScalarType CurScalarType;
VecType &PD1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;} CurVecType &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()].min_dir;} CurVecType &PD2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
VecType cPD1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;} CurVecType cPD1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].max_dir;}
VecType cPD2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;} CurVecType cPD2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].min_dir;}
ScalarType &K1() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;} CurScalarType &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;} CurScalarType &K2() { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
ScalarType cK1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;} CurScalarType cK1() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k1;}
ScalarType cK2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;} CurScalarType cK2() const { assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
template <class RightVertexType> template <class RightVertexType>
void ImportData(const RightVertexType & rightV){ void ImportData(const RightVertexType & rightV){
@ -513,7 +513,6 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
template <class A, class TT> class RadiusOcf: public TT { template <class A, class TT> class RadiusOcf: public TT {
public: public:
typedef A RadiusType; typedef A RadiusType;
typedef RadiusType ScalarType;
const RadiusType &R() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];} const RadiusType &R() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
RadiusType &R() { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];} RadiusType &R() { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
@ -541,31 +540,31 @@ template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
template < class T> class InfoOcf: public T { template < class T> class InfoOcf: public T {
public: public:
// You should never ever try to copy a vertex that has OCF stuff. // You should never ever try to copy a vertex that has OCF stuff.
// use ImportData function. // use ImportData function.
inline InfoOcf &operator=(const InfoOcf & /*other*/) { inline InfoOcf &operator=(const InfoOcf & /*other*/) {
assert(0); return *this; assert(0); return *this;
} }
vector_ocf<typename T::VertexType> &Base() const { return *_ovp;} vector_ocf<typename T::VertexType> &Base() const { return *_ovp;}
inline int Index() const { inline int Index() const {
typename T::VertexType const *tp=static_cast<typename T::VertexType const*>(this); typename T::VertexType const *tp=static_cast<typename T::VertexType const*>(this);
int tt2=tp- &*(_ovp->begin()); int tt2=tp- &*(_ovp->begin());
return tt2; return tt2;
} }
public: public:
vector_ocf<typename T::VertexType> *_ovp; vector_ocf<typename T::VertexType> *_ovp;
static bool HasColorOcf() { return false; } static bool HasColorOcf() { return false; }
static bool HasCurvatureOcf() { return false; } static bool HasCurvatureOcf() { return false; }
static bool HasCurvatureDirOcf() { return false; } static bool HasCurvatureDirOcf() { return false; }
static bool HasNormalOcf() { return false; } static bool HasNormalOcf() { return false; }
static bool HasMarkOcf() { return false; } static bool HasMarkOcf() { return false; }
static bool HasQualityOcf() { return false; } static bool HasQualityOcf() { return false; }
static bool HasRadiusOcf() { return false; } static bool HasRadiusOcf() { return false; }
static bool HasTexCoordOcf() { return false; } static bool HasTexCoordOcf() { return false; }
static bool HasVFAdjacencyOcf() { return false; } static bool HasVFAdjacencyOcf() { return false; }
}; };
@ -583,45 +582,45 @@ bool VertexVectorHasVFAdjacency(const vertex::vector_ocf<VertexType> &fv)
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexRadius(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexRadius(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasRadiusOcf()) return fv.IsRadiusEnabled(); if(VertexType::HasRadiusOcf()) return fv.IsRadiusEnabled();
else return VertexType::HasRadius(); else return VertexType::HasRadius();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexQuality(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexQuality(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasQualityOcf()) return fv.IsQualityEnabled(); if(VertexType::HasQualityOcf()) return fv.IsQualityEnabled();
else return VertexType::HasQuality(); else return VertexType::HasQuality();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexNormal(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexNormal(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasNormalOcf()) return fv.IsNormalEnabled(); if(VertexType::HasNormalOcf()) return fv.IsNormalEnabled();
else return VertexType::HasNormal(); else return VertexType::HasNormal();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexColor(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexColor(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasColorOcf()) return fv.IsColorEnabled(); if(VertexType::HasColorOcf()) return fv.IsColorEnabled();
else return VertexType::HasColor(); else return VertexType::HasColor();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexCurvature(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexCurvature(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasCurvatureOcf()) return fv.IsCurvatureEnabled(); if(VertexType::HasCurvatureOcf()) return fv.IsCurvatureEnabled();
else return VertexType::HasCurvature(); else return VertexType::HasCurvature();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexCurvatureDir(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexCurvatureDir(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasCurvatureDirOcf()) return fv.IsCurvatureDirEnabled(); if(VertexType::HasCurvatureDirOcf()) return fv.IsCurvatureDirEnabled();
else return VertexType::HasCurvatureDir(); else return VertexType::HasCurvatureDir();
} }
template < class VertexType > template < class VertexType >
bool VertexVectorHasPerVertexTexCoord(const vertex::vector_ocf<VertexType> &fv) bool VertexVectorHasPerVertexTexCoord(const vertex::vector_ocf<VertexType> &fv)
{ {
if(VertexType::HasTexCoordOcf()) return fv.IsTexCoordEnabled(); if(VertexType::HasTexCoordOcf()) return fv.IsTexCoordEnabled();
else return VertexType::HasTexCoord(); else return VertexType::HasTexCoord();
} }
} }
}// end namespace vcg }// end namespace vcg