00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef __VCG_TETRA_PLUS
00034 #define __VCG_TETRA_PLUS
00035
00036 #include <vcg/space/point3.h>
00037 #include <vcg/space/texcoord2.h>
00038 #include <vcg/space/color4.h>
00039 #include <vcg/simplex/tetrahedron/component.h>
00040
00041 namespace vcg {
00042
00043
00044
00045
00046
00047
00048
00049 template <class BVT, class BET, class BFT, class BTT>
00050 class TetraTypeHolder{
00051 public:
00052 typedef BVT VertexType;
00053 typedef typename VertexType::CoordType CoordType;
00054 typedef typename VertexType::ScalarType ScalarType;
00055 typedef BET EdgeType;
00056 typedef BFT FaceType;
00057 typedef BTT TetraType;
00058 typedef BVT *VertPointer;
00059 typedef BET *EdgePointer;
00060 typedef BFT *FacePointer;
00061 typedef BTT *TetraPointer;
00062 static void Name(std::vector<std::string> & name){}
00063
00064
00065
00066
00067 };
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081 template <class BVT, class BET=DumET, class BFT=DumFT, class BTT=DumTT>
00082 class TetraBase: public tetra::EmptyVertexRef<
00083 tetra::EmptyAdj<
00084 TetraTypeHolder <BVT, BET, BFT, BTT> > > {
00085 };
00086
00087
00088
00089
00090
00091 template <class BVT, class BET, class BFT,class BTT,
00092 template <typename> class A>
00093 class TetraArity1: public A<TetraBase<BVT,BET,BFT,BTT> > {};
00094
00095 template <class BVT, class BET, typename BFT, class BTT,
00096 template <typename> class A, template <typename> class B>
00097 class TetraArity2: public B<TetraArity1<BVT,BET,BFT,BTT, A> > {};
00098
00099 template <class BVT, class BET, typename BFT,class BTT,
00100 template <typename> class A, template <typename> class B,
00101 template <typename> class C >
00102 class TetraArity3: public C<TetraArity2<BVT,BET,BFT,BTT, A, B> > {};
00103
00104 template <class BVT, class BET, typename BFT,class BTT,
00105 template <typename> class A, template <typename> class B,
00106 template <typename> class C, template <typename> class D>
00107 class TetraArity4: public D<TetraArity3<BVT,BET,BFT,BTT, A, B, C> > {};
00108
00109 template <class BVT, class BET, typename BFT,class BTT,
00110 template <typename> class A, template <typename> class B,
00111 template <typename> class C, template <typename> class D,
00112 template <typename> class E >
00113 class TetraArity5: public E<TetraArity4<BVT,BET,BFT,BTT, A, B, C, D> > {};
00114
00115 template <class BVT, class BET, typename BFT,class BTT,
00116 template <typename> class A, template <typename> class B,
00117 template <typename> class C, template <typename> class D,
00118 template <typename> class E, template <typename> class F >
00119 class TetraArity6: public F<TetraArity5<BVT,BET,BFT,BTT, A, B, C, D, E> > {};
00120
00121 template <class BVT, class BET, typename BFT,class BTT,
00122 template <typename> class A, template <typename> class B,
00123 template <typename> class C, template <typename> class D,
00124 template <typename> class E, template <typename> class F,
00125 template <typename> class G >
00126 class TetraArity7: public G<TetraArity6<BVT,BET,BFT,BTT, A, B, C, D, E, F> > {};
00127
00128 template <class BVT, class BET, typename BFT,class BTT,
00129 template <typename> class A, template <typename> class B,
00130 template <typename> class C, template <typename> class D,
00131 template <typename> class E, template <typename> class F,
00132 template <typename> class G, template <typename> class H >
00133 class TetraArity8: public H<TetraArity7<BVT,BET,BFT,BTT, A, B, C, D, E, F, G> > {};
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 template <class BVT, class BET, typename BFT,class BTT,
00148 template <typename> class A, template <typename> class B,
00149 template <typename> class C, template <typename> class D,
00150 template <typename> class E, template <typename> class F,
00151 template <typename> class G, template <typename> class H,
00152 template <typename> class I >
00153 class TetraArityMax: public I<TetraArity8<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H> > {
00154
00155
00156 public:
00157
00158 inline int & UberFlags ()
00159 {
00160 return this->Flags();
00161 }
00162 inline const int UberFlags() const
00163 {
00164 return this->Flags();
00165 }
00166 enum {
00167
00168 DELETED = 0x00000001,
00169 NOTREAD = 0x00000002,
00170 NOTWRITE = 0x00000004,
00171 VISITED = 0x00000010,
00172 SELECTED = 0x00000020,
00173
00174 BORDER0 = 0x00000040,
00175 BORDER1 = 0x00000080,
00176 BORDER2 = 0x00000100,
00177 BORDER3 = 0x00000200,
00178
00179
00180 USER0 = 0x00004000
00181 };
00182
00183
00185 bool IsD() const {return (this->Flags() & DELETED) != 0;}
00187 bool IsR() const {return (this->Flags() & NOTREAD) == 0;}
00189 bool IsW() const {return (this->Flags() & NOTWRITE)== 0;}
00191 bool IsRW() const {return (this->Flags() & (NOTREAD | NOTWRITE)) == 0;}
00193 bool IsS() const {return (this->Flags() & SELECTED) != 0;}
00195 bool IsV() const {return (this->Flags() & VISITED) != 0;}
00196
00200 void SetFlags(int flagp) {this->Flags()=flagp;}
00201
00205 void ClearFlags() {this->Flags()=0;}
00206
00208 void SetD() {this->Flags() |=DELETED;}
00210 void ClearD() {this->Flags() &=(~DELETED);}
00212 void SetR() {this->Flags() &=(~NOTREAD);}
00214 void ClearR() {this->Flags() |=NOTREAD;}
00216 void SetW() {this->Flags() &=(~NOTWRITE);}
00218 void ClearW() {this->Flags() |=NOTWRITE;}
00220 void SetS() {this->Flags() |=SELECTED;}
00222 void ClearS() {this->Flags() &= ~SELECTED;}
00224 void SetV() {this->Flags() |=VISITED;}
00226 void ClearV() {this->Flags() &= ~VISITED;}
00227
00229 bool IsB(int i) const {return (this->Flags() & (BORDER0<<i)) != 0;}
00231 void SetB(int i) {this->Flags() |=(BORDER0<<i);}
00233 void ClearB(int i) {this->Flags() &= (~(BORDER0<<i));}
00234
00236 static int &LastBitFlag()
00237 {
00238 static int b =USER0;
00239 return b;
00240 }
00241
00243 static inline int NewBitFlag()
00244 {
00245 LastBitFlag()=LastBitFlag()<<1;
00246 return LastBitFlag();
00247 }
00248
00249 static inline bool DeleteBitFlag(int bitval)
00250 {
00251 if(LastBitFlag()==bitval) {
00252 LastBitFlag()= LastBitFlag()>>1;
00253 return true;
00254 }
00255 assert(0);
00256 return false;
00257 }
00259 bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
00261 void SetUserBit(int userBit){this->Flags() |=userBit;}
00263 void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
00264
00265 template<class BoxType>
00266 void GetBBox( BoxType & bb ) const
00267 {
00268 bb.Set(this->P(0));
00269 bb.Add(this->P(1));
00270 bb.Add(this->P(2));
00271 }
00272
00273
00274 };
00275
00276 template < typename T=int>
00277 class TetraDefaultDeriver : public T {};
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307 template <class BVT, class BET, class BFT, class BTT,
00308 template <typename> class A = TetraDefaultDeriver, template <typename> class B = TetraDefaultDeriver,
00309 template <typename> class C = TetraDefaultDeriver, template <typename> class D = TetraDefaultDeriver,
00310 template <typename> class E = TetraDefaultDeriver, template <typename> class F = TetraDefaultDeriver,
00311 template <typename> class G = TetraDefaultDeriver, template <typename> class H = TetraDefaultDeriver,
00312 template <typename> class I = TetraDefaultDeriver >
00313 class TetraSimp3: public TetraArityMax<BVT,BET,BFT,BTT, A, B, C, D, E, F, G, H, I> {};
00314 class DumTT;
00315 template <class BVT, class BET, class BFT,
00316 template <typename> class A = TetraDefaultDeriver, template <typename> class B = TetraDefaultDeriver,
00317 template <typename> class C = TetraDefaultDeriver, template <typename> class D = TetraDefaultDeriver,
00318 template <typename> class E = TetraDefaultDeriver, template <typename> class F = TetraDefaultDeriver,
00319 template <typename> class G = TetraDefaultDeriver, template <typename> class H = TetraDefaultDeriver,
00320 template <typename> class I = TetraDefaultDeriver >
00321 class TetraSimp2: public TetraArityMax<BVT,BET,BFT,DumTT, A, B, C, D, E, F, G, H, I> {};
00322
00323
00324 }
00325 #endif
00326