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_VERTEX_PLUS
00027 #define __VCG_VERTEX_PLUS
00028
00029 namespace vcg {
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 template <class UserTypes,
00055 template <typename> class A, template <typename> class B,
00056 template <typename> class C, template <typename> class D,
00057 template <typename> class E, template <typename> class F,
00058 template <typename> class G, template <typename> class H,
00059 template <typename> class I, template <typename> class J,
00060 template <typename> class K, template <typename> class L>
00061 class VertexArityMax: public Arity12<vertex::EmptyCore<UserTypes>, A, B, C, D, E, F, G, H, I, J, K, L> {
00062
00063
00064 public:
00065
00066
00067
00068 enum {
00069
00070 DELETED = 0x0001,
00071 NOTREAD = 0x0002,
00072 NOTWRITE = 0x0004,
00073 MODIFIED = 0x0008,
00074 VISITED = 0x0010,
00075 SELECTED = 0x0020,
00076 BORDER = 0x0100,
00077 USER0 = 0x0200
00078 };
00079
00080 bool IsD() const {return (this->cFlags() & DELETED) != 0;}
00081 bool IsR() const {return (this->cFlags() & NOTREAD) == 0;}
00082 bool IsW() const {return (this->cFlags() & NOTWRITE)== 0;}
00083 bool IsRW() const {return (this->cFlags() & (NOTREAD | NOTWRITE)) == 0;}
00084 bool IsS() const {return (this->cFlags() & SELECTED) != 0;}
00085 bool IsB() const {return (this->cFlags() & BORDER) != 0;}
00086 bool IsV() const {return (this->cFlags() & VISITED) != 0;}
00087
00088
00092 void SetFlags(int flagp) {this->Flags()=flagp;}
00093
00097 void ClearFlags() {this->Flags()=0;}
00098 void SetD() {this->Flags() |=DELETED;}
00099 void ClearD() {this->Flags() &=(~DELETED);}
00100 void SetR() {this->Flags() &=(~NOTREAD);}
00101 void ClearR() {this->Flags() |=NOTREAD;}
00102 void ClearW() {this->Flags() |=NOTWRITE;}
00103 void SetW() {this->Flags() &=(~NOTWRITE);}
00104 void SetS() {this->Flags() |=SELECTED;}
00105 void ClearS() {this->Flags() &= ~SELECTED;}
00106 void SetB() {this->Flags() |=BORDER;}
00107 void ClearB() {this->Flags() &=~BORDER;}
00108 void SetV() {this->Flags() |=VISITED;}
00109 void ClearV() {this->Flags() &=~VISITED;}
00110
00112 static int &FirstUnusedBitFlag()
00113 {
00114 static int b =USER0;
00115 return b;
00116 }
00117
00119 static inline int NewBitFlag()
00120 {
00121 int bitForTheUser = FirstUnusedBitFlag();
00122 FirstUnusedBitFlag()=FirstUnusedBitFlag()<<1;
00123 return bitForTheUser;
00124 }
00125
00127
00128 static inline bool DeleteBitFlag(int bitval)
00129 {
00130 if(FirstUnusedBitFlag()>>1==bitval) {
00131 FirstUnusedBitFlag() = FirstUnusedBitFlag()>>1;
00132 return true;
00133 }
00134 assert(0);
00135 return false;
00136 }
00137
00139 bool IsUserBit(int userBit){return (this->Flags() & userBit) != 0;}
00140
00142 void SetUserBit(int userBit){this->Flags() |=userBit;}
00143
00145 void ClearUserBit(int userBit){this->Flags() &= (~userBit);}
00146
00147 template<class BoxType>
00148 void GetBBox( BoxType & bb ) const
00149 { bb.Set(this->cP()); }
00150
00151 };
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179
00180
00181
00182
00183 template <class UserTypes,
00184 template <typename> class A = DefaultDeriver, template <typename> class B = DefaultDeriver,
00185 template <typename> class C = DefaultDeriver, template <typename> class D = DefaultDeriver,
00186 template <typename> class E = DefaultDeriver, template <typename> class F = DefaultDeriver,
00187 template <typename> class G = DefaultDeriver, template <typename> class H = DefaultDeriver,
00188 template <typename> class I = DefaultDeriver, template <typename> class J = DefaultDeriver,
00189 template <typename> class K = DefaultDeriver, template <typename> class L = DefaultDeriver>
00190 class Vertex: public VertexArityMax<UserTypes, A, B, C, D, E, F, G, H, I, J, K, L> {
00191 public: typedef AllTypes::AVertexType IAm; typedef UserTypes TypesPool;};
00192
00193 }
00194 #endif