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