From 684fe8d4640630e58ca66159b59074e1f3a7426a Mon Sep 17 00:00:00 2001 From: gianpaolopalma Date: Mon, 26 Oct 2015 12:52:44 +0000 Subject: [PATCH] Fixed wrong typedefs in the per vertex CurvatureDir component (ScalarType). Added missing typedef in EmptyCore. Added typedef WedgeColorType and WedgeNormalType. --- vcg/simplex/face/component.h | 59 ++++++++++++++++-------------- vcg/simplex/face/component_ocf.h | 12 +++--- vcg/simplex/vertex/component.h | 35 +++++++++--------- vcg/simplex/vertex/component_occ.h | 30 +++++++-------- vcg/simplex/vertex/component_ocf.h | 10 ++--- 5 files changed, 75 insertions(+), 71 deletions(-) diff --git a/vcg/simplex/face/component.h b/vcg/simplex/face/component.h index 5b3d599b..965a8132 100644 --- a/vcg/simplex/face/component.h +++ b/vcg/simplex/face/component.h @@ -47,10 +47,11 @@ public: static bool HasFVAdjacency() { return false; } typedef typename T::VertexType::NormalType NormalType; + typedef NormalType WedgeNormalType; NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } NormalType cN() const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } - NormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } - NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } + WedgeNormalType &WN(int) { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; } + WedgeNormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } typedef int WedgeTexCoordType; @@ -58,7 +59,7 @@ public: TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;} TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;} - + typedef int FlagType; int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int cFlags() const { return 0; } static bool HasFlags() { return false; } @@ -71,11 +72,11 @@ public: typedef float QualityType; typedef Point3f Quality3Type; typedef vcg::Color4b ColorType; - + typedef ColorType WedgeColorType; ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } - ColorType &WC(const int) { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } - ColorType cWC(const int) const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } + WedgeColorType &WC(const int) { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } + WedgeColorType cWC(const int) const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; } QualityType cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; } Quality3Type &Q3() { static Quality3Type dummyQuality3(0,0,0); assert(0); return dummyQuality3; } @@ -128,17 +129,18 @@ public: static bool HasFEAdjacency() { return false; } static bool HasFHAdjacency() { return false; } - typedef int CurvatureDirType; + typedef typename T::VertexType::CurvatureDirType CurvatureDirType; + typedef typename T::CoordType CurVecType; + typedef typename T::ScalarType CurScalarType; + typename CurVecType &PD1() { static typename T::CoordType dummy(0, 0, 0); assert(0); return dummy; } + typename CurVecType &PD2() { static typename T::CoordType dummy(0, 0, 0); assert(0); return dummy; } + typename CurVecType cPD1() const { static typename T::CoordType dummy(0, 0, 0); assert(0); return dummy; } + typename CurVecType cPD2() const { static typename T::CoordType dummy(0, 0, 0); assert(0); return dummy; } - typename T::CoordType &PD1() { static typename T::CoordType dummy(0,0,0); assert(0); return dummy;} - typename T::CoordType &PD2() { static typename T::CoordType dummy(0,0,0); assert(0); return dummy;} - typename T::CoordType cPD1() const { static typename T::CoordType dummy(0,0,0); assert(0); return dummy;} - typename T::CoordType cPD2() const { static typename T::CoordType dummy(0,0,0); assert(0); return dummy;} - - typename T::ScalarType &K1() { static typename T::ScalarType dummy(0); assert(0); return dummy;} - typename T::ScalarType &K2() { static typename T::ScalarType dummy(0); assert(0); return dummy;} - typename T::ScalarType cK1() const { static typename T::ScalarType dummy(0); assert(0); return dummy;} - typename T::ScalarType cK2() const { static typename T::ScalarType dummy(0); assert(0); return dummy;} + typename CurScalarType &K1() { static typename T::ScalarType dummy(0); assert(0); return dummy; } + typename CurScalarType &K2() { static typename T::ScalarType dummy(0); assert(0); return dummy; } + typename CurScalarType cK1() const { static typename T::ScalarType dummy(0); assert(0); return dummy; } + typename CurScalarType cK2() const { static typename T::ScalarType dummy(0); assert(0); return dummy; } static bool HasCurvatureDir() { return false; } @@ -230,9 +232,9 @@ private: template class WedgeNormal: public T { public: - typedef typename T::VertexType::NormalType NormalType; - inline NormalType &WN(int j) { return _wnorm[j]; } - inline NormalType cWN(int j) const { return _wnorm[j]; } + typedef typename T::VertexType::NormalType WedgeNormalType; + inline WedgeNormalType &WN(int j) { return _wnorm[j]; } + inline WedgeNormalType cWN(int j) const { return _wnorm[j]; } template void ImportData(const RightValueType & rightF){ if(rightF.IsWedgeNormalEnabled()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);} inline void Alloc(const int & ns){T::Alloc(ns);} @@ -241,14 +243,14 @@ public: static void Name(std::vector & name){name.push_back(std::string("WedgeNormal"));T::Name(name);} private: - NormalType _wnorm[3]; + WedgeNormalType _wnorm[3]; }; template class WedgeRealNormal: public T { public: - typedef A NormalType; - inline NormalType &WN(int i) { return _wn[i]; } - inline NormalType cWN(int i) const { return _wn[i]; } + typedef A WedgeNormalType; + inline WedgeNormalType &WN(int i) { return _wn[i]; } + inline WedgeNormalType cWN(int i) const { return _wn[i]; } template void ImportData(const RightValueType & rightF){ if(RightValueType::HasWedgeNormal()) for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);} inline void Alloc(const int & ns){T::Alloc(ns);} @@ -257,7 +259,7 @@ public: static void Name(std::vector & name){name.push_back(std::string("WedgeRealNormal"));T::Name(name);} private: - NormalType _wn[3]; + WedgeNormalType _wn[3]; }; template class WedgeRealNormal3s: public WedgeRealNormal { @@ -319,6 +321,7 @@ This component stores a 32 bit array of bit flags. These bit flags are used for template class BitFlags: public T { public: BitFlags():_flags(0) {} + typedef int FlagType; int &Flags() {return _flags; } int cFlags() const {return _flags; } template @@ -359,9 +362,9 @@ private: template class WedgeColor: public T { public: - typedef A ColorType; - ColorType &WC(int i) { return _color[i]; } - ColorType cWC(int i) const { return _color[i]; } + typedef A WedgeColorType; + WedgeColorType &WC(int i) { return _color[i]; } + WedgeColorType cWC(int i) const { return _color[i]; } template void ImportData(const RightValueType & rightF){ @@ -376,7 +379,7 @@ public: static void Name(std::vector & name){name.push_back(std::string("WedgeColor"));T::Name(name);} private: - ColorType _color[3]; + WedgeColorType _color[3]; }; template class WedgeColor4b: public WedgeColor { diff --git a/vcg/simplex/face/component_ocf.h b/vcg/simplex/face/component_ocf.h index b43b148f..a59d4911 100644 --- a/vcg/simplex/face/component_ocf.h +++ b/vcg/simplex/face/component_ocf.h @@ -641,9 +641,9 @@ template class WedgeTexCoordfOcf: public WedgeTexCoordOcf class WedgeColorOcf: public TT { public: WedgeColorOcf(){ } - typedef A ColorType; - ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } - const ColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } + typedef A WedgeColorType; + WedgeColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } + const WedgeColorType cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } template void ImportData(const RightFaceType & rightF){ if(this->IsWedgeColorEnabled() && rightF.IsWedgeColorEnabled()) @@ -661,9 +661,9 @@ template class WedgeColor4bOcf: public WedgeColorOcf template class WedgeNormalOcf: public TT { public: WedgeNormalOcf(){ } - typedef A NormalType; - NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } - NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } + typedef A WedgeNormalType; + WedgeNormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } + WedgeNormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } template void ImportData(const RightFaceType & rightF){ if(this->IsWedgeNormalEnabled() && rightF.IsWedgeNormalEnabled()) diff --git a/vcg/simplex/vertex/component.h b/vcg/simplex/vertex/component.h index e123646e..fbd116c1 100644 --- a/vcg/simplex/vertex/component.h +++ b/vcg/simplex/vertex/component.h @@ -128,6 +128,7 @@ 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;} @@ -399,13 +400,13 @@ public: static void Name(std::vector & name){name.push_back(std::st template class Curvature: public TT { public: typedef Point2 CurvatureType; - typedef typename CurvatureType::ScalarType ScalarType; - const ScalarType &Kh() const { return _hk[0];} - const ScalarType &Kg() const { return _hk[1];} - ScalarType &Kh() { return _hk[0];} - ScalarType &Kg() { return _hk[1];} - ScalarType cKh() const { return _hk[0];} - ScalarType cKg() const { return _hk[1];} + 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 ) { @@ -440,18 +441,18 @@ public: static void Name(std::vector & name){name.push_back(std::st template class CurvatureDir: public TT { public: typedef A CurvatureDirType; - typedef typename CurvatureDirType::VecType VecType; - typedef typename CurvatureDirType::ScalarType ScalarType; + typedef typename CurvatureDirType::VecType CurVecType; + typedef typename CurvatureDirType::ScalarType CurScalarType; - VecType &PD1(){ return _curv.max_dir;} - VecType &PD2(){ return _curv.min_dir;} - const VecType &cPD1() const {return _curv.max_dir;} - const VecType &cPD2() const {return _curv.min_dir;} + CurVecType &PD1(){ return _curv.max_dir; } + CurVecType &PD2(){ return _curv.min_dir; } + const CurVecType &cPD1() const { return _curv.max_dir; } + const CurVecType &cPD2() const { return _curv.min_dir; } - ScalarType &K1(){ return _curv.k1;} - ScalarType &K2(){ return _curv.k2;} - const ScalarType &cK1() const {return _curv.k1;} - const ScalarType &cK2() const {return _curv.k2;} + CurScalarType &K1(){ return _curv.k1; } + CurScalarType &K2(){ return _curv.k2; } + const CurScalarType &cK1() const { return _curv.k1; } + const CurScalarType &cK2() const { return _curv.k2; } template < class RightValueType> void ImportData(const RightValueType & rVert ) { if(rVert.IsCurvatureDirEnabled()) { diff --git a/vcg/simplex/vertex/component_occ.h b/vcg/simplex/vertex/component_occ.h index 45594227..cb358abf 100644 --- a/vcg/simplex/vertex/component_occ.h +++ b/vcg/simplex/vertex/component_occ.h @@ -144,12 +144,12 @@ template class CurvatureOcc: public TT { public: typedef Point2 CurvatureTypeOcc; typedef typename TT::VertType VertType; - typedef typename CurvatureTypeOcc::ScalarType ScalarType; + typedef typename CurvatureTypeOcc::ScalarType ScalarTypeCur; - ScalarType &H(){ return CAT< vector_occ,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];} - ScalarType &K(){ return CAT< vector_occ,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];} - const ScalarType &cH() const { return CAT< vector_occ,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0];} - const ScalarType &cK() const { return CAT< vector_occ,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];} + ScalarTypeCur &H(){ return CAT< vector_occ, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0]; } + ScalarTypeCur &K(){ return CAT< vector_occ, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1]; } + const ScalarTypeCur &cH() const { return CAT< vector_occ, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0]; } + const ScalarTypeCur &cK() const { return CAT< vector_occ, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1]; } template void ImportData(const LeftV & leftV){ @@ -188,19 +188,19 @@ struct CurvatureDirTypeOcc{ template class CurvatureDirOcc: public TT { public: typedef A CurvatureDirTypeOcc; - typedef typename CurvatureDirTypeOcc::VecType VecType; - typedef typename CurvatureDirTypeOcc::ScalarType ScalarType; + typedef typename CurvatureDirTypeOcc::VecType CurVecType; + typedef typename CurvatureDirTypeOcc::ScalarType CurScalarType; typedef typename TT::VertType VertType; - VecType &PD1(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;} - VecType &PD2(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;} - const VecType &cPD1() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;} - const VecType &cPD2() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;} + CurVecType &PD1(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;} + CurVecType &PD2(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;} + const CurVecType &cPD1() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;} + const CurVecType &cPD2() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;} - ScalarType &K1(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;} - ScalarType &K2(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;} - const ScalarType &cK1() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;} - const ScalarType &cK2()const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;} + CurScalarType &K1(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;} + CurScalarType &K2(){ return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;} + const CurScalarType &cK1() const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;} + const CurScalarType &cK2()const {return CAT< vector_occ,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;} static bool HasCurvatureDir() { return true; } static bool HasCurvatureDirOcc() { return true; } diff --git a/vcg/simplex/vertex/component_ocf.h b/vcg/simplex/vertex/component_ocf.h index a90993c3..aebecd8e 100644 --- a/vcg/simplex/vertex/component_ocf.h +++ b/vcg/simplex/vertex/component_ocf.h @@ -431,12 +431,12 @@ public: template class CurvatureOcf: public TT { public: typedef Point2 CurvatureType; - typedef typename CurvatureType::ScalarType CurScalarType; + typedef typename CurvatureType::ScalarType ScalarTypeCur; - CurScalarType &Kh(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} - CurScalarType &Kg(){ assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} - CurScalarType cKh() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][0];} - CurScalarType cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} + 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){