00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef __VCG_VERTEX_PLUS_COMPONENT
00024 #define __VCG_VERTEX_PLUS_COMPONENT
00025 #include <vector>
00026 #include <string>
00027 #include <vcg/space/point3.h>
00028 #include <vcg/space/texcoord2.h>
00029 #include <vcg/space/color4.h>
00030
00031 namespace vcg {
00032 namespace vertex {
00033
00034
00035
00036
00037
00038
00039
00040
00041 template <class S>
00042 struct CurvatureDirBaseType{
00043 typedef Point3<S> VecType;
00044 typedef S ScalarType;
00045 CurvatureDirBaseType () {}
00046 Point3<S>max_dir,min_dir;
00047 S k1,k2;
00048 };
00049
00050 template <class A, class TT> class Curvature: public TT {
00051 public:
00052 typedef Point2<A> CurvatureType;
00053 typedef typename CurvatureType::ScalarType ScalarType;
00054 ScalarType &Kh(){ return _hk[0];}
00055 ScalarType &Kg(){ return _hk[1];}
00056 const ScalarType &cKh() const { return _hk[0];}
00057 const ScalarType &cKg() const { return _hk[1];}
00058
00059 static bool HasCurvature() { return true; }
00060 static bool IsCurvatureEnabled(typename TT::VertexType *) { return true; }
00061 static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvature"));TT::Name(name);}
00062
00063 private:
00064 Point2<A> _hk;
00065 };
00066
00067
00068 template <class T> class Curvaturef: public Curvature< float, T> {
00069 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvaturef"));T::Name(name);}
00070 };
00071 template <class T> class Curvatured: public Curvature<double , T> {
00072 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Curvatured"));T::Name(name);}
00073 };
00074
00075
00076
00077 template <class TT> class EmptyCore: public TT {
00078 public:
00079 typedef int FlagType;
00080 int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
00081 int Flags() const { return 0; }
00082 static bool HasFlags() { return false; }
00083
00084 typedef vcg::Point3f CoordType;
00085 typedef CoordType::ScalarType ScalarType;
00086 CoordType &P() { static CoordType coord(0, 0, 0); return coord; }
00087 const CoordType &P() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
00088 const CoordType &cP() const { static CoordType coord(0, 0, 0); assert(0); return coord; }
00089 static bool HasCoord() { return false; }
00090
00091 typedef vcg::Point3s NormalType;
00092 NormalType &N() { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
00093 const NormalType cN()const { static NormalType dummy_normal(0, 0, 0); assert(0); return dummy_normal; }
00094 static bool HasNormal() { return false; }
00095 static bool HasNormalOcf() { return false; }
00096
00097 typedef float QualityType;
00098 QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
00099 const QualityType &cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
00100 static bool HasQuality() { return false; }
00101 static bool HasQualityOcf() { return false; }
00102 static bool IsQualityEnabled(const typename TT::VertexType *) { return false; }
00103
00104 typedef vcg::Color4b ColorType;
00105 ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
00106 const ColorType &cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
00107 static bool HasColor() { return false; }
00108 static bool HasColorOcf() { return false; }
00109 static bool IsColorEnabled(const typename TT::VertexType *) { return false; }
00110
00111 inline void InitIMark() { }
00112 inline const int & cIMark() const { assert(0); static int tmp=-1; return tmp;}
00113 inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
00114 inline int IMark() const {return 0;}
00115 static bool HasMark() { return false; }
00116 static bool HasMarkOcf() { return false; }
00117 static bool IsMarkEnabled(const typename TT::VertexType *) { return false; }
00118
00119 typedef ScalarType RadiusType;
00120 RadiusType &R(){ static ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
00121 const RadiusType &cR() const { static const ScalarType v = 0.0; assert(0 && "the radius component is not available"); return v; }
00122 static bool HasRadius() { return false; }
00123 static bool HasRadiusOcf() { return false; }
00124 static bool IsRadiusEnabled(const typename TT::VertexType *) { return false; }
00125
00126 typedef vcg::TexCoord2<float,1> TexCoordType;
00127 TexCoordType &T() { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; }
00128 const TexCoordType &cT() const { static TexCoordType dummy_texcoord; assert(0); return dummy_texcoord; }
00129 static bool HasTexCoord() { return false; }
00130 static bool IsTexCoordEnabled(const typename TT::VertexType *) { return false; }
00131
00132 typename TT::TetraPointer &VTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
00133 const typename TT::TetraPointer cVTp()const { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
00134 int &VTi() { static int z = 0; return z; };
00135 static bool HasVTAdjacency() { return false; }
00136
00137 typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; }
00138 const typename TT::FacePointer cVFp() const { static typename TT::FacePointer fp=0; assert(0); return fp; }
00139 int &VFi(){static int z=0; return z;};
00140 int cVFi() const {static int z=0; return z;};
00141 static bool HasVFAdjacency() { return false; }
00142
00143 typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; }
00144 const typename TT::EdgePointer cVEp() const { static typename TT::EdgePointer ep=0; assert(0); return ep; }
00145 int &VEi(){static int z=0; return z;};
00146 static bool HasVEAdjacency() { return false; }
00147
00148 typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
00149 const typename TT::HEdgePointer cVHp() const { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
00150 int &VHi(){static int z=0; return z;};
00151 static bool HasVHAdjacency() { return false; }
00152
00153
00154 typedef Point3f VecType;
00155 typedef Point2f CurvatureType;
00156 float &Kh() { static float dummy = 0.f; assert(0);return dummy;}
00157 float &Kg() { static float dummy = 0.f; assert(0);return dummy;}
00158 const float &cKh() const { static float dummy = 0.f; assert(0); return dummy;}
00159 const float &cKg() const { static float dummy = 0.f; assert(0); return dummy;}
00160
00161 typedef CurvatureDirBaseType<float> CurvatureDirType;
00162 VecType &PD1(){static VecType v(0,0,0); assert(0);return v;}
00163 VecType &PD2(){static VecType v(0,0,0); assert(0);return v;}
00164 const VecType &cPD1() const {static VecType v(0,0,0); assert(0);return v;}
00165 const VecType &cPD2() const {static VecType v(0,0,0); assert(0);return v;}
00166
00167 ScalarType &K1(){ static ScalarType v = 0.0;assert(0);return v;}
00168 ScalarType &K2(){ static ScalarType v = 0.0;assert(0);return v;}
00169 const ScalarType &cK1() const {static ScalarType v = 0.0;assert(0);return v;}
00170 const ScalarType &cK2()const {static ScalarType v = 0.0;assert(0);return v;}
00171
00172 static bool HasCurvature() { return false; }
00173 static bool IsCurvatureEnabled(const typename TT::VertexType *) { return false; }
00174 static bool HasCurvatureDir() { return false; }
00175 static bool IsCurvatureDirEnabled(const typename TT::VertexType *) { return false; }
00176
00177
00178 template < class LeftV>
00179 void ImportData(const LeftV & ) {
00180
00181 }
00182 static void Name(std::vector<std::string> & name){TT::Name(name);}
00183 };
00184
00185
00186
00187 template <class A, class T> class Coord: public T {
00188 public:
00189 typedef A CoordType;
00190 typedef typename A::ScalarType ScalarType;
00191 CoordType &P() { return _coord; }
00192 const CoordType &P() const { return _coord; }
00193 const CoordType &cP() const { return _coord; }
00194
00195 template < class LeftV>
00196 void ImportData(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportData( left); }
00197 static bool HasCoord() { return true; }
00198 static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
00199
00200 private:
00201 CoordType _coord;
00202 };
00203 template <class T> class Coord3f: public Coord<vcg::Point3f, T> {
00204 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3f"));T::Name(name);}
00205 };
00206 template <class T> class Coord3d: public Coord<vcg::Point3d, T> {
00207 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord3d"));T::Name(name);}
00208 };
00209
00210
00211
00212 template <class A, class T> class Normal: public T {
00213 public:
00214 typedef A NormalType;
00215 NormalType &N() { return _norm; }
00216 const NormalType &cN() const { return _norm; }
00217 template < class LeftV>
00218 void ImportData(const LeftV & left ){
00219 if(LeftV::HasNormal())
00220 N().Import(left.cN());
00221 T::ImportData( left);
00222 }
00223 static bool HasNormal() { return true; }
00224
00225 static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal"));T::Name(name);}
00226
00227 private:
00228 NormalType _norm;
00229 };
00230
00231 template <class T> class Normal3s: public Normal<vcg::Point3s, T> {
00232 public:static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3s"));T::Name(name);}
00233 };
00234 template <class T> class Normal3f: public Normal<vcg::Point3f, T> {
00235 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3f"));T::Name(name);}
00236 };
00237 template <class T> class Normal3d: public Normal<vcg::Point3d, T> {
00238 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Normal3d"));T::Name(name);}
00239 };
00240
00241
00242
00243
00244 template <class T> class Mark: public T {
00245 public:
00246 static bool HasMark() { return true; }
00247 static bool HasMarkOcc() { return true; }
00248 inline void InitIMark() { _imark = 0; }
00249 inline const int & cIMark() const { return _imark;}
00250 inline int & IMark() { return _imark;}
00251 inline const int & IMark() const {return _imark;}
00252 template < class LeftV>
00253 void ImportData(const LeftV & left ) { if(LeftV::HasMark()) IMark() = left.IMark(); T::ImportData( left); }
00254 static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
00255
00256 private:
00257 int _imark;
00258 };
00259
00260
00261
00262 template <class A, class TT> class TexCoord: public TT {
00263 public:
00264 typedef A TexCoordType;
00265 TexCoordType &T() { return _t; }
00266 const TexCoordType &cT() const { return _t; }
00267 template < class LeftV>
00268 void ImportData(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportData( left); }
00269 static bool HasTexCoord() { return true; }
00270 static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
00271
00272 private:
00273 TexCoordType _t;
00274 };
00275
00276 template <class TT> class TexCoord2s: public TexCoord<TexCoord2<short,1>, TT> {
00277 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2s"));TT::Name(name);}
00278 };
00279 template <class TT> class TexCoord2f: public TexCoord<TexCoord2<float,1>, TT> {
00280 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2f"));TT::Name(name);}
00281 };
00282 template <class TT> class TexCoord2d: public TexCoord<TexCoord2<double,1>, TT> {
00283 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord2d"));TT::Name(name);}
00284 };
00285
00286
00287
00288 template <class T> class BitFlags: public T {
00289 public:
00290 BitFlags(){_flags=0;}
00291 typedef int FlagType;
00292 int &Flags() {return _flags; }
00293 int Flags() const {return _flags; }
00294 template < class LeftV>
00295 void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.Flags(); T::ImportData( left); }
00296 static bool HasFlags() { return true; }
00297 static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
00298
00299 private:
00300 int _flags;
00301 };
00302
00303
00304
00305
00306 template <class A, class T> class Color: public T {
00307 public:
00308 Color():_color(vcg::Color4b::White) {}
00309 typedef A ColorType;
00310 ColorType &C() { return _color; }
00311 const ColorType &C() const { return _color; }
00312 const ColorType &cC() const { return _color; }
00313 template < class LeftV>
00314 void ImportData(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportData( left); }
00315 static bool HasColor() { return true; }
00316 static bool IsColorEnabled(typename T::VertexType *) { return true; }
00317 static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
00318
00319 private:
00320 ColorType _color;
00321 };
00322
00323 template <class TT> class Color4b: public Color<vcg::Color4b, TT> {
00324 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
00325 };
00326
00327
00328
00329 template <class A, class TT> class Quality: public TT {
00330 public:
00331 typedef A QualityType;
00332 QualityType &Q() { return _quality; }
00333 const QualityType & cQ() const {return _quality; }
00334 template < class LeftV>
00335 void ImportData(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportData( left); }
00336 static bool HasQuality() { return true; }
00337 static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
00338
00339 private:
00340 QualityType _quality;
00341 };
00342
00343 template <class TT> class Qualitys: public Quality<short, TT> {
00344 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));TT::Name(name);}
00345 };
00346 template <class TT> class Qualityf: public Quality<float, TT> {
00347 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));TT::Name(name);}
00348 };
00349 template <class TT> class Qualityd: public Quality<double, TT> {
00350 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
00351 };
00352
00353
00354
00355
00356
00357 template <class TT> class EmptyCurvatureDir: public TT {
00358 public:
00359 typedef CurvatureDirBaseType<float> CurvatureDirType;
00360
00361 Point3f &PD1(){static Point3f dummy(0,0,0); return dummy;}
00362 Point3f &PD2(){static Point3f dummy(0,0,0); return dummy;}
00363 const Point3f &cPD1() const {static Point3f dummy(0,0,0); return dummy;}
00364 const Point3f &cPD2()const {static Point3f dummy(0,0,0); return dummy;}
00365
00366 float &K1(){ static float dummy(0);assert(0);return dummy;}
00367 float &K2(){ static float dummy(0);assert(0);return dummy;}
00368 const float &cK1()const { static float dummy(0);assert(0);return dummy;}
00369 const float &cK2()const { static float dummy(0);assert(0);return dummy;}
00370
00371 static bool HasCurvatureDir() { return false; }
00372 template < class LeftV>
00373 void ImportData(const LeftV & left ) { TT::ImportData( left); }
00374 static void Name(std::vector<std::string> & name){TT::Name(name);}
00375 };
00376
00377 template <class A, class TT> class CurvatureDir: public TT {
00378 public:
00379 typedef A CurvatureDirType;
00380 typedef typename CurvatureDirType::VecType VecType;
00381 typedef typename CurvatureDirType::ScalarType ScalarType;
00382
00383 VecType &PD1(){ return _curv.max_dir;}
00384 VecType &PD2(){ return _curv.min_dir;}
00385 const VecType &cPD1() const {return _curv.max_dir;}
00386 const VecType &cPD2() const {return _curv.min_dir;}
00387
00388 ScalarType &K1(){ return _curv.k1;}
00389 ScalarType &K2(){ return _curv.k2;}
00390 const ScalarType &cK1() const {return _curv.k1;}
00391 const ScalarType &cK2()const {return _curv.k2;}
00392
00393 static bool HasCurvatureDir() { return true; }
00394 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
00395
00396 private:
00397 CurvatureDirType _curv;
00398 };
00399
00400
00401 template <class T> class CurvatureDirf: public CurvatureDir<CurvatureDirBaseType<float>, T> {
00402 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
00403 };
00404 template <class T> class CurvatureDird: public CurvatureDir<CurvatureDirBaseType<double>, T> {
00405 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
00406 };
00407
00408
00409
00410 template <class A, class TT> class Radius: public TT {
00411 public:
00412 typedef A RadiusType;
00413 RadiusType &R() { return _radius; }
00414 const RadiusType & cR() const {return _radius; }
00415 template < class LeftV>
00416 void ImportData(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportData( left); }
00417 static bool HasRadius() { return true; }
00418 static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
00419
00420 private:
00421 RadiusType _radius;
00422 };
00423
00424 template <class TT> class Radiusf: public Radius<float, TT> {
00425 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Radiusf"));TT::Name(name);}
00426 };
00427
00428
00429
00430
00431 template <class T> class VEAdj: public T {
00432 public:
00433 VEAdj(){_ep=0;}
00434 typename T::EdgePointer &VEp() {return _ep; }
00435 typename T::EdgePointer const cVEp() const {return _ep; }
00436 int &VEi() {return _zp; }
00437 template < class LeftV>
00438 void ImportData(const LeftV & left ) { T::ImportData( left); }
00439 static bool HasVEAdjacency() { return true; }
00440 static bool HasVEAdjacencyOcc() { return true; }
00441 static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
00442
00443 private:
00444 typename T::EdgePointer _ep ;
00445 int _zp ;
00446 };
00447
00448
00449
00450 template <class T> class VFAdj: public T {
00451 public:
00452 VFAdj(){_fp=0;}
00453 typename T::FacePointer &VFp() {return _fp; }
00454 typename T::FacePointer const cVFp() const {return _fp; }
00455 int &VFi() {return _zp; }
00456 template < class LeftV>
00457 void ImportData(const LeftV & left ) { T::ImportData( left); }
00458 static bool HasVFAdjacency() { return true; }
00459 static bool HasVFAdjacencyOcc() { return true; }
00460 static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
00461
00462 private:
00463 typename T::FacePointer _fp ;
00464 int _zp ;
00465 };
00466
00467
00468
00469 template <class T> class VHAdj: public T {
00470 public:
00471 VHAdj(){_hp=0;}
00472 typename T::HEdgePointer &VHp() {return _hp; }
00473 typename T::HEdgePointer cVHp() {return _hp; }
00474 int &VHi() {return _zp; }
00475 template < class LeftV>
00476 void ImportData(const LeftV & left ) { T::ImportData( left); }
00477 static bool HasVHAdjacency() { return true; }
00478 static bool HasVHAdjacencyOcc() { return true; }
00479 static void Name(std::vector<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);}
00480
00481 private:
00482 typename T::HEdgePointer _hp ;
00483 int _zp ;
00484 };
00485
00486
00487
00488 template <class T> class VTAdj: public T {
00489 public:
00490 VTAdj() { _tp = 0; }
00491 typename T::TetraPointer &VTp() { return _tp; }
00492 typename T::TetraPointer cVTp() { return _tp; }
00493 int &VTi() {return _zp; }
00494 static bool HasVTAdjacency() { return true; }
00495 static bool HasVTAdjacencyOcc() { return true; }
00496 static void Name( std::vector< std::string > & name ) { name.push_back( std::string("VTAdj") ); T::Name(name); }
00497
00498 private:
00499 typename T::TetraPointer _tp ;
00500 int _zp ;
00501 };
00502
00503 }
00504 }
00505 #endif