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