ImportLocal to ImportData. Adjacencies are no more handle by ImportData, but

by speficic functions in append.h (ImportPerxxxAdj(..))
This commit is contained in:
ganovelli 2010-06-16 16:24:26 +00:00
parent e8d3020714
commit 585f0462e8
11 changed files with 147 additions and 283 deletions

View File

@ -45,7 +45,7 @@ template <class UserTypes>
public: public:
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & /* left */ ) { } void ImportData(const LeftV & /* left */ ) { }
static void Name(std::vector<std::string> & name){} static void Name(std::vector<std::string> & name){}
}; };

View File

@ -23,7 +23,7 @@
#ifndef __VCG_EDGE_PLUS_COMPONENT #ifndef __VCG_EDGE_PLUS_COMPONENT
#define __VCG_EDGE_PLUS_COMPONENT #define __VCG_EDGE_PLUS_COMPONENT
//#include <vector> #include <vector>
#include <string> #include <string>
//#include <vcg/space/point3.h> //#include <vcg/space/point3.h>
//#include <vcg/space/texcoord2.h> //#include <vcg/space/texcoord2.h>
@ -49,7 +49,7 @@ public:
inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType & P( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType &cP( const int j ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF) {T::ImportLocal(leftF);} void ImportData(const LeftF & leftF) {T::ImportData(leftF);}
static bool HasVertexRef() { return false; } static bool HasVertexRef() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
@ -91,7 +91,7 @@ public:
inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<2); return v[j]; } inline const typename T::VertexType * const & UberV( const int j ) const { assert(j>=0 && j<2); return v[j]; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ V(0) = NULL; V(1) = NULL; V(2) = NULL; T::ImportLocal(leftF);} void ImportData(const LeftF & leftF){ T::ImportData(leftF);}
static bool HasVertexRef() { return true; } static bool HasVertexRef() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
@ -113,7 +113,7 @@ public:
inline int & IMark() { assert(0); static int tmp=-1; return tmp;} inline int & IMark() { assert(0); static int tmp=-1; return tmp;}
inline const int & IMark() const {return 0;} inline const int & IMark() const {return 0;}
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -125,7 +125,7 @@ public:
inline int & IMark() { return _imark;} inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;} inline const int & IMark() const {return _imark;}
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { IMark() = left.IMark(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { IMark() = left.IMark(); T::ImportData( left); }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
@ -140,7 +140,7 @@ public:
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int Flags() const { return 0; } int Flags() const { return 0; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasFlags() { return false; } static bool HasFlags() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
@ -153,7 +153,7 @@ public:
int &Flags() {return _flags; } int &Flags() {return _flags; }
int Flags() const {return _flags; } int Flags() const {return _flags; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { Flags() = left.Flags(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { Flags() = left.Flags(); T::ImportData( left); }
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
@ -172,7 +172,7 @@ public:
typedef vcg::Color4b ColorType; typedef vcg::Color4b ColorType;
ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; } ColorType &C() { static ColorType dumcolor(vcg::Color4b::White); assert(0); return dumcolor; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasColor() { return false; } static bool HasColor() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -187,7 +187,7 @@ public:
const ColorType &C() const { return _color; } const ColorType &C() const { return _color; }
const ColorType &cC() const { return _color; } const ColorType &cC() const { return _color; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { C() = left.cC(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { C() = left.cC(); T::ImportData( left); }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
@ -207,7 +207,7 @@ public:
QualityType &Q() { return _quality; } QualityType &Q() { return _quality; }
const QualityType & cQ() const {return _quality; } const QualityType & cQ() const {return _quality; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { Q() = left.cQ(); TT::ImportLocal( left); } void ImportData(const LeftV & left ) { Q() = left.cQ(); TT::ImportData( left); }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
@ -228,11 +228,12 @@ public: static void Name(std::vector<std::string> & name){name.push_back(std::st
/*----------------------------- EVADJ ------------------------------*/ /*----------------------------- EVADJ ------------------------------*/
template <class T> class EmptyEVAdj: public T { template <class T> class EmptyEVAdj: public T {
public: public:
typename T::VertexPointer &V(const int &) { static typename T::VertexPointer ep=0; assert(0); return ep; } typename T::VertexPointer &EVp(const int &) { static typename T::VertexPointer ep=0; assert(0); return ep; }
typename T::VertexPointer cV(const int &) { static typename T::VertexPointer ep=0; assert(0); return ep; } typename T::VertexPointer const cEVp(const int &) const { static typename T::VertexPointer ep=0; assert(0); return ep; }
int &EVi(){static int z=0; return z;}; typename T::VertexPointer &V(const int &i) { return EVp(i);}
typename T::VertexPointer const cV(const int &i) const { return cEVp(i); }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEVAdjacency() { return false; } static bool HasEVAdjacency() { return false; }
static bool HasEVAdjacencyOcc() { return false; } static bool HasEVAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);} static void Name(std::vector<std::string> & name){ T::Name(name);}
@ -241,10 +242,13 @@ public:
template <class T> class EVAdj: public T { template <class T> class EVAdj: public T {
public: public:
EVAdj(){_vp[0]= _vp[1] =0;} EVAdj(){_vp[0]= _vp[1] =0;}
typename T::VertexPointer & V(const int & i) {return _vp[i]; } typename T::VertexPointer & EVp(const int & i) {return _vp[i]; }
const typename T::VertexPointer cV(const int & i) const {return _vp[i]; } typename T::VertexPointer const cEVp(const int & i) const {return _vp[i]; }
typename T::VertexPointer &V(const int &i) { return EVp(i);}
typename T::VertexPointer const cV(const int &i) const { return cEVp(i); }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { V() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEVAdjacency() { return true; } static bool HasEVAdjacency() { return true; }
static bool HasEVAdjacencyOcc() { return true; } static bool HasEVAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("EVAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("EVAdj"));T::Name(name);}
@ -258,10 +262,11 @@ private:
template <class T> class EmptyEEAdj: public T { template <class T> class EmptyEEAdj: public T {
public: public:
typename T::EdgePointer &EEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; } typename T::EdgePointer &EEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; }
typename T::EdgePointer cEEp(const int & ) { static typename T::EdgePointer ep=0; assert(0); return ep; } const typename T::EdgePointer cEEp(const int & ) const { static typename T::EdgePointer ep=0; assert(0); return ep; }
int &EEi(){static int z=0; return z;}; int &EEi(const int &){static int z=0; assert(0); return z;};
const int &cEEi(const int &) const {static int z=0; assert(0); return z;};
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEEAdjacency() { return false; } static bool HasEEAdjacency() { return false; }
static bool HasEEAdjacencyOcc() { return false; } static bool HasEEAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);} static void Name(std::vector<std::string> & name){ T::Name(name);}
@ -272,9 +277,11 @@ public:
EEAdj(){_ep=0;} EEAdj(){_ep=0;}
typename T::EdgePointer &EEp(const int & i) {return _ep[i]; } typename T::EdgePointer &EEp(const int & i) {return _ep[i]; }
typename T::EdgePointer cEEp(const int & i) {return _ep[i]; } typename T::EdgePointer cEEp(const int & i) {return _ep[i]; }
int &EEi(const int & i) {return _zp[i]; } int &EEi(const int & i){ return _zp[i];};
const int &cEEi(const int &i ){return _zp[i];};
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { EEp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEEAdjacency() { return true; } static bool HasEEAdjacency() { return true; }
static bool HasEEAdjacencyOcc() { return true; } static bool HasEEAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("EEAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("EEAdj"));T::Name(name);}
@ -289,10 +296,10 @@ private:
template <class T> class EmptyEHAdj: public T { template <class T> class EmptyEHAdj: public T {
public: public:
typename T::HEdgePointer &EHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; } typename T::HEdgePointer &EHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; }
typename T::HEdgePointer cEHp( ) { static typename T::HEdgePointer hp=0; assert(0); return hp; } const typename T::HEdgePointer cEHp( ) const { static typename T::HEdgePointer hp=0; assert(0); return hp; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEHAdjacency() { return false; } static bool HasEHAdjacency() { return false; }
static bool HasEHAdjacencyOcc() { return false; } static bool HasEHAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);} static void Name(std::vector<std::string> & name){ T::Name(name);}
@ -302,10 +309,10 @@ template <class T> class EHAdj: public T {
public: public:
EHAdj(){_hp=0;} EHAdj(){_hp=0;}
typename T::HEdgePointer &EHp( ) {return _hp ; } typename T::HEdgePointer &EHp( ) {return _hp ; }
typename T::HEdgePointer cEHp( ) {return _hp ; } const typename T::HEdgePointer cEHp( ) const {return _hp ; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { EHp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEHAdjacency() { return true; } static bool HasEHAdjacency() { return true; }
static bool HasEHAdjacencyOcc() { return true; } static bool HasEHAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("EHAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("EHAdj"));T::Name(name);}
@ -349,10 +356,11 @@ private:
template <class T> class EmptyEFAdj: public T { template <class T> class EmptyEFAdj: public T {
public: public:
typename T::FacePointer &EFp() { static typename T::FacePointer fp=0; assert(0); return fp; } typename T::FacePointer &EFp() { static typename T::FacePointer fp=0; assert(0); return fp; }
typename T::FacePointer cEFp() { static typename T::FacePointer fp=0; assert(0); return fp; } const typename T::FacePointer cEFp() const { static typename T::FacePointer fp=0; assert(0); return fp; }
int &EFi(){static int z=0; return z;}; int &EFi() {static int z=0; return z;};
const int &cEFi() const {static int z=0; return z;};
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEFAdjacency() { return false; } static bool HasEFAdjacency() { return false; }
static bool HasEFAdjacencyOcc() { return false; } static bool HasEFAdjacencyOcc() { return false; }
static void Name(std::vector<std::string> & name){ T::Name(name);} static void Name(std::vector<std::string> & name){ T::Name(name);}
@ -362,10 +370,11 @@ template <class T> class EFAdj: public T {
public: public:
EFAdj(){_fp=0;} EFAdj(){_fp=0;}
typename T::FacePointer &EFp() {return _fp; } typename T::FacePointer &EFp() {return _fp; }
typename T::FacePointer cEFp() {return _fp; } const typename T::FacePointer cEFp() const {return _fp; }
int &EFi() {return _zp; } int &EFi() {static int z=0; return z;};
const int &cEFi() const {return _zp; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { this->EFp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasEFAdjacency() { return true; } static bool HasEFAdjacency() { return true; }
static bool HasEFAdjacencyOcc() { return true; } static bool HasEFAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("EFAdj"));T::Name(name);}

View File

@ -20,57 +20,7 @@
* for more details. * * for more details. *
* * * *
****************************************************************************/ ****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.13 2008/02/03 23:49:42 cignoni
Important Change. Now GetBBox return a null bbox if called on a deleted face (instead of crashing)
Revision 1.12 2007/05/04 16:40:11 ganovelli
changes to comply "plus" types
Revision 1.11 2007/03/27 09:22:11 cignoni
Added Visited flags
Revision 1.10 2007/03/12 15:37:19 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.9 2007/02/12 19:01:23 ganovelli
added Name(std:vector<std::string>& n) that fills n with the names of the attribute of the face type
Revision 1.8 2006/10/09 20:20:18 cignoni
Increased the maximum number of possible template args from 8 to 9
Revision 1.7 2006/02/27 17:58:11 ponchio
Added some documentation
Revision 1.6 2005/12/16 13:28:09 cignoni
Increased the maximum number of possible template args from 7 to 8
Revision 1.5 2005/12/02 00:41:38 cignoni
Added and removed typenames for gcc compiling.
Added this-> qualifier for referencing the elemntes of the templated base class
(e.g. to refer the possibly overridden flags()) it seems to be needed by the standard
Revision 1.4 2005/11/16 22:56:32 cignoni
Added EmptyMark to base class
Standardized name of flags. It is plural becouse each simplex has many flag.
Revision 1.3 2005/11/12 18:42:18 cignoni
Added ClearS and GetBBox
Revision 1.2 2005/10/14 13:26:57 cignoni
First Really Working version
Revision 1.2 2004/04/03 13:33:55 cignoni
Missing include
Revision 1.1 2004/03/29 08:36:26 cignoni
First working version!
****************************************************************************/
#ifndef __VCG_FACE_PLUS #ifndef __VCG_FACE_PLUS
#define __VCG_FACE_PLUS #define __VCG_FACE_PLUS
@ -95,7 +45,7 @@ template <class UserTypes>
public: public:
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & ){} void ImportData(const LeftF & ){}
static void Name(std::vector<std::string> & /* name */){} static void Name(std::vector<std::string> & /* name */){}

View File

@ -25,7 +25,7 @@
$Log: not supported by cvs2svn $ $Log: not supported by cvs2svn $
Revision 1.21 2008/02/04 21:26:45 ganovelli Revision 1.21 2008/02/04 21:26:45 ganovelli
added ImportLocal which imports all local attributes into vertexplus and faceplus. added ImportData which imports all local attributes into vertexplus and faceplus.
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL. (i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
Added some function for const attributes Added some function for const attributes
@ -119,14 +119,20 @@ public:
inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * & V( const int ) { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * const & V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * const & V( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; } inline typename T::VertexType * cV( const int ) const { assert(0); static typename T::VertexType *vp=0; return vp; }
inline typename T::VertexType * & FVp( const int i ) { return this->V(i); }
inline typename T::VertexType * const & FVp( const int i) const { return this->V(i); }
inline typename T::VertexType * cFVp( const int i ) const { return this->cV(i); }
inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline typename T::CoordType & P( const int ) { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline const typename T::CoordType & P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType & P( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; } inline const typename T::CoordType &cP( const int ) const { assert(0); static typename T::CoordType coord(0, 0, 0); return coord; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF) {T::ImportLocal(rightF);} void ImportData(const RightF & rightF) {T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasVertexRef() { return false; } static bool HasVertexRef() { return false; }
static bool HasFVAdjacency() { return false; }
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
}; };
@ -143,7 +149,7 @@ public:
inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3); return v[j]; } inline typename T::VertexType * & V( const int j ) { assert(j>=0 && j<3); return v[j]; }
inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3); return v[j]; } inline typename T::VertexType * const & V( const int j ) const { assert(j>=0 && j<3); return v[j]; }
inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; } inline typename T::VertexType * cV( const int j ) const { assert(j>=0 && j<3); return v[j]; }
// Shortcut per accedere ai punti delle facce // Shortcut per accedere ai punti delle facce
inline CoordType & P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); } inline CoordType & P( const int j ) { assert(j>=0 && j<3); return v[j]->P(); }
@ -179,13 +185,15 @@ public:
// Small comment about the fact that the pointers are zero filled. // Small comment about the fact that the pointers are zero filled.
// The importLocal is meant for copyng stuff between very different meshes, so copying the pointers would be meaningless. // The importLocal is meant for copyng stuff between very different meshes, so copying the pointers would be meaningless.
// if you are using ImportLocal for copying internally simplex you have to set up all the pointers by hand. // if you are using ImportData for copying internally simplex you have to set up all the pointers by hand.
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ V(0) = NULL; V(1) = NULL; V(2) = NULL; T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasVertexRef() { return true; } static bool HasVertexRef() { return true; }
static bool HasFVAdjacency() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VertexRef"));T::Name(name);}
@ -207,7 +215,7 @@ public:
const NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; } const NormalType cWN(int) const { static NormalType dummy_normal(0, 0, 0); return dummy_normal; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
static bool HasWedgeNormal() { return false; } static bool HasWedgeNormal() { return false; }
static bool HasFaceNormal() { return false; } static bool HasFaceNormal() { return false; }
static bool HasWedgeNormalOcc() { return false; } static bool HasWedgeNormalOcc() { return false; }
@ -225,7 +233,7 @@ public:
NormalType &N() { return _norm; } NormalType &N() { return _norm; }
NormalType &cN() const { return _norm; } NormalType &cN() const { return _norm; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ N() = rightF.cN(); T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ N() = rightF.cN(); T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceNormal() { return true; } static bool HasFaceNormal() { return true; }
@ -250,10 +258,10 @@ public:
NormalType &N() { return _norm; } NormalType &N() { return _norm; }
NormalType cN() const { return _norm; } NormalType cN() const { return _norm; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF) void ImportData(const RightF & rightF)
{ {
N().Import(rightF.cN()); N().Import(rightF.cN());
T::ImportLocal( rightF); T::ImportData( rightF);
} }
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
@ -271,7 +279,7 @@ public:
NormalType &WN(const int j) { return _wnorm[j]; } NormalType &WN(const int j) { return _wnorm[j]; }
const NormalType cWN(const int j) const { return _wnorm[j]; } const NormalType cWN(const int j) const { return _wnorm[j]; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
@ -287,7 +295,7 @@ public:
NormalType &WN(const int i) { return _wn[i]; } NormalType &WN(const int i) { return _wn[i]; }
NormalType const &cWN(const int i) const { return _wn[i]; } NormalType const &cWN(const int i) const { return _wn[i]; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WN(i) = rightF.cWN(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
@ -327,7 +335,7 @@ public:
TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;} TexCoordType &WT(const int) { static TexCoordType dummy_texture; assert(0); return dummy_texture;}
TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;} TexCoordType const &cWT(const int) const { static TexCoordType dummy_texture; return dummy_texture;}
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeTexCoord() { return false; } static bool HasWedgeTexCoord() { return false; }
@ -342,7 +350,7 @@ public:
TexCoordType &WT(const int i) { return _wt[i]; } TexCoordType &WT(const int i) { return _wt[i]; }
TexCoordType const &cWT(const int i) const { return _wt[i]; } TexCoordType const &cWT(const int i) const { return _wt[i]; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); } T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ for (int i=0; i<3; ++i) { WT(i) = rightF.cWT(i); } T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasWedgeTexCoord() { return true; } static bool HasWedgeTexCoord() { return true; }
@ -369,7 +377,7 @@ public:
int &Flags() { static int dummyflags(0); assert(0); return dummyflags; } int &Flags() { static int dummyflags(0); assert(0); return dummyflags; }
int Flags() const { return 0; } int Flags() const { return 0; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFlags() { return false; } static bool HasFlags() { return false; }
@ -385,7 +393,7 @@ public:
int Flags() const {return _flags; } int Flags() const {return _flags; }
const int & cFlags() const {return _flags; } const int & cFlags() const {return _flags; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ Flags() = rightF.cFlags();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
@ -432,7 +440,7 @@ public:
static void Name(std::vector<std::string> & name){T::Name(name);} static void Name(std::vector<std::string> & name){T::Name(name);}
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
@ -444,7 +452,7 @@ public:
ColorType &C() { return _color; } ColorType &C() { return _color; }
const ColorType &cC() const { return _color; } const ColorType &cC() const { return _color; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ C() = rightF.cC();T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ C() = rightF.cC();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceColor() { return true; } static bool HasFaceColor() { return true; }
@ -462,7 +470,7 @@ public:
const ColorType &cWC(const int i) const { return _color[i]; } const ColorType &cWC(const int i) const { return _color[i]; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ if (RightF::HasWedgeColor()) { for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); } T::ImportLocal(rightF); } } void ImportData(const RightF & rightF){ if (RightF::HasWedgeColor()) { for (int i=0; i<3; ++i) { WC(i) = rightF.cWC(i); } T::ImportData(rightF); } }
static bool HasWedgeColor() { return true; } static bool HasWedgeColor() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("WedgeColor"));T::Name(name);}
@ -490,7 +498,7 @@ public:
QualityType &Q() { return _quality; } QualityType &Q() { return _quality; }
const QualityType &cQ() const { return _quality; } const QualityType &cQ() const { return _quality; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ if(RightF::HasFaceQuality()) Q() = rightF.cQ();T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ if(RightF::HasFaceQuality()) Q() = rightF.cQ();T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFaceQuality() { return true; } static bool HasFaceQuality() { return true; }
@ -519,7 +527,7 @@ public:
inline int & IMark() { return _imark;} inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;} inline const int & IMark() const {return _imark;}
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ IMark() = rightF.IMark();T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ IMark() = rightF.IMark();T::ImportData(rightF);}
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
@ -539,14 +547,14 @@ public:
typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; } typename T::FacePointer const cFFp(const int) const { static typename T::FacePointer const fp=0; return fp; }
typename T::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; } typename T::EdgePointer &FEp(const int) { static typename T::EdgePointer fp=0; assert(0); return fp; }
typename T::EdgePointer const cFEp(const int) const { static typename T::EdgePointer const fp=0; return fp; } typename T::EdgePointer const cFEp(const int) const { static typename T::EdgePointer const fp=0; return fp; }
typename T::HEdgePointer &FHp(const int) { static typename T::HEdgePointer fp=0; assert(0); return fp; } typename T::HEdgePointer &FHp() { static typename T::HEdgePointer fp=0; assert(0); return fp; }
typename T::HEdgePointer const cFHp(const int) const { static typename T::HEdgePointer const fp=0; return fp; } typename T::HEdgePointer const cFHp() const { static typename T::HEdgePointer const fp=0; assert(0);return fp; }
char &VFi(const int j){(void)j; static char z=0; assert(0); return z;}; char &VFi(const int j){(void)j; static char z=0; assert(0); return z;};
char &FFi(const int j){(void)j; static char z=0; assert(0); return z;}; char &FFi(const int j){(void)j; static char z=0; assert(0); return z;};
const char &cVFi(const int j){(void)j; static char z=0; return z;}; const char &cVFi(const int j){(void)j; static char z=0; return z;};
const char &cFFi(const int j) const {(void)j; static char z=0; return z;}; const char &cFFi(const int j) const {(void)j; static char z=0; return z;};
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){ T::ImportLocal(rightF);} void ImportData(const RightF & rightF){ T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasVFAdjacency() { return false; } static bool HasVFAdjacency() { return false; }
@ -575,7 +583,7 @@ public:
typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; } typename T::FacePointer const cVFp(const int j) const { assert(j>=0 && j<3); return _vfp[j]; }
char &VFi(const int j) {return _vfi[j]; } char &VFi(const int j) {return _vfi[j]; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){T::ImportLocal(rightF);} void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
@ -608,7 +616,7 @@ public:
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);} typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);}
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){T::ImportLocal(rightF);} void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
@ -642,7 +650,7 @@ public:
typename T::FacePointer const FEp2( const int j ) const { return FEp((j+2)%3);} typename T::FacePointer const FEp2( const int j ) const { return FEp((j+2)%3);}
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){T::ImportLocal(rightF);} void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFEAdjacency() { return true; } static bool HasFEAdjacency() { return true; }
@ -663,7 +671,7 @@ public:
typename T::HEdgePointer const cFHp( ) const { return _fh; } typename T::HEdgePointer const cFHp( ) const { return _fh; }
template <class RightF> template <class RightF>
void ImportLocal(const RightF & rightF){T::ImportLocal(rightF);} void ImportData(const RightF & rightF){T::ImportData(rightF);}
inline void Alloc(const int & ns){T::Alloc(ns);} inline void Alloc(const int & ns){T::Alloc(ns);}
inline void Dealloc(){T::Dealloc();} inline void Dealloc(){T::Dealloc();}
static bool HasFHAdjacency() { return true; } static bool HasFHAdjacency() { return true; }

View File

@ -19,94 +19,6 @@
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt) * * GNU General Public License (http://www.gnu.org/licenses/gpl.txt) *
* for more details. * * for more details. *
* * * *
****************************************************************************/
/****************************************************************************
History
$Log: not supported by cvs2svn $
Revision 1.25 2008/03/11 09:22:07 cignoni
Completed the garbage collecting functions CompactVertexVector and CompactFaceVector.
Revision 1.24 2008/02/28 15:41:17 cignoni
Added FFpi methods and better init of texture coords
Revision 1.23 2008/02/05 10:11:34 cignoni
A small typo (a T:: instead of TT::)
Revision 1.22 2008/02/04 21:26:45 ganovelli
added ImportLocal which imports all local attributes into vertexplus and faceplus.
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
Added some function for const attributes
Revision 1.21 2007/10/09 12:03:13 corsini
remove signed/unsigned warning
Revision 1.20 2007/03/12 15:37:19 tarini
Texture coord name change! "TCoord" and "Texture" are BAD. "TexCoord" is GOOD.
Revision 1.19 2006/11/28 22:34:28 cignoni
Added default constructor with null initialization to adjacency members.
AddFaces and AddVertices NEED to know if the topology is correctly computed to update it.
Revision 1.18 2006/11/07 11:29:24 cignoni
Corrected some errors in the reflections Has*** functions
Revision 1.17 2006/10/31 16:02:18 ganovelli
vesione 2005 compliant
Revision 1.16 2006/10/27 14:15:10 ganovelli
added overrides to HasFFAddAdjacency and HasVFAddAdjacency
Revision 1.15 2006/10/16 08:49:29 cignoni
Better managment of resize overloading when reducing the size of a vector
Revision 1.14 2006/10/09 20:20:55 cignoni
Added some missing Add***Ocf() for the default case.
Revision 1.13 2006/05/25 09:39:09 cignoni
missing std and other gcc detected syntax errors
Revision 1.12 2006/05/03 21:37:02 cignoni
Added Optional Mark
Revision 1.11 2006/02/28 11:59:39 ponchio
g++ compliance:
begin() -> (*this).begin() and for end(), size(), Base(), Index()
Revision 1.10 2006/01/30 08:47:40 cignoni
Corrected HasPerWedgeTexture
Revision 1.9 2006/01/05 15:46:06 cignoni
Removed a syntax error (double >) in HasPerWedgeTexture/HasPerFaceColor
Revision 1.8 2006/01/04 18:46:25 cignoni
Corrected push_back (did not worked at all!)
added missing cFFi
Revision 1.7 2006/01/03 10:54:21 cignoni
Corrected HasPerFaceColor and HasPerWedgeTexture to comply gcc
Revision 1.6 2005/12/12 11:17:32 cignoni
Corrected update function, now only the needed simplexes should be updated.
Revision 1.5 2005/11/26 00:16:44 cignoni
Corrected a lot of bugs about the use of enabled entities
Revision 1.4 2005/11/21 21:46:20 cignoni
Changed HasColor -> HasFaceColor and HasNormal ->HasFaceNormal
Revision 1.3 2005/11/16 22:43:36 cignoni
Added WedgeTexture component
Revision 1.2 2005/10/22 13:16:46 cignoni
Added a missing ';' in FFAdjOcf (thanks to Mario Latronico).
Revision 1.1 2005/10/14 15:07:58 cignoni
First Really Working version
****************************************************************************/ ****************************************************************************/
/* /*
@ -486,13 +398,8 @@ public:
} }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(leftF.Base().VFAdjacencyEnabled && this->Base().VFAdjacencyEnabled)// WRONG I do not know anything about leftV! T::ImportData(leftF);
if(this->Base().VFAdjacencyEnabled){
VFp(0) = NULL; VFp(1) = NULL; VFp(2) = NULL;
VFi(0) = -1; VFi(1) = -1; VFi(2) = -1;
}
T::ImportLocal(leftF);
} }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcf() { return true; } static bool HasVFAdjacencyOcf() { return true; }
@ -530,13 +437,8 @@ public:
typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);} typename T::FacePointer const FFp2( const int j ) const { return FFp((j+2)%3);}
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
// if(leftF.Base().FFAdjacencyEnabled && this->Base().FFAdjacencyEnabled) // WRONG I do not know anything about leftV! T::ImportData(leftF);
if(this->Base().FFAdjacencyEnabled) {
FFp(0) = NULL; FFp(1) = NULL; FFp(2) = NULL;
FFi(0) = -1; FFi(1) = -1; FFi(2) = -1;
}
T::ImportLocal(leftF);
} }
static bool HasFFAdjacency() { return true; } static bool HasFFAdjacency() { return true; }
static bool HasFFAdjacencyOcf() { return true; } static bool HasFFAdjacencyOcf() { return true; }
@ -562,10 +464,10 @@ public:
return (*this).Base().NV[(*this).Index()]; } return (*this).Base().NV[(*this).Index()]; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled) if((*this).Base().NormalEnabled && leftF.Base().NormalEnabled)
N() = leftF.cN(); N() = leftF.cN();
T::ImportLocal(leftF); T::ImportData(leftF);
} }
}; };
@ -593,11 +495,11 @@ public:
} }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)// WRONG I do not know anything about leftV! //if((*this).Base().QualityEnabled && leftF.Base().QualityEnabled)// WRONG I do not know anything about leftV!
if((*this).Base().QualityEnabled) if((*this).Base().QualityEnabled)
Q() = leftF.cQ(); Q() = leftF.cQ();
T::ImportLocal(leftF); T::ImportData(leftF);
} }
static bool HasFaceQuality() { return true; } static bool HasFaceQuality() { return true; }
static bool HasFaceQualityOcf() { return true; } static bool HasFaceQualityOcf() { return true; }
@ -624,11 +526,11 @@ public:
} }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)// WRONG I do not know anything about leftV! //if((*this).Base().ColorEnabled && leftF.Base().ColorEnabled)// WRONG I do not know anything about leftV!
if((*this).Base().ColorEnabled ) if((*this).Base().ColorEnabled )
C() = leftF.cC(); C() = leftF.cC();
T::ImportLocal(leftF); T::ImportData(leftF);
} }
static bool HasFaceColor() { return true; } static bool HasFaceColor() { return true; }
static bool HasFaceColorOcf() { return true; } static bool HasFaceColorOcf() { return true; }
@ -651,11 +553,11 @@ public:
} ; } ;
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)// WRONG I do not know anything about leftV! //if((*this).Base().MarkEnabled && leftF.Base().MarkEnabled)// WRONG I do not know anything about leftV!
if((*this).Base().MarkEnabled) if((*this).Base().MarkEnabled)
IMark() = leftF.IMark(); IMark() = leftF.IMark();
T::ImportLocal(leftF); T::ImportData(leftF);
} }
static bool HasFaceMark() { return true; } static bool HasFaceMark() { return true; }
static bool HasFaceMarkOcf() { return true; } static bool HasFaceMarkOcf() { return true; }
@ -671,11 +573,11 @@ public:
TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType &WT(const int i) { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; } TexCoordType const &cWT(const int i) const { assert((*this).Base().WedgeTexEnabled); return (*this).Base().WTV[(*this).Index()].wt[i]; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV! //if(this->Base().WedgeTexEnabled && leftF.Base().WedgeTexEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeTexEnabled) if(this->Base().WedgeTexEnabled)
{ WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); } { WT(0) = leftF.cWT(0); WT(1) = leftF.cWT(1); WT(2) = leftF.cWT(2); }
TT::ImportLocal(leftF); TT::ImportData(leftF);
} }
static bool HasWedgeTexCoord() { return true; } static bool HasWedgeTexCoord() { return true; }
static bool HasWedgeTexCoordOcf() { return true; } static bool HasWedgeTexCoordOcf() { return true; }
@ -692,11 +594,11 @@ public:
ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } ColorType &WC(const int i) { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
const ColorType & cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; } const ColorType & cWC(const int i) const { assert((*this).Base().WedgeColorEnabled); return (*this).Base().WCV[(*this).Index()].wc[i]; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV! //if(this->Base().WedgeColorEnabled && leftF.Base().WedgeColorEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeColorEnabled) if(this->Base().WedgeColorEnabled)
{ WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); } { WC(0) = leftF.cWC(0); WC(1) = leftF.cWC(1); WC(2) = leftF.cWC(2); }
TT::ImportLocal(leftF); TT::ImportData(leftF);
} }
static bool HasWedgeColor() { return true; } static bool HasWedgeColor() { return true; }
static bool HasWedgeColorOcf() { return true; } static bool HasWedgeColorOcf() { return true; }
@ -713,11 +615,11 @@ public:
NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } NormalType &WN(const int i) { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; } NormalType const &cWN(const int i) const { assert((*this).Base().WedgeNormalEnabled); return (*this).Base().WNV[(*this).Index()].wn[i]; }
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){ void ImportData(const LeftF & leftF){
//if(this->Base().WedgeNormalEnabled && leftF.Base().WedgeNormalEnabled) // WRONG I do not know anything about leftV! //if(this->Base().WedgeNormalEnabled && leftF.Base().WedgeNormalEnabled) // WRONG I do not know anything about leftV!
if(this->Base().WedgeNormalEnabled) if(this->Base().WedgeNormalEnabled)
{ WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); } { WN(0) = leftF.cWN(0); WN(1) = leftF.cWN(1); WN(2) = leftF.cWN(2); }
TT::ImportLocal(leftF); TT::ImportData(leftF);
} }
static bool HasWedgeNormal() { return true; } static bool HasWedgeNormal() { return true; }
static bool HasWedgeNormalOcf() { return true; } static bool HasWedgeNormalOcf() { return true; }
@ -732,7 +634,7 @@ template <class T> class WedgeNormal3dOcf: public WedgeNormalOcf<vcg::Point3d, T
template < class T> class InfoOcf: public T { template < class T> class InfoOcf: public T {
public: public:
// You should never ever try to copy a vertex that has OCF stuff. // You should never ever try to copy a vertex that has OCF stuff.
// use ImportLocal function. // use ImportData function.
inline InfoOcf &operator=(const InfoOcf & /*other*/) { inline InfoOcf &operator=(const InfoOcf & /*other*/) {
assert(0); return *this; assert(0); return *this;
} }
@ -741,7 +643,7 @@ public:
vector_ocf<typename T::FaceType> &Base() const { return *_ovp;} vector_ocf<typename T::FaceType> &Base() const { return *_ovp;}
template <class LeftF> template <class LeftF>
void ImportLocal(const LeftF & leftF){T::ImportLocal(leftF);} void ImportData(const LeftF & leftF){T::ImportData(leftF);}
static bool HasFaceColorOcf() { return false; } static bool HasFaceColorOcf() { return false; }
static bool HasFaceNormalOcf() { return false; } static bool HasFaceNormalOcf() { return false; }

View File

@ -54,8 +54,8 @@ public:
inline void Dealloc(){T::Dealloc();};// it should be useless inline void Dealloc(){T::Dealloc();};// it should be useless
// EmptyPFHAdj // EmptyPFHAdj
HEdgePointer &FHp(const int) { static typename T::HEdgePointer fp=0; assert(0); return fp; } HEdgePointer &FHp( ) { static typename T::HEdgePointer fp=0; assert(0); return fp; }
HEdgePointer const cFHp(const int) const { static typename T::HEdgePointer const fp=0; return fp; } HEdgePointer const cFHp( ) const { static typename T::HEdgePointer const fp=0; return fp; }
static bool HasFHAdjacency() { return false; } static bool HasFHAdjacency() { return false; }
}; };

View File

@ -28,7 +28,7 @@ Revision 1.12 2008/03/17 11:39:14 ganovelli
added curvature and curvatruredir (compiled .net 2005 and gcc) added curvature and curvatruredir (compiled .net 2005 and gcc)
Revision 1.11 2008/02/04 21:26:49 ganovelli Revision 1.11 2008/02/04 21:26:49 ganovelli
added ImportLocal which imports all local attributes into vertexplus and faceplus. added ImportData which imports all local attributes into vertexplus and faceplus.
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL. (i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
Added some function for const attributes Added some function for const attributes
@ -96,7 +96,7 @@ These typenames must be known form all the derived classes.
// typedef BFT *FacePointer; // typedef BFT *FacePointer;
// typedef BTT *TetraPointer; // typedef BTT *TetraPointer;
// template < class LeftV> // template < class LeftV>
// void ImportLocal(const LeftV & /* left */ ) { } // void ImportData(const LeftV & /* left */ ) { }
// static void Name(std::vector<std::string> & /* name */){} // static void Name(std::vector<std::string> & /* name */){}
// //
//}; //};

View File

@ -130,23 +130,23 @@ public:
static bool IsTexCoordEnabled(const typename TT::VertexType *) { return false; } static bool IsTexCoordEnabled(const typename TT::VertexType *) { return false; }
typename TT::TetraPointer &VTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; } typename TT::TetraPointer &VTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
typename TT::TetraPointer cVTp() { static typename TT::TetraPointer tp = 0; assert(0); return tp; } const typename TT::TetraPointer cVTp()const { static typename TT::TetraPointer tp = 0; assert(0); return tp; }
int &VTi() { static int z = 0; return z; }; int &VTi() { static int z = 0; return z; };
static bool HasVTAdjacency() { return false; } static bool HasVTAdjacency() { return false; }
typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; } typename TT::FacePointer &VFp() { static typename TT::FacePointer fp=0; assert(0); return fp; }
typename TT::FacePointer cVFp() const { static typename TT::FacePointer fp=0; assert(0); return fp; } const typename TT::FacePointer cVFp() const { static typename TT::FacePointer fp=0; assert(0); return fp; }
int &VFi(){static int z=0; return z;}; int &VFi(){static int z=0; return z;};
int cVFi() const {static int z=0; return z;}; int cVFi() const {static int z=0; return z;};
static bool HasVFAdjacency() { return false; } static bool HasVFAdjacency() { return false; }
typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; } typename TT::EdgePointer &VEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; }
typename TT::EdgePointer cVEp() { static typename TT::EdgePointer ep=0; assert(0); return ep; } const typename TT::EdgePointer cVEp() const { static typename TT::EdgePointer ep=0; assert(0); return ep; }
int &VEi(){static int z=0; return z;}; int &VEi(){static int z=0; return z;};
static bool HasVEAdjacency() { return false; } static bool HasVEAdjacency() { return false; }
typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; } typename TT::HEdgePointer &VHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
typename TT::HEdgePointer cVHp() { static typename TT::HEdgePointer ep=0; assert(0); return ep; } const typename TT::HEdgePointer cVHp() const { static typename TT::HEdgePointer ep=0; assert(0); return ep; }
int &VHi(){static int z=0; return z;}; int &VHi(){static int z=0; return z;};
static bool HasVHAdjacency() { return false; } static bool HasVHAdjacency() { return false; }
@ -176,8 +176,8 @@ public:
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { void ImportData(const LeftV & left ) {
TT::ImportLocal( left); // TT::ImportData( left);
} }
static void Name(std::vector<std::string> & name){TT::Name(name);} static void Name(std::vector<std::string> & name){TT::Name(name);}
}; };
@ -193,7 +193,7 @@ public:
const CoordType &cP() const { return _coord; } const CoordType &cP() const { return _coord; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasCoord()) P().Import(left.cP()); T::ImportData( left); }
static bool HasCoord() { return true; } static bool HasCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Coord"));T::Name(name);}
@ -215,10 +215,10 @@ public:
NormalType &N() { return _norm; } NormalType &N() { return _norm; }
const NormalType &cN() const { return _norm; } const NormalType &cN() const { return _norm; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ){ void ImportData(const LeftV & left ){
if(LeftV::HasNormal()) if(LeftV::HasNormal())
N().Import(left.cN()); N().Import(left.cN());
T::ImportLocal( left); T::ImportData( left);
} }
static bool HasNormal() { return true; } static bool HasNormal() { return true; }
// static bool HasNormalOcf() { return false; } // static bool HasNormalOcf() { return false; }
@ -250,7 +250,7 @@ public:
inline int & IMark() { return _imark;} inline int & IMark() { return _imark;}
inline const int & IMark() const {return _imark;} inline const int & IMark() const {return _imark;}
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasMark()) IMark() = left.IMark(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasMark()) IMark() = left.IMark(); T::ImportData( left); }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Mark"));T::Name(name);}
private: private:
@ -265,7 +265,7 @@ public:
TexCoordType &T() { return _t; } TexCoordType &T() { return _t; }
const TexCoordType &cT() const { return _t; } const TexCoordType &cT() const { return _t; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasTexCoord()) T() = left.cT(); TT::ImportData( left); }
static bool HasTexCoord() { return true; } static bool HasTexCoord() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("TexCoord"));TT::Name(name);}
@ -292,7 +292,7 @@ public:
int &Flags() {return _flags; } int &Flags() {return _flags; }
int Flags() const {return _flags; } int Flags() const {return _flags; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.Flags(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasFlags()) Flags() = left.Flags(); T::ImportData( left); }
static bool HasFlags() { return true; } static bool HasFlags() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("BitFlags"));T::Name(name);}
@ -311,7 +311,7 @@ public:
const ColorType &C() const { return _color; } const ColorType &C() const { return _color; }
const ColorType &cC() const { return _color; } const ColorType &cC() const { return _color; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasColor()) C() = left.cC(); T::ImportData( left); }
static bool HasColor() { return true; } static bool HasColor() { return true; }
static bool IsColorEnabled(typename T::VertexType *) { return true; } static bool IsColorEnabled(typename T::VertexType *) { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Color"));T::Name(name);}
@ -332,7 +332,7 @@ public:
QualityType &Q() { return _quality; } QualityType &Q() { return _quality; }
const QualityType & cQ() const {return _quality; } const QualityType & cQ() const {return _quality; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasQuality()) Q() = left.cQ(); TT::ImportData( left); }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Quality"));TT::Name(name);}
@ -370,7 +370,7 @@ public:
static bool HasCurvatureDir() { return false; } static bool HasCurvatureDir() { return false; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { TT::ImportLocal( left); } void ImportData(const LeftV & left ) { TT::ImportData( left); }
static void Name(std::vector<std::string> & name){TT::Name(name);} static void Name(std::vector<std::string> & name){TT::Name(name);}
}; };
@ -413,7 +413,7 @@ public:
RadiusType &R() { return _radius; } RadiusType &R() { return _radius; }
const RadiusType & cR() const {return _radius; } const RadiusType & cR() const {return _radius; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportLocal( left); } void ImportData(const LeftV & left ) { if(LeftV::HasRadius()) R() = left.cR(); TT::ImportData( left); }
static bool HasRadius() { return true; } static bool HasRadius() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Radius"));TT::Name(name);}
@ -432,10 +432,10 @@ template <class T> class VEAdj: public T {
public: public:
VEAdj(){_ep=0;} VEAdj(){_ep=0;}
typename T::EdgePointer &VEp() {return _ep; } typename T::EdgePointer &VEp() {return _ep; }
typename T::EdgePointer cVEp() {return _ep; } typename T::EdgePointer const cVEp() const {return _ep; }
int &VEi() {return _zp; } int &VEi() {return _zp; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { VEp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasVEAdjacency() { return true; } static bool HasVEAdjacency() { return true; }
static bool HasVEAdjacencyOcc() { return true; } static bool HasVEAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VEAdj"));T::Name(name);}
@ -451,10 +451,10 @@ template <class T> class VFAdj: public T {
public: public:
VFAdj(){_fp=0;} VFAdj(){_fp=0;}
typename T::FacePointer &VFp() {return _fp; } typename T::FacePointer &VFp() {return _fp; }
typename T::FacePointer cVFp() {return _fp; } typename T::FacePointer const cVFp() const {return _fp; }
int &VFi() {return _zp; } int &VFi() {return _zp; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { VFp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
static bool HasVFAdjacencyOcc() { return true; } static bool HasVFAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VFAdj"));T::Name(name);}
@ -473,7 +473,7 @@ public:
typename T::HEdgePointer cVHp() {return _hp; } typename T::HEdgePointer cVHp() {return _hp; }
int &VHi() {return _zp; } int &VHi() {return _zp; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & left ) { VHp() = NULL; T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasVHAdjacency() { return true; } static bool HasVHAdjacency() { return true; }
static bool HasVHAdjacencyOcc() { return true; } static bool HasVHAdjacencyOcc() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("VHAdj"));T::Name(name);}

View File

@ -154,7 +154,7 @@ public:
const ScalarType &cK() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];} const ScalarType &cK() const { return CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1];}
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV){ void ImportData(const LeftV & leftV){
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH(); CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[0] = leftV.cH();
CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK(); CAT< vector_occ<VertType>,CurvatureTypeOcc>::Instance()->Get((VertType*)this)[1] = leftV.cK();
TT::ImporLocal(leftV); TT::ImporLocal(leftV);
@ -230,7 +230,7 @@ public:
const RadiusType &cR() const { return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);} const RadiusType &cR() const { return CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this);}
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV){ void ImportData(const LeftV & leftV){
CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this) = leftV.cR(); CAT< vector_occ<VertType>,RadiusType>::Instance()->Get((VertType*)this) = leftV.cR();
TT::ImporLocal(leftV); TT::ImporLocal(leftV);
} }

View File

@ -37,7 +37,7 @@ Revision 1.13 2008/02/05 20:42:43 cignoni
Other small typos Other small typos
Revision 1.12 2008/02/04 21:26:49 ganovelli Revision 1.12 2008/02/04 21:26:49 ganovelli
added ImportLocal which imports all local attributes into vertexplus and faceplus. added ImportData which imports all local attributes into vertexplus and faceplus.
A local attribute is everything (N(), C(), Q()....) except pointers to other simplices A local attribute is everything (N(), C(), Q()....) except pointers to other simplices
(i.e. FFAdj, VFAdj, VertexRef) which are set to NULL. (i.e. FFAdj, VFAdj, VertexRef) which are set to NULL.
Added some function for const attributes Added some function for const attributes
@ -391,14 +391,9 @@ public:
return (*this).Base().AV[(*this).Index()]._zp; return (*this).Base().AV[(*this).Index()]._zp;
} }
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
if((*this).Base().VFAdjacencyEnabled) // init the data only if they are enabled! T::ImportData(leftV);
{
VFp() = NULL;
VFi() = -1;
}
T::ImportLocal(leftV);
} }
static bool HasVFAdjacency() { return true; } static bool HasVFAdjacency() { return true; }
@ -431,10 +426,10 @@ public:
return (*this).Base().NV[(*this).Index()]; } return (*this).Base().NV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV){ void ImportData(const LeftV & leftV){
if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled ) // copy the data only if they are enabled in both vertices if((*this).Base().NormalEnabled && leftV.Base().NormalEnabled ) // copy the data only if they are enabled in both vertices
N().Import(leftV.cN()); N().Import(leftV.cN());
T::ImportLocal(leftV);} T::ImportData(leftV);}
}; };
template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {}; template <class T> class Normal3sOcf: public NormalOcf<vcg::Point3s, T> {};
@ -449,11 +444,11 @@ public:
ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; } ColorType &C() { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; } const ColorType &cC() const { assert((*this).Base().ColorEnabled); return (*this).Base().CV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled ) // copy the data only if they are enabled in both vertices if((*this).Base().ColorEnabled && leftV.Base().ColorEnabled ) // copy the data only if they are enabled in both vertices
C() = leftV.cC(); C() = leftV.cC();
T::ImportLocal(leftV); T::ImportData(leftV);
} }
static bool HasColor() { return true; } static bool HasColor() { return true; }
@ -469,12 +464,12 @@ public:
typedef A QualityType; typedef A QualityType;
QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; } QualityType &Q() { assert((*this).Base().QualityEnabled); return (*this).Base().QV[(*this).Index()]; }
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
// if((*this).Base().QualityEnabled && leftV.Base().QualityEnabled ) // copy the data only if they are enabled in both vertices // if((*this).Base().QualityEnabled && leftV.Base().QualityEnabled ) // copy the data only if they are enabled in both vertices
if((*this).Base().QualityEnabled && leftV.HasQuality() ) // copy the data only if they are enabled in both vertices if((*this).Base().QualityEnabled && leftV.HasQuality() ) // copy the data only if they are enabled in both vertices
Q() = leftV.cQ(); Q() = leftV.cQ();
T::ImportLocal(leftV); T::ImportData(leftV);
} }
static bool HasQuality() { return true; } static bool HasQuality() { return true; }
static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; } static bool HasQualityOcf() { assert(!T::HasQualityOcf()); return true; }
@ -491,12 +486,12 @@ public:
TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; } TexCoordType &T() { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
const TexCoordType &cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; } const TexCoordType &cT() const { assert((*this).Base().TexCoordEnabled); return (*this).Base().TV[(*this).Index()]; }
template < class LeftV> template < class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if((*this).Base().TexCoordEnabled && leftV.Base().TexCoordEnabled ) // WRONG I do not know anything about leftV! //if((*this).Base().TexCoordEnabled && leftV.Base().TexCoordEnabled ) // WRONG I do not know anything about leftV!
if((*this).Base().TexCoordEnabled) // copy the data only if they are enabled in both vertices if((*this).Base().TexCoordEnabled) // copy the data only if they are enabled in both vertices
T() = leftV.cT(); T() = leftV.cT();
TT::ImportLocal(leftV); TT::ImportData(leftV);
} }
static bool HasTexCoord() { return true; } static bool HasTexCoord() { return true; }
static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; } static bool HasTexCoordOcf() { assert(!TT::HasTexCoordOcf()); return true; }
@ -520,12 +515,12 @@ public:
} }
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // WRONG I do not know anything about leftV! //if((*this).Base().MarkEnabled && leftV.Base().MarkEnabled ) // WRONG I do not know anything about leftV!
if((*this).Base().MarkEnabled) // copy the data only if they are enabled in both vertices if((*this).Base().MarkEnabled) // copy the data only if they are enabled in both vertices
IMark() = leftV.IMark(); IMark() = leftV.IMark();
T::ImportLocal(leftV); T::ImportData(leftV);
} }
static bool HasMark() { return true; } static bool HasMark() { return true; }
static bool HasMarkOcf() { return true; } static bool HasMarkOcf() { return true; }
@ -546,14 +541,14 @@ public:
const ScalarType &cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];} const ScalarType &cKg() const { assert((*this).Base().CurvatureEnabled); return (*this).Base().CuV[(*this).Index()][1];}
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV){ void ImportData(const LeftV & leftV){
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV! // if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV!
if((*this).Base().CurvatureEnabled && LeftV::IsCurvatureEnabled(&leftV)) if((*this).Base().CurvatureEnabled && LeftV::IsCurvatureEnabled(&leftV))
{ {
(*this).Base().CuV[(*this).Index()][0] = leftV.cKh(); (*this).Base().CuV[(*this).Index()][0] = leftV.cKh();
(*this).Base().CuV[(*this).Index()][1] = leftV.cKg(); (*this).Base().CuV[(*this).Index()][1] = leftV.cKg();
} }
TT::ImportLocal(leftV); TT::ImportData(leftV);
} }
static bool HasCurvature() { return true; } static bool HasCurvature() { return true; }
@ -598,7 +593,7 @@ public:
const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;} const ScalarType &cK2()const {assert((*this).Base().CurvatureDirEnabled); return (*this).Base().CuDV[(*this).Index()].k2;}
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV){ void ImportData(const LeftV & leftV){
// if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV! // if((*this).Base().CurvatureEnabled && leftV.Base().CurvatureEnabled ) // WRONG I do not know anything about leftV!
if((*this).Base().CurvatureDirEnabled && LeftV::IsCurvatureDirEnabled(&leftV)) if((*this).Base().CurvatureDirEnabled && LeftV::IsCurvatureDirEnabled(&leftV))
{ {
@ -607,7 +602,7 @@ public:
(*this).K1() = leftV.cK1(); (*this).K1() = leftV.cK1();
(*this).K2() = leftV.cK2(); (*this).K2() = leftV.cK2();
} }
TT::ImportLocal(leftV); TT::ImportData(leftV);
} }
static bool HasCurvatureDir() { return true; } static bool HasCurvatureDir() { return true; }
static bool HasCurvatureDirOcf() { return true; } static bool HasCurvatureDirOcf() { return true; }
@ -636,12 +631,12 @@ public:
const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];} const RadiusType &cR() const { assert((*this).Base().RadiusEnabled); return (*this).Base().RadiusV[(*this).Index()];}
template <class LeftV> template <class LeftV>
void ImportLocal(const LeftV & leftV) void ImportData(const LeftV & leftV)
{ {
//if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled ) // WRONG I do not know anything about leftV! //if ((*this).Base().RadiusEnabled && leftV.Base().RadiusEnabled ) // WRONG I do not know anything about leftV!
if ((*this).Base().RadiusEnabled) if ((*this).Base().RadiusEnabled)
(*this).Base().RadiusV[(*this).Index()] = leftV.cR(); (*this).Base().RadiusV[(*this).Index()] = leftV.cR();
TT::ImportLocal(leftV); TT::ImportData(leftV);
} }
static bool HasRadius() { return true; } static bool HasRadius() { return true; }
@ -660,7 +655,7 @@ template <class T> class RadiusdOcf: public RadiusOcf<double, T> {};
template < class T> class InfoOcf: public T { template < class T> class InfoOcf: public T {
public: public:
// You should never ever try to copy a vertex that has OCF stuff. // You should never ever try to copy a vertex that has OCF stuff.
// use ImportLocal function. // use ImportData function.
inline InfoOcf &operator=(const InfoOcf & /*other*/) { inline InfoOcf &operator=(const InfoOcf & /*other*/) {
assert(0); return *this; assert(0); return *this;
} }

View File

@ -13,8 +13,8 @@ public:
SphType &SH() { return _harmonics; } SphType &SH() { return _harmonics; }
const SphType &cSH() const { return _harmonics; } const SphType &cSH() const { return _harmonics; }
template < class LeftV> template < class LeftV>
// void ImportLocal(const LeftV & left ) { SH() = left.cSH(); T::ImportLocal( left); } // void ImportData(const LeftV & left ) { SH() = left.cSH(); T::ImportData( left); }
void ImportLocal(const LeftV & left ) { T::ImportLocal( left); } void ImportData(const LeftV & left ) { T::ImportData( left); }
static bool HasSH() { return true; } static bool HasSH() { return true; }
static void Name(std::vector<std::string> & name){name.push_back(std::string("Spherical Harmonics"));T::Name(name);} static void Name(std::vector<std::string> & name){name.push_back(std::string("Spherical Harmonics"));T::Name(name);}