Go to the documentation of this file.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_MESH
00024 #error "This file should not be included alone. It is automatically included by complex.h"
00025 #endif
00026 #ifndef __VCG_EDGE_PLUS_COMPONENT
00027 #define __VCG_EDGE_PLUS_COMPONENT
00028
00029 namespace vcg {
00030 namespace edge {
00031
00036
00037
00038
00039
00040
00041
00042
00043 template <class T> class EmptyCore: public T
00044 {
00045 public:
00046 inline typename T::VertexType * & V( const int j ) { (void)j; assert(0); static typename T::VertexType *vp=0; return vp; }
00047 inline typename T::VertexType * const & V( const int j ) const { (void)j; assert(0); static typename T::VertexType *vp=0; return vp; }
00048 inline typename T::VertexType * cV( const int j ) const { (void)j; assert(0); static typename T::VertexType *vp=0; return vp; }
00049 inline typename T::CoordType & P( const int j ) { (void)j; assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00050 inline const typename T::CoordType & P( const int j ) const { (void)j; assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00051 inline const typename T::CoordType & cP( const int j ) const { (void)j; assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
00052 static bool HasEVAdjacency() { return false; }
00053 static bool HasVertexRef() { return false; }
00054
00055 typedef vcg::Color4b ColorType;
00056 ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
00057 ColorType cC() const { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
00058 static bool HasColor() { return false; }
00059
00060 typedef float QualityType;
00061 QualityType &Q() { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
00062 QualityType cQ() const { static QualityType dummyQuality(0); assert(0); return dummyQuality; }
00063 static bool HasQuality() { return false; }
00064
00065 typedef int MarkType;
00066 inline void InitIMark() { }
00067 inline int cIMark() const { assert(0); static int tmp=-1; return tmp;}
00068 inline int &IMark() { assert(0); static int tmp=-1; return tmp;}
00069 static bool HasMark() { return false; }
00070
00071 typedef int FlagType;
00072 int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
00073 int Flags() const { return 0; }
00074 static bool HasFlags() { return false; }
00075
00076 typename T::EdgePointer &VEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; }
00077 typename T::EdgePointer cVEp(const int & ) const { static typename T::EdgePointer ep=0; assert(0); return ep; }
00078 int &VEi(const int &){static int z=0; assert(0); return z;}
00079 int cVEi(const int &) const {static int z=0; assert(0); return z;}
00080 static bool HasVEAdjacency() { return false; }
00081
00082 typename T::EdgePointer &EEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; }
00083 typename T::EdgePointer cEEp(const int & ) const { static typename T::EdgePointer ep=0; assert(0); return ep; }
00084 int &EEi(const int &){static int z=0; assert(0); return z;}
00085 int cEEi(const int &) const {static int z=0; assert(0); return z;}
00086 static bool HasEEAdjacency() { return false; }
00087
00088 typename T::HEdgePointer &EHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; }
00089 typename T::HEdgePointer cEHp( ) const { static typename T::HEdgePointer hp=0; assert(0); return hp; }
00090 static bool HasEHAdjacency() { return false; }
00091
00092 typename T::FacePointer &EFp() { static typename T::FacePointer fp=0; assert(0); return fp; }
00093 typename T::FacePointer cEFp() const { static typename T::FacePointer fp=0; assert(0); return fp; }
00094 int &EFi() {static int z=0; return z;}
00095 int &cEFi() const {static int z=0; return z;}
00096 static bool HasEFAdjacency() { return false; }
00097
00098 template <class LeftF>
00099 void ImportData(const LeftF & leftF) {T::ImportData(leftF);}
00100 static void Name(std::vector<std::string> & name){T::Name(name);}
00101 };
00102
00103
00109 template <class T> class VertexRef: public T {
00110 public:
00111 VertexRef(){
00112 v[0]=0;
00113 v[1]=0;
00114 }
00115
00116 typedef typename T::VertexType::CoordType CoordType;
00117 typedef typename T::VertexType::ScalarType ScalarType;
00118
00119 inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<2); return v[j]; }
00120 inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<2); return v[j]; }
00121 inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<2); return v[j]; }
00122
00123
00124 inline CoordType & P( const int j ) { assert(j>=0 && j<2); return v[j]->P(); }
00125 inline const CoordType &cP( const int j ) const { assert(j>=0 && j<2); return v[j]->P(); }
00126
00130 inline typename T::VertexType * & V0( const int j ) { return V(j);}
00131 inline typename T::VertexType * & V1( const int j ) { return V((j+1)%2);}
00132 inline const typename T::VertexType * const & V0( const int j ) const { return V(j);}
00133 inline const typename T::VertexType * const & V1( const int j ) const { return V((j+1)%2);}
00134 inline const typename T::VertexType * const & cV0( const int j ) const { return cV(j);}
00135 inline const typename T::VertexType * const & cV1( const int j ) const { return cV((j+1)%2);}
00136
00138 inline CoordType & P0( const int j ) { return V(j)->P();}
00139 inline CoordType & P1( const int j ) { return V((j+1)%2)->P();}
00140 inline const CoordType & P0( const int j ) const { return V(j)->P();}
00141 inline const CoordType & P1( const int j ) const { return V((j+1)%2)->P();}
00142 inline const CoordType & cP0( const int j ) const { return cV(j)->P();}
00143 inline const CoordType & cP1( const int j ) const { return cV((j+1)%2)->P();}
00144
00145 template <class LeftF>
00146 void ImportData(const LeftF & leftF){ T::ImportData(leftF);}
00147
00148 static bool HasEVAdjacency() { return true; }
00149 static bool HasVertexRef() { return true; }
00150 static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
00151
00152
00153 private:
00154 typename T::VertexType *v[2];
00155 };
00156
00157 template <class T> class EVAdj : public VertexRef<T>{};
00158
00159
00160
00161
00166 template <class T> class Mark: public T {
00167 public:
00168 Mark():_imark(0){}
00169 static bool HasMark() { return true; }
00170 static bool HasMarkOcc() { return true; }
00171 inline void InitIMark() { _imark = 0; }
00172 inline int & IMark() { return _imark;}
00173 inline const int & IMark() const {return _imark;}
00174 template < class LeftV>
00175 void ImportData(const LeftV & left ) { IMark() = left.IMark(); T::ImportData( left); }
00176 static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
00177
00178 private:
00179 int _imark;
00180 };
00181
00182
00187 template <class T> class BitFlags: public T {
00188 public:
00189 BitFlags(){_flags=0;}
00190 typedef int FlagType;
00191 int &Flags() {return _flags; }
00192 int Flags() const {return _flags; }
00193 template < class LeftV>
00194 void ImportData(const LeftV & left ) { Flags() = left.Flags(); T::ImportData( left); }
00195 static bool HasFlags() { return true; }
00196 static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
00197
00198 private:
00199 int _flags;
00200 };
00201
00202
00208 template <class A, class T> class Color: public T {
00209 public:
00210 Color():_color(vcg::Color4b::White) {}
00211 typedef A ColorType;
00212 ColorType &C() { return _color; }
00213 const ColorType &C() const { return _color; }
00214 const ColorType &cC() const { return _color; }
00215 template < class LeftV>
00216 void ImportData(const LeftV & left ) { C() = left.cC(); T::ImportData( left); }
00217 static bool HasColor() { return true; }
00218 static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
00219
00220 private:
00221 ColorType _color;
00222 };
00223
00224 template <class TT> class Color4b: public edge::Color<vcg::Color4b, TT> {
00225 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Color4b"));TT::Name(name);}
00226 };
00227
00228
00235 template <class A, class TT> class Quality: public TT {
00236 public:
00237 typedef A QualityType;
00238 QualityType &Q() { return _quality; }
00239 const QualityType & cQ() const {return _quality; }
00240 template < class LeftV>
00241 void ImportData(const LeftV & left ) { Q() = left.cQ(); TT::ImportData( left); }
00242 static bool HasQuality() { return true; }
00243 static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
00244
00245 private:
00246 QualityType _quality;
00247 };
00248
00249 template <class TT> class Qualitys: public Quality<short, TT> {
00250 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualitys"));TT::Name(name);}
00251 };
00252 template <class TT> class Qualityf: public Quality<float, TT> {
00253 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityf"));TT::Name(name);}
00254 };
00255 template <class TT> class Qualityd: public Quality<double, TT> {
00256 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("Qualityd"));TT::Name(name);}
00257 };
00258
00259
00267 template <class T> class VEAdj: public T {
00268 public:
00269 VEAdj(){_ep[0]=0;_ep[1]=0;_zp[0]=-1;_zp[1]=-1;}
00270 typename T::EdgePointer &VEp(const int & i) {return _ep[i]; }
00271 typename T::EdgePointer cVEp(const int & i) const {return _ep[i]; }
00272 int &VEi(const int & i){ return _zp[i];}
00273 int cVEi(const int &i )const {return _zp[i];}
00274
00275 template < class LeftV>
00276 void ImportData(const LeftV & left ) { T::ImportData( left); }
00277 static bool HasVEAdjacency() { return true; }
00278 static bool HasVEAdjacencyOcc() { return true; }
00279 static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
00280
00281 private:
00282 typename T::EdgePointer _ep[2] ;
00283 int _zp[2] ;
00284 };
00285
00286
00300 template <class T> class EEAdj: public T {
00301 public:
00302 EEAdj(){_ep[0]=0;_ep[1]=0;_zp[0]=-1;_zp[1]=-1;}
00303 typename T::EdgePointer &EEp(const int & i) {return _ep[i]; }
00304 typename T::EdgePointer cEEp(const int & i) const {return _ep[i]; }
00305 int &EEi(const int & i){ return _zp[i];}
00306 int cEEi(const int &i )const {return _zp[i];}
00307
00308 template < class LeftV>
00309 void ImportData(const LeftV & left ) { T::ImportData( left); }
00310 static bool HasEEAdjacency() { return true; }
00311 static bool HasEEAdjacencyOcc() { return true; }
00312 static void Name(std::vector<std::string> & name){name.push_back(std::string("EEAdj"));T::Name(name);}
00313
00314 private:
00315 typename T::EdgePointer _ep[2] ;
00316 int _zp[2] ;
00317 };
00318
00319
00320 template <class T> class EHAdj: public T {
00321 public:
00322 EHAdj(){_hp=0;}
00323 typename T::HEdgePointer &EHp( ) {return _hp ; }
00324 const typename T::HEdgePointer cEHp( ) const {return _hp ; }
00325
00326 template < class LeftV>
00327 void ImportData(const LeftV & left ) { T::ImportData( left); }
00328 static bool HasEHAdjacency() { return true; }
00329 static bool HasEHAdjacencyOcc() { return true; }
00330 static void Name(std::vector<std::string> & name){name.push_back(std::string("EHAdj"));T::Name(name);}
00331
00332 private:
00333 typename T::HEdgePointer _hp ;
00334 };
00335
00336
00344 template <class T> class EFAdj: public T {
00345 public:
00346 EFAdj(){_fp=0;}
00347 typename T::FacePointer &EFp() {return _fp; }
00348 typename T::FacePointer cEFp() const {return _fp; }
00349 int &EFi() {return _zp; }
00350 int cEFi() const {return _zp; }
00351 template < class LeftV>
00352 void ImportData(const LeftV & left ) { T::ImportData( left); }
00353 static bool HasEFAdjacency() { return true; }
00354 static bool HasEFAdjacencyOcc() { return true; }
00355 static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);}
00356
00357 private:
00358 typename T::FacePointer _fp ;
00359 int _zp ;
00360 };
00361
00363 }
00364 }
00365 #endif