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 #ifndef __VCG_MESH
00037 #error "This file should not be included alone. It is automatically included by complex.h"
00038 #endif
00039 #ifndef __VCG_VERTEX_PLUS_COMPONENT_OCC
00040 #define __VCG_VERTEX_PLUS_COMPONENT_OCC
00041
00042 namespace vcg {
00043 namespace vertex {
00044
00045
00046
00047
00048
00049
00050
00051
00052 template <class A, class T> class CoordOcc: public T {
00053 public:
00054 typedef A CoordType;
00055 typedef typename CoordType::ScalarType ScalarType;
00056 typedef typename T::VertType VertType;
00057 CoordType &P() { return CAT< vector_occ<VertType>,CoordType>::Instance()->Get((VertType*)this); }
00058 };
00059 template <class T> class Coord3fOcc: public CoordOcc<vcg::Point3f, T> {};
00060 template <class T> class Coord3dOcc: public CoordOcc<vcg::Point3d, T> {};
00061
00062
00063
00064
00065 template <class A, class T> class NormalOcc: public T {
00066 public:
00067 typedef A NormalType;
00068 typedef typename T::VertType VertType;
00069 NormalType &N() {return CAT< vector_occ<VertType>,NormalType>::Instance()->Get((VertType*)this); }
00070
00071
00072 };
00073
00074 template <class T> class Normal3sOcc: public NormalOcc<vcg::Point3s, T> {};
00075 template <class T> class Normal3fOcc: public NormalOcc<vcg::Point3f, T> {};
00076 template <class T> class Normal3dOcc: public NormalOcc<vcg::Point3d, T> {};
00077
00078
00079
00080 template <class A, class TT> class TexCoordOcc: public TT {
00081 public:
00082 typedef A TexCoordType;
00083 typedef typename TT::VertType VertType;
00084 TexCoordType &T() {return CAT< vector_occ<VertType>,TexCoordType>::Instance()->Get((VertType*)this); }
00085 static bool HasTexCoord() { return true; }
00086 static bool HasTexCoordOcc() { return true; }
00087
00088
00089
00090 };
00091
00092 template <class T> class TexCoord2sOcc: public TexCoordOcc<TexCoord2<short,1>, T> {};
00093 template <class T> class TexCoord2fOcc: public TexCoordOcc<TexCoord2<float,1>, T> {};
00094 template <class T> class TexCoord2dOcc: public TexCoordOcc<TexCoord2<double,1>, T> {};
00095
00097
00098 template <class T> class FlagOcc: public T {
00099 public:
00100 typedef typename T::VertType VertType;
00101 int &Flags() {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
00102 const int Flags() const {return CAT< vector_occ<VertType>,int>::Instance()->Get((VertType*)this); }
00103 static bool HasFlags() {return true;}
00104 static bool HasFlagsOcc() {return true;}
00105
00106
00107 };
00108
00110
00111 template <class A, class T> class ColorOcc: public T {
00112 public:
00113 typedef A ColorType;
00114 typedef typename T::VertType VertType;
00115 ColorType &C() { return CAT< vector_occ<VertType>,ColorType>::Instance()->Get((VertType*)this); }
00116 static bool HasColor() { return true; }
00117
00118
00119 };
00120
00121 template <class T> class Color4bOcc: public ColorOcc<vcg::Color4b, T> {};
00122
00124
00125 template <class A, class T> class QualityOcc: public T {
00126 public:
00127 typedef A QualityType;
00128 typedef typename T::VertType VertType;
00129 QualityType &Q() { return CAT< vector_occ<VertType>,QualityType>::Instance()->Get((VertType*)this);}
00130 static bool HasQuality() { return true; }
00131
00132
00133
00134 };
00135
00136 template <class T> class QualitysOcc: public QualityOcc<short, T> {};
00137 template <class T> class QualityfOcc: public QualityOcc<float, T> {};
00138 template <class T> class QualitydOcc: public QualityOcc<double, T> {};
00139
00140
00142
00143 template <class A, class TT> class CurvatureOcc: public TT {
00144 public:
00145 typedef Point2<A> CurvatureTypeOcc;
00146 typedef typename TT::VertType VertType;
00147 typedef typename CurvatureTypeOcc::ScalarType ScalarTypeCur;
00148
00149 ScalarTypeCur &H(){ return CAT< vector_occ<VertType>, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0]; }
00150 ScalarTypeCur &K(){ return CAT< vector_occ<VertType>, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1]; }
00151 const ScalarTypeCur &cH() const { return CAT< vector_occ<VertType>, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0]; }
00152 const ScalarTypeCur &cK() const { return CAT< vector_occ<VertType>, CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1]; }
00153
00154 template <class LeftV>
00155 void ImportData(const LeftV & leftV){
00156 CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH();
00157 CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK();
00158 TT::ImporLocal(leftV);
00159 }
00160
00161 static bool HasCurvature() { return true; }
00162 static bool HasCurvatureOcc() { return true; }
00163 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureOcc"));TT::Name(name);}
00164
00165 private:
00166 };
00167
00168 template <class T> class CurvaturefOcc: public CurvatureOcc<float, T> {
00169 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturefOcc"));T::Name(name);}
00170 };
00171 template <class T> class CurvaturedOcc: public CurvatureOcc<double, T> {
00172 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvaturedOcc"));T::Name(name);}
00173 };
00174
00175
00176
00177
00178 template <class S>
00179 struct CurvatureDirTypeOcc{
00180 typedef Point3<S> VecType;
00181 typedef S ScalarType;
00182 CurvatureDirTypeOcc () {}
00183 Point3<S>max_dir,min_dir;
00184 S k1,k2;
00185 };
00186
00187
00188 template <class A, class TT> class CurvatureDirOcc: public TT {
00189 public:
00190 typedef A CurvatureDirTypeOcc;
00191 typedef typename CurvatureDirTypeOcc::VecType CurVecType;
00192 typedef typename CurvatureDirTypeOcc::ScalarType CurScalarType;
00193 typedef typename TT::VertType VertType;
00194
00195 CurVecType &PD1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
00196 CurVecType &PD2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
00197 const CurVecType &cPD1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).max_dir;}
00198 const CurVecType &cPD2() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).min_dir;}
00199
00200 CurScalarType &K1(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
00201 CurScalarType &K2(){ return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
00202 const CurScalarType &cK1() const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k1;}
00203 const CurScalarType &cK2()const {return CAT< vector_occ<VertType>,CurvatureDirTypeOcc>::Instance()->Get((VertType*)this).k2;}
00204
00205 static bool HasCurvatureDir() { return true; }
00206 static bool HasCurvatureDirOcc() { return true; }
00207 static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDir"));TT::Name(name);}
00208
00209 };
00210
00211
00212 template <class T> class CurvatureDirfOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<float>, T> {
00213 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDirf"));T::Name(name);}
00214 };
00215 template <class T> class CurvatureDirdOcc: public CurvatureDirOcc<CurvatureDirTypeOcc<double>, T> {
00216 public: static void Name(std::vector<std::string> & name){name.push_back(std::string("CurvatureDird"));T::Name(name);}
00217 };
00218
00219
00220
00221 template <class A, class TT> class RadiusOcc: public TT {
00222 public:
00223 typedef A RadiusType;
00224 typedef A ScalarType;
00225 typedef typename TT::VertType VertType;
00226
00227 RadiusType &R(){ return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);}
00228 const RadiusType &cR() const { return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);}
00229
00230 template <class LeftV>
00231 void ImportData(const LeftV & leftV){
00232 CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this) = leftV.cR();
00233 TT::ImporLocal(leftV);
00234 }
00235
00236 static bool HasRadius() { return true; }
00237 static bool HasRadiusOcc() { return true; }
00238 static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusOcc"));TT::Name(name);}
00239
00240 private:
00241 };
00242
00243 template <class T> class RadiusfOcc: public RadiusOcc<float, T> {
00244 static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusfOcc"));T::Name(name);}
00245 };
00246 template <class T> class RadiusdOcc: public RadiusOcc<double, T> {
00247 static void Name(std::vector<std::string> & name){name.push_back(std::string("RadiusdOcc"));T::Name(name);}
00248 };
00249
00251
00252 template <class T> class VFAdjOcc: public T {
00253 public:
00254 typedef typename T::VertType VertType;
00255 typedef typename T::FacePointer FacePointer;
00256 FacePointer &Fp() {return CAT< vector_occ<VertType>,FacePointer>::Instance()->Get((VertType*)this); }
00257 int &Zp() {return _zp; }
00258 static bool HasVFAdjacency() { return true; }
00259 private:
00260 typename T::FacePointer _fp ;
00261 int _zp ;
00262 };
00263
00264 }
00265 }
00266 #endif