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
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054 #ifndef __VCG_FACE_PLUS_COMPONENT_OCC
00055 #define __VCG_FACE_PLUS_COMPONENT_OCC
00056
00057 #include <vcg/simplex/face/component.h>
00058 #include <vcg/container/vector_occ.h>
00059 #include <vcg/space/plane3.h>
00060
00061
00062 namespace vcg {
00063 namespace face {
00064
00066
00067 template <class A, class T> class WedgeTexCoordOcc: public T {
00068 public:
00069 typedef A WedgeTexCoordType;
00070 typedef typename T::FaceType FaceType;
00071 WedgeTexCoordType &WT(const int&i) {return CAT< vector_occ<FaceType>,WedgeTexCoordType>::Instance()->Get((FaceType*)this);}
00072 static bool HasWedgeTexCoord() { return true; }
00073 static bool HasWedgeTexCoordOcc() { return true; }
00074 };
00075
00076 template <class T> class WedgeTexCoordfOcc: public WedgeTexCoordOcc<TexCoord2<float,1>, T> {};
00077
00079
00080 template <class A, class T> class InfoOccBase: public T {
00081 public:
00082 typedef A InfoType;
00083 typedef typename T::FaceType FaceType;
00084 InfoType &N() {return CAT< vector_occ<FaceType>,InfoType>::Instance()->Get((FaceType*)this);}
00085 static bool HasInfo() { return true; }
00086 static bool HasInfoOcc() { return true; }
00087 };
00088
00089 template <class T> class InfoOcc: public InfoOccBase<int, T> {};
00090
00092
00093 template <class A, class T> class NormalOcc: public T {
00094 public:
00095 typedef A NormalType;
00096 typedef typename T::FaceType FaceType;
00097 NormalType &N() {return CAT< vector_occ<FaceType>,NormalType>::Instance()->Get((FaceType*)this);}
00098 static bool HasFaceNormal() { return true; }
00099 static bool HasFaceNormalOcc() { return true; }
00100 };
00101
00102 template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
00103 template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
00104 template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
00105
00107
00108 template <class T> class MarkOcc: public T {
00109 public:
00110 typedef int MarkType;
00111 typedef typename T::FaceType FaceType;
00112 int &IMark() {return CAT< vector_occ<FaceType>,MarkType>::Instance()->Get((MarkType*)this);}
00113 static bool HasFaceMark() { return true; }
00114 static bool HasFaceMarkOcc() { return true; }
00115 inline void InitIMark() { IMark() = 0; }
00116 };
00117
00119
00120 template <class A, class T> class ColorOcc: public T {
00121 public:
00122 typedef A ColorType;
00123 typedef typename T::FaceType FaceType;
00124 ColorType &C() { return CAT< vector_occ<FaceType>,ColorType>::Instance()->Get((FaceType*)this); }
00125 static bool HasFaceColor() { return true; }
00126 static bool HasfaceColorOcc() { return true; }
00127 };
00128
00129 template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
00130
00131
00132
00133
00134
00135 template <class FP>
00136 struct VFAdjTypeSup {
00137 FP _vfp[3];
00138 char _vfi[3];
00139 };
00140
00141 template <class A, class T> class VFAdjOccBase: public T {
00142 public:
00143
00144 typedef VFAdjTypeSup<typename T::VertexPointer> VFAdjType;
00145 typedef typename T::FaceType FaceType;
00146 typedef typename T::FacePointer FacePointer;
00147
00148 FacePointer &VFp(const int j) {
00149 return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
00150
00151 FacePointer cVFp(const int j) const {
00152 return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfp[j];}
00153
00154 char &VFi(const int j) { return (CAT< vector_occ<FaceType>,VFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._vfi[j];}
00155
00156 static bool HasVFAdjacency() { return true; }
00157 static bool HasVFAdjacencyOcc() { return true; }
00158 };
00159
00160 template <class T> class VFAdjOcc : public VFAdjOccBase<VFAdjTypeSup<typename T::FacePointer>,T>{};
00161
00162
00163
00164
00165
00166 template <class FP>
00167 struct FFAdjTypeSup {
00168 FP _ffp[3];
00169 char _ffi[3];
00170 };
00171
00172 template <class A, class T> class FFAdjOccBase: public T {
00173 public:
00174
00175
00176 typedef FFAdjTypeSup<typename T::FacePointer> FFAdjType;
00177 typedef typename T::FaceType FaceType;
00178 typedef typename T::FacePointer FacePointer;
00179
00180 FacePointer &FFp(const int j) {
00181 return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
00182
00183 FacePointer const FFp(const int j) const {
00184 return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
00185
00186 FacePointer const cFFp(const int j) const {
00187 return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffp[j];}
00188
00189 char &FFi(const int j) {
00190 return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this))._ffi[j];}
00191
00192 char cFFi(const int j) const{
00193 return (CAT< vector_occ<FaceType>,FFAdjTypeSup<FacePointer> >::Instance()->Get((FaceType*)this ))._ffi[j];
00194 }
00195
00196 static bool HasFFAdjacency() { return true; }
00197 static bool HasFFAdjacencyOcc() { return true; }
00198
00199 };
00200
00201 template <class T> class FFAdjOcc : public FFAdjOccBase<FFAdjTypeSup<typename T::FacePointer>,T>{};
00202
00203 template <class T> class VertexRefOcc: public T {
00204 public:
00205
00206 typedef typename T::VertexType VertexType;
00207 typedef typename T::FaceType FaceType;
00208 typedef typename T::CoordType CoordType;
00209
00210 inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3);
00211 return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
00212
00213 inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3);
00214 return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
00215
00216 inline typename T::VertexType * const cV( const int j ) const { assert(j>=0 && j<3);
00217 return (CAT< vector_occ<FaceType>,VertexRef<T> >::Instance()->Get((FaceType*)this)).V(j); }
00218
00219
00220 inline typename T::CoordType & P( const int j ) { assert(j>=0 && j<3); return V(j)->P(); }
00221 inline const typename T::CoordType & P( const int j ) const { assert(j>=0 && j<3); return V(j)->cP(); }
00222 inline const typename T::CoordType &cP( const int j ) const { assert(j>=0 && j<3); return V(j)->cP(); }
00223
00227 inline VertexType * & V0( const int j ) { return V(j);}
00228 inline VertexType * & V1( const int j ) { return V((j+1)%3);}
00229 inline VertexType * & V2( const int j ) { return V((j+2)%3);}
00230 inline const VertexType * const & V0( const int j ) const { return V(j);}
00231 inline const VertexType * const & V1( const int j ) const { return V((j+1)%3);}
00232 inline const VertexType * const & V2( const int j ) const { return V((j+2)%3);}
00233 inline const VertexType * const & cV0( const int j ) const { return cV(j);}
00234 inline const VertexType * const & cV1( const int j ) const { return cV((j+1)%3);}
00235 inline const VertexType * const & cV2( const int j ) const { return cV((j+2)%3);}
00236
00238 inline CoordType & P0( const int j ) { return V(j)->P();}
00239 inline CoordType & P1( const int j ) { return V((j+1)%3)->P();}
00240 inline CoordType & P2( const int j ) { return V((j+2)%3)->P();}
00241 inline const CoordType & P0( const int j ) const { return V(j)->P();}
00242 inline const CoordType & P1( const int j ) const { return V((j+1)%3)->P();}
00243 inline const CoordType & P2( const int j ) const { return V((j+2)%3)->P();}
00244 inline const CoordType & cP0( const int j ) const { return cV(j)->P();}
00245 inline const CoordType & cP1( const int j ) const { return cV((j+1)%3)->P();}
00246 inline const CoordType & cP2( const int j ) const { return cV((j+2)%3)->P();}
00247
00248
00249
00250 static bool HasVertexRef() { return true; }
00251 };
00252 }
00253
00254 template < class, class, class > class TriMesh;
00255
00256 namespace tri
00257 {
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 };
00294 }
00295 #endif