24 #error "This file should not be included alone. It is automatically included by complex.h"
26 #ifndef __VCG_VERTEX_PLUS_COMPONENT
27 #define __VCG_VERTEX_PLUS_COMPONENT
38 struct CurvatureDirBaseType{
39 typedef Point3<S> VecType;
41 CurvatureDirBaseType () {}
42 Point3<S>max_dir,min_dir;
48 template <
class TT>
class EmptyCore:
public TT {
51 int &Flags() { assert(0);
static int dummyflags(0);
return dummyflags; }
52 int cFlags()
const {
return 0; }
53 static bool HasFlags() {
return false; }
55 typedef vcg::Point3f CoordType;
56 typedef CoordType::ScalarType ScalarType;
57 CoordType &P() { assert(0);
static CoordType coord(0, 0, 0);
return coord; }
58 CoordType cP()
const { assert(0);
static CoordType coord(0, 0, 0); assert(0);
return coord; }
59 static bool HasCoord() {
return false; }
60 inline bool IsCoordEnabled()
const {
return TT::VertexType::HasCoord();}
62 typedef vcg::Point3s NormalType;
63 NormalType &N() { assert(0);
static NormalType dummy_normal(0, 0, 0);
return dummy_normal; }
64 NormalType cN()
const { assert(0);
static NormalType dummy_normal(0, 0, 0);
return dummy_normal; }
65 static bool HasNormal() {
return false; }
66 inline bool IsNormalEnabled()
const {
return TT::VertexType::HasNormal();}
68 typedef float QualityType;
69 QualityType &Q() { assert(0);
static QualityType dummyQuality(0);
return dummyQuality; }
70 QualityType cQ()
const { assert(0);
static QualityType dummyQuality(0);
return dummyQuality; }
71 static bool HasQuality() {
return false; }
72 inline bool IsQualityEnabled()
const {
return TT::VertexType::HasQuality();}
74 typedef vcg::Color4b ColorType;
75 ColorType &C() {
static ColorType dumcolor(vcg::Color4b::White); assert(0);
return dumcolor; }
76 ColorType cC()
const {
static ColorType dumcolor(vcg::Color4b::White); assert(0);
return dumcolor; }
77 static bool HasColor() {
return false; }
78 inline bool IsColorEnabled()
const {
return TT::VertexType::HasColor();}
82 int cIMark()
const { assert(0);
static int tmp=-1;
return tmp;}
83 int &IMark() { assert(0);
static int tmp=-1;
return tmp;}
84 static bool HasMark() {
return false; }
85 inline bool IsMarkEnabled()
const {
return TT::VertexType::HasMark();}
87 typedef ScalarType RadiusType;
88 RadiusType &R() {
static ScalarType v = 0.0; assert(0 &&
"the radius component is not available");
return v; }
89 RadiusType cR()
const {
static const ScalarType v = 0.0; assert(0 &&
"the radius component is not available");
return v; }
90 static bool HasRadius() {
return false; }
91 inline bool IsRadiusEnabled()
const {
return TT::VertexType::HasRadius();}
93 typedef vcg::TexCoord2<float,1> TexCoordType;
94 TexCoordType &T() {
static TexCoordType dummy_texcoord; assert(0);
return dummy_texcoord; }
95 TexCoordType cT()
const {
static TexCoordType dummy_texcoord; assert(0);
return dummy_texcoord; }
96 static bool HasTexCoord() {
return false; }
97 inline bool IsTexCoordEnabled()
const {
return TT::VertexType::HasTexCoord();}
99 typename TT::TetraPointer &VTp() {
static typename TT::TetraPointer tp = 0; assert(0);
return tp; }
100 typename TT::TetraPointer cVTp()
const {
static typename TT::TetraPointer tp = 0; assert(0);
return tp; }
101 int &VTi() {
static int z = 0; assert(0);
return z; }
102 int cVTi()
const {
static int z = 0; assert(0);
return z; }
103 static bool HasVTAdjacency() {
return false; }
104 bool IsVTInitialized()
const {
return static_cast<const typename TT::VertexType *
>(
this)->cVTi()!=-1;}
106 if(IsVTInitialized()) {
107 static_cast<typename TT::VertexPointer
>(
this)->VTp()=0;
108 static_cast<typename TT::VertexPointer
>(
this)->VTi()=-1;
112 typename TT::FacePointer &VFp() {
static typename TT::FacePointer fp=0; assert(0);
return fp; }
113 typename TT::FacePointer cVFp()
const {
static typename TT::FacePointer fp=0; assert(0);
return fp; }
114 int &VFi() {
static int z=-1; assert(0);
return z;}
115 int cVFi()
const {
static int z=-1; assert(0);
return z;}
116 bool IsNull()
const {
return true; }
117 static bool HasVFAdjacency() {
return false; }
118 bool IsVFInitialized()
const {
return static_cast<const typename TT::VertexType *
>(
this)->cVFi()!=-1;}
120 if(IsVFInitialized()) {
121 static_cast<typename TT::VertexPointer
>(
this)->VFp()=0;
122 static_cast<typename TT::VertexPointer
>(
this)->VFi()=-1;
126 typename TT::EdgePointer &VEp() {
static typename TT::EdgePointer ep=0; assert(0);
return ep; }
127 typename TT::EdgePointer cVEp()
const {
static typename TT::EdgePointer ep=0; assert(0);
return ep; }
128 int &VEi() {
static int z=-1;
return z;}
129 int cVEi()
const {
static int z=-1;
return z;}
130 static bool HasVEAdjacency() {
return false; }
131 bool IsVEInitialized()
const {
return static_cast<const typename TT::VertexType *
>(
this)->cVEi()!=-1;}
133 if(IsVEInitialized()) {
134 static_cast<typename TT::VertexPointer
>(
this)->VEp()=0;
135 static_cast<typename TT::VertexPointer
>(
this)->VEi()=-1;
138 typename TT::HEdgePointer &VHp() {
static typename TT::HEdgePointer ep=0; assert(0);
return ep; }
139 typename TT::HEdgePointer cVHp()
const {
static typename TT::HEdgePointer ep=0; assert(0);
return ep; }
140 int &VHi() {
static int z=0;
return z;}
141 int cVHi()
const {
static int z=0;
return z;}
142 static bool HasVHAdjacency() {
return false; }
144 typedef float CurScalarType;
145 typedef float ScalarTypeCur;
146 typedef Point3f CurVecType;
147 typedef Point2f CurvatureType;
148 float &Kh() {
static float dummy = 0.f; assert(0);
return dummy;}
149 float &Kg() {
static float dummy = 0.f; assert(0);
return dummy;}
150 float cKh()
const {
static float dummy = 0.f; assert(0);
return dummy;}
151 float cKg()
const {
static float dummy = 0.f; assert(0);
return dummy;}
153 typedef CurvatureDirBaseType<float> CurvatureDirType;
154 CurVecType &PD1() {
static CurVecType v(0,0,0); assert(0);
return v;}
155 CurVecType &PD2() {
static CurVecType v(0,0,0); assert(0);
return v;}
156 CurVecType cPD1()
const {
static CurVecType v(0,0,0); assert(0);
return v;}
157 CurVecType cPD2()
const {
static CurVecType v(0,0,0); assert(0);
return v;}
159 CurScalarType &K1() {
static ScalarType v = 0.0;assert(0);
return v;}
160 CurScalarType &K2() {
static ScalarType v = 0.0;assert(0);
return v;}
161 CurScalarType cK1()
const {
static ScalarType v = 0.0;assert(0);
return v;}
162 CurScalarType cK2()
const {
static ScalarType v = 0.0;assert(0);
return v;}
164 static bool HasCurvature() {
return false; }
165 static bool HasCurvatureDir() {
return false; }
166 inline bool IsCurvatureEnabled()
const {
return TT::VertexType::HasCurvature();}
167 inline bool IsCurvatureDirEnabled()
const {
return TT::VertexType::HasCurvatureDir();}
169 template <
class RightValueType>
170 void ImportData(
const RightValueType & ) {
173 static void Name(std::vector<std::string> & name){TT::Name(name);}
181 template <
class A,
class T>
class Coord:
public T {
184 typedef typename A::ScalarType ScalarType;
186 inline const CoordType &
P()
const {
return _coord; }
188 inline CoordType &
P() {
return _coord; }
190 inline CoordType
cP()
const {
return _coord; }
192 template <
class RightValueType>
193 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsCoordEnabled())
P().Import(rVert.cP()); T::ImportData( rVert); }
194 static bool HasCoord() {
return true; }
195 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Coord"));T::Name(name);}
202 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Coord3f"));T::Name(name);}
206 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Coord3d"));T::Name(name);}
221 template <
class A,
class T>
class Normal:
public T {
223 typedef A NormalType;
225 inline const NormalType &
N()
const {
return _norm; }
227 inline NormalType &
N() {
return _norm; }
229 inline NormalType
cN()
const {
return _norm; }
230 template <
class RightValueType>
231 void ImportData(
const RightValueType & rVert ){
232 if(rVert.IsNormalEnabled())
N().Import(rVert.cN());
233 T::ImportData( rVert);
235 static bool HasNormal() {
return true; }
236 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Normal"));T::Name(name);}
242 template <
class T>
class Normal3s:
public Normal<vcg::Point3s, T> {
243 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Normal3s"));T::Name(name);}
247 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Normal3f"));T::Name(name);}
251 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Normal3d"));T::Name(name);}
261 template <
class T>
class Mark:
public T {
265 inline const int &
IMark()
const {
return _imark;}
267 inline int &
IMark() {
return _imark;}
269 inline int cIMark()
const {
return _imark;}
270 static bool HasMark() {
return true; }
271 inline void InitIMark() { _imark = 0; }
272 template <
class RightValueType>
273 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsMarkEnabled())
IMark() = rVert.cIMark(); T::ImportData( rVert); }
274 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Mark"));T::Name(name);}
294 template <
class A,
class TT>
class TexCoord:
public TT {
296 typedef A TexCoordType;
299 const TexCoordType &
T()
const {
return _t; }
300 TexCoordType &
T() {
return _t; }
301 TexCoordType cT()
const {
return _t; }
302 template <
class RightValueType>
303 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsTexCoordEnabled())
T().Import(rVert.cT()); TT::ImportData(rVert); }
304 static bool HasTexCoord() {
return true; }
305 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"TexCoord"));TT::Name(name);}
312 template <
class TT>
class TexCoord2s:
public TexCoord<TexCoord2<short,1>, TT> {
313 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"TexCoord2s"));TT::Name(name);}
317 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"TexCoord2f"));TT::Name(name);}
321 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"TexCoord2d"));TT::Name(name);}
334 typedef int FlagType;
335 inline const int &Flags()
const {
return _flags; }
336 inline int &Flags() {
return _flags; }
337 inline int cFlags()
const {
return _flags; }
338 template <
class RightValueType>
339 void ImportData(
const RightValueType & rVert ) {
if(RightValueType::HasFlags()) Flags() = rVert.cFlags(); T::ImportData( rVert); }
340 static bool HasFlags() {
return true; }
341 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"BitFlags"));T::Name(name);}
354 template <
class A,
class T>
class Color:
public T {
356 Color():_color(vcg::Color4b::White) {}
358 inline const ColorType &C()
const {
return _color; }
359 inline ColorType &C() {
return _color; }
360 inline ColorType cC()
const {
return _color; }
361 template <
class RightValueType>
362 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsColorEnabled()) C() = rVert.cC(); T::ImportData( rVert); }
363 static bool HasColor() {
return true; }
364 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Color"));T::Name(name);}
370 template <
class TT>
class Color4b:
public Color<vcg::Color4b, TT> {
371 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Color4b"));TT::Name(name);}
382 template <
class A,
class TT>
class Quality:
public TT {
384 typedef A QualityType;
387 inline const QualityType &Q()
const {
return _quality; }
388 inline QualityType &Q() {
return _quality; }
389 inline QualityType cQ()
const {
return _quality; }
390 template <
class RightValueType>
391 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsQualityEnabled()) Q() = rVert.cQ(); TT::ImportData( rVert); }
392 static bool HasQuality() {
return true; }
393 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Quality"));TT::Name(name);}
396 QualityType _quality;
399 template <
class TT>
class Qualitys:
public Quality<short, TT> {
400 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Qualitys"));TT::Name(name);}
402 template <
class TT>
class Qualityf:
public Quality<float, TT> {
403 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Qualityf"));TT::Name(name);}
405 template <
class TT>
class Qualityd:
public Quality<double, TT> {
406 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Qualityd"));TT::Name(name);}
414 template <
class A,
class TT>
class Curvature:
public TT {
416 typedef Point2<A> CurvatureType;
417 typedef typename CurvatureType::ScalarType ScalarTypeCur;
418 const ScalarTypeCur &Kh()
const {
return _hk[0]; }
419 const ScalarTypeCur &Kg()
const {
return _hk[1]; }
420 ScalarTypeCur &Kh() {
return _hk[0]; }
421 ScalarTypeCur &Kg() {
return _hk[1]; }
422 ScalarTypeCur cKh()
const {
return _hk[0]; }
423 ScalarTypeCur cKg()
const {
return _hk[1]; }
425 template <
class RightValueType>
426 void ImportData(
const RightValueType & rVert ) {
427 if(rVert.IsCurvatureEnabled()) {
431 TT::ImportData( rVert);
434 static bool HasCurvature() {
return true; }
435 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Curvature"));TT::Name(name);}
442 template <
class T>
class Curvaturef:
public Curvature< float, T> {
443 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Curvaturef"));T::Name(name);}
445 template <
class T>
class Curvatured:
public Curvature<double , T> {
446 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Curvatured"));T::Name(name);}
457 typedef A CurvatureDirType;
458 typedef typename CurvatureDirType::VecType CurVecType;
459 typedef typename CurvatureDirType::ScalarType CurScalarType;
461 CurVecType &PD1(){
return _curv.max_dir; }
462 CurVecType &PD2(){
return _curv.min_dir; }
463 const CurVecType &cPD1()
const {
return _curv.max_dir; }
464 const CurVecType &cPD2()
const {
return _curv.min_dir; }
466 CurScalarType &K1(){
return _curv.k1; }
467 CurScalarType &K2(){
return _curv.k2; }
468 const CurScalarType &cK1()
const {
return _curv.k1; }
469 const CurScalarType &cK2()
const {
return _curv.k2; }
470 template <
class RightValueType>
471 void ImportData(
const RightValueType & rVert ) {
472 if(rVert.IsCurvatureDirEnabled()) {
473 PD1().Import(rVert.cPD1());
474 PD2().Import(rVert.cPD2());
475 K1() = rVert.cK1(); K2() = rVert.cK2();
477 TT::ImportData( rVert);
480 static bool HasCurvatureDir() {
return true; }
481 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"CurvatureDir"));TT::Name(name);}
484 CurvatureDirType _curv;
488 template <
class T>
class CurvatureDirf:
public CurvatureDir<CurvatureDirBaseType<float>, T> {
489 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"CurvatureDirf"));T::Name(name);}
491 template <
class T>
class CurvatureDird:
public CurvatureDir<CurvatureDirBaseType<double>, T> {
492 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"CurvatureDird"));T::Name(name);}
500 template <
class A,
class TT>
class Radius:
public TT {
502 typedef A RadiusType;
503 const RadiusType &R()
const {
return _radius; }
504 RadiusType &R() {
return _radius; }
505 RadiusType cR()
const {
return _radius; }
506 template <
class RightValueType>
507 void ImportData(
const RightValueType & rVert ) {
if(rVert.IsRadiusEnabled()) R() = rVert.cR(); TT::ImportData( rVert); }
508 static bool HasRadius() {
return true; }
509 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Radius"));TT::Name(name);}
515 template <
class TT>
class Radiusf:
public Radius<float, TT> {
516 public:
static void Name(std::vector<std::string> & name){name.push_back(std::string(
"Radiusf"));TT::Name(name);}
528 template <
class T>
class VEAdj:
public T {
530 VEAdj(){_ep=0;_zp=-1;}
531 typename T::EdgePointer &VEp() {
return _ep; }
532 typename T::EdgePointer cVEp()
const {
return _ep; }
533 int &VEi() {
return _zp; }
534 int cVEi()
const {
return _zp; }
535 template <
class RightValueType>
536 void ImportData(
const RightValueType & rVert ) { T::ImportData( rVert); }
537 static bool HasVEAdjacency() {
return true; }
538 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"VEAdj"));T::Name(name);}
541 typename T::EdgePointer _ep ;
556 template <
class T>
class VFAdj:
public T {
558 VFAdj(){_fp=0;_zp=-1;}
559 typename T::FacePointer &VFp() {
return _fp; }
560 typename T::FacePointer cVFp()
const {
return _fp; }
561 int &VFi() {
return _zp; }
562 int cVFi()
const {
return _zp; }
563 bool IsNull()
const {
return _zp==-1;}
564 template <
class RightValueType>
565 void ImportData(
const RightValueType & rVert ) { T::ImportData( rVert); }
566 static bool HasVFAdjacency() {
return true; }
567 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"VFAdj"));T::Name(name);}
570 typename T::FacePointer _fp ;
576 template <
class T>
class VHAdj:
public T {
578 VHAdj(){_hp=0;_zp=-1;}
579 typename T::HEdgePointer &VHp() {
return _hp; }
580 typename T::HEdgePointer cVHp()
const {
return _hp; }
581 int &VHi() {
return _zp; }
582 template <
class RightValueType>
583 void ImportData(
const RightValueType & rVert ) { T::ImportData( rVert); }
584 static bool HasVHAdjacency() {
return true; }
585 static void Name(std::vector<std::string> & name){name.push_back(std::string(
"VHAdj"));T::Name(name);}
588 typename T::HEdgePointer _hp ;
594 template <
class T>
class VTAdj:
public T {
596 VTAdj() { _tp = 0; _zp=-1;}
597 typename T::TetraPointer &VTp() {
return _tp; }
598 typename T::TetraPointer cVTp()
const {
return _tp; }
599 int &VTi() {
return _zp; }
600 int cVTi()
const {
return _zp; }
601 static bool HasVTAdjacency() {
return true; }
602 static void Name( std::vector< std::string > & name ) { name.push_back( std::string(
"VTAdj") ); T::Name(name); }
605 typename T::TetraPointer _tp ;