Commit 6e7f22fc authored by Thomas's avatar Thomas

Merge branch 'master' of cgogn.u-strasbg.fr:~cgogn/CGoGN

parents 033d38b8 97d7a2de
...@@ -67,26 +67,26 @@ void decimate( ...@@ -67,26 +67,26 @@ void decimate(
{ {
approximators.push_back(new Approximator_QEMhalfEdge<PFP>(map, position)) ; approximators.push_back(new Approximator_QEMhalfEdge<PFP>(map, position)) ;
/* /*
PFP::TVEC3 frame[3] ; PFP::TVEC3 frame[3] ;
frame[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent frame[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_T") ; // Tangent
frame[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent frame[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_B") ; // Bitangent
frame[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal frame[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "frame_N") ; // Normal
for (unsigned int i = 0 ; i < 3 ; ++i) for (unsigned int i = 0 ; i < 3 ; ++i)
if (!frame[i].isValid()) { if (!frame[i].isValid()) {
CGoGNerr << "In function decimate : frame[" << i << "] is not valid" << CGoGNendl ; CGoGNerr << "In function decimate : frame[" << i << "] is not valid" << CGoGNendl ;
} }
AttributeHandler<typename PFP::VEC3> colorPTM[6] ; AttributeHandler<typename PFP::VEC3> colorPTM[6] ;
colorPTM[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_a") ; colorPTM[0] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_a") ;
colorPTM[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_b") ; colorPTM[1] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_b") ;
colorPTM[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_c") ; colorPTM[2] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_c") ;
colorPTM[3] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_d") ; colorPTM[3] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_d") ;
colorPTM[4] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_e") ; colorPTM[4] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_e") ;
colorPTM[5] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_f") ; colorPTM[5] = map.template getAttribute<typename PFP::VEC3>(VERTEX, "colorPTM_f") ;
for (unsigned int i = 0 ; i < 6 ; ++i) for (unsigned int i = 0 ; i < 6 ; ++i)
if (!colorPTM[i].isValid()) { if (!colorPTM[i].isValid()) {
CGoGNerr << "In function decimate : colorPTM[" << i << "] is not valid" << CGoGNendl ; CGoGNerr << "In function decimate : colorPTM[" << i << "] is not valid" << CGoGNendl ;
} }
*/ */
AttributeHandler<Geom::Matrix<3,3,typename PFP::REAL> > frame = map.template getAttribute<Geom::Matrix<3,3,typename PFP::REAL> >(VERTEX, "frame") ; AttributeHandler<Geom::Matrix<3,3,typename PFP::REAL> > frame = map.template getAttribute<Geom::Matrix<3,3,typename PFP::REAL> >(VERTEX, "frame") ;
AttributeHandler<Geom::Matrix<3,6,typename PFP::REAL> > RGBfunctions = map.template getAttribute<Geom::Matrix<3,6,typename PFP::REAL> >(VERTEX, "colorPTM") ; AttributeHandler<Geom::Matrix<3,6,typename PFP::REAL> > RGBfunctions = map.template getAttribute<Geom::Matrix<3,6,typename PFP::REAL> >(VERTEX, "colorPTM") ;
...@@ -108,31 +108,31 @@ void decimate( ...@@ -108,31 +108,31 @@ void decimate(
switch(s) switch(s)
{ {
case S_MapOrder : case S_MapOrder :
selector = new EdgeSelector_MapOrder<PFP>(map, position, approximators) ; selector = new EdgeSelector_MapOrder<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_Random : case S_Random :
selector = new EdgeSelector_Random<PFP>(map, position, approximators) ; selector = new EdgeSelector_Random<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_EdgeLength : case S_EdgeLength :
selector = new EdgeSelector_Length<PFP>(map, position, approximators) ; selector = new EdgeSelector_Length<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_QEMml : case S_QEMml :
selector = new EdgeSelector_QEMml<PFP>(map, position, approximators) ; selector = new EdgeSelector_QEMml<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_QEM : case S_QEM :
selector = new EdgeSelector_QEM<PFP>(map, position, approximators) ; selector = new EdgeSelector_QEM<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_Curvature : case S_Curvature :
selector = new EdgeSelector_Curvature<PFP>(map, position, approximators) ; selector = new EdgeSelector_Curvature<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_MinDetail : case S_MinDetail :
selector = new EdgeSelector_Random<PFP>(map, position, approximators) ; selector = new EdgeSelector_Random<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_hLightfield : case S_hLightfield :
selector = new HalfEdgeSelector_Lightfield<PFP>(map, position, approximators) ; selector = new HalfEdgeSelector_Lightfield<PFP>(map, position, approximators, selected) ;
break ; break ;
case S_hQEMml : case S_hQEMml :
selector = new HalfEdgeSelector_QEMml<PFP>(map, position, approximators) ; selector = new HalfEdgeSelector_QEMml<PFP>(map, position, approximators, selected) ;
break ; break ;
} }
......
...@@ -54,7 +54,7 @@ private: ...@@ -54,7 +54,7 @@ private:
Dart cur ; Dart cur ;
public: public:
EdgeSelector_MapOrder(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_MapOrder(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{} {}
~EdgeSelector_MapOrder() ~EdgeSelector_MapOrder()
...@@ -81,7 +81,7 @@ private: ...@@ -81,7 +81,7 @@ private:
bool allSkipped ; bool allSkipped ;
public: public:
EdgeSelector_Random(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_Random(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{} {}
~EdgeSelector_Random() ~EdgeSelector_Random()
...@@ -121,7 +121,7 @@ private: ...@@ -121,7 +121,7 @@ private:
void computeEdgeInfo(Dart d, EdgeInfo& einfo) ; void computeEdgeInfo(Dart d, EdgeInfo& einfo) ;
public: public:
EdgeSelector_Length(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_Length(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ;
...@@ -168,7 +168,7 @@ private: ...@@ -168,7 +168,7 @@ private:
void computeEdgeInfo(Dart d, EdgeInfo& einfo) ; void computeEdgeInfo(Dart d, EdgeInfo& einfo) ;
public: public:
EdgeSelector_QEM(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_QEM(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ;
...@@ -217,7 +217,7 @@ private: ...@@ -217,7 +217,7 @@ private:
void recomputeQuadric(const Dart d, const bool recomputeNeighbors = false) ; void recomputeQuadric(const Dart d, const bool recomputeNeighbors = false) ;
public: public:
EdgeSelector_QEMml(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_QEMml(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ;
...@@ -274,7 +274,7 @@ private: ...@@ -274,7 +274,7 @@ private:
void computeEdgeInfo(Dart d, EdgeInfo& einfo) ; void computeEdgeInfo(Dart d, EdgeInfo& einfo) ;
public: public:
EdgeSelector_Curvature(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_Curvature(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ; bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ;
...@@ -330,7 +330,6 @@ public: ...@@ -330,7 +330,6 @@ public:
void updateAfterCollapse(Dart d2, Dart dd2) ; void updateAfterCollapse(Dart d2, Dart dd2) ;
} ; } ;
template <typename PFP> template <typename PFP>
class EdgeSelector_MinDetail : public EdgeSelector<PFP> class EdgeSelector_MinDetail : public EdgeSelector<PFP>
{ {
...@@ -360,7 +359,7 @@ private: ...@@ -360,7 +359,7 @@ private:
void computeEdgeInfo(Dart d, EdgeInfo& einfo) ; void computeEdgeInfo(Dart d, EdgeInfo& einfo) ;
public: public:
EdgeSelector_MinDetail(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select = SelectorTrue()) : EdgeSelector_MinDetail(MAP& m, typename PFP::TVEC3& pos, std::vector<ApproximatorGen<PFP>*>& approx, const FunctorSelect& select) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ;
......
...@@ -43,8 +43,8 @@ public: ...@@ -43,8 +43,8 @@ public:
NoMathAttribute(int i) : T() {} NoMathAttribute(int i) : T() {}
NoMathAttribute(const T& att): T(att) {} NoMathAttribute(const T& att): T(att) {}
NoMathAttribute<T>& operator = (const T& fa) { *this = NoMathAttribute<T>(fa); } NoMathAttribute<T>& operator = (const T& fa) { *this = NoMathAttribute<T>(fa); }
void operator += (const NoMathAttribute<T>& fa) {} void operator += (const NoMathAttribute<T>& fa) {}
void operator -= (const NoMathAttribute<T>& fa) {} void operator -= (const NoMathAttribute<T>& fa) {}
void operator *= (double v) {} void operator *= (double v) {}
...@@ -54,6 +54,12 @@ public: ...@@ -54,6 +54,12 @@ public:
static std::string CGoGNnameOfType() { return nameOfType(T()); } static std::string CGoGNnameOfType() { return nameOfType(T()); }
}; };
template <typename T>
NoMathAttribute<T> operator*(T a, const NoMathAttribute<T>& v)
{
return T();
}
/** /**
* Ajoute tout ce qu'il faut a un type (std::string par exemple) * Ajoute tout ce qu'il faut a un type (std::string par exemple)
* qui n'a pas les operateurs += -= *= /= * qui n'a pas les operateurs += -= *= /=
...@@ -68,8 +74,8 @@ public: ...@@ -68,8 +74,8 @@ public:
NoMathNameAttribute(int i) : T() {} NoMathNameAttribute(int i) : T() {}
NoMathNameAttribute(const T& att): T(att) {} NoMathNameAttribute(const T& att): T(att) {}
NoMathNameAttribute<T>& operator = (const T& fa) { return *this = NoMathNameAttribute<T>(fa); } NoMathNameAttribute<T>& operator = (const T& fa) { return *this = NoMathNameAttribute<T>(fa); }
void operator += (const NoMathNameAttribute<T>& fa) {} void operator += (const NoMathNameAttribute<T>& fa) {}
void operator -= (const NoMathNameAttribute<T>& fa) {} void operator -= (const NoMathNameAttribute<T>& fa) {}
void operator *= (double v) {} void operator *= (double v) {}
...@@ -79,11 +85,23 @@ public: ...@@ -79,11 +85,23 @@ public:
static std::string CGoGNnameOfType() { return ""; } static std::string CGoGNnameOfType() { return ""; }
}; };
/**
* Ajoute tout ce qu'il faut a un type
* qui n'a pas de nom
* pour qu'il soit utilisable (ca compile!)
*/
template <typename T> template <typename T>
NoMathAttribute<T> operator*(T a, const NoMathAttribute<T>& v) class NoNameAttribute : public T
{ {
return T(); public:
} NoNameAttribute() : T() {}
NoNameAttribute(int i) : T() {}
NoNameAttribute(const T& att) : T(att) {}
NoNameAttribute<T>& operator = (const T& fa) { return *this = NoNameAttribute<T>(fa); }
static std::string CGoGNnameOfType() { return ""; }
};
/** /**
* Ajoute tout ce qu'il faut a un type * Ajoute tout ce qu'il faut a un type
...@@ -98,7 +116,7 @@ public: ...@@ -98,7 +116,7 @@ public:
NoIOAttribute(int i) : T() {} NoIOAttribute(int i) : T() {}
NoIOAttribute(const T& att) : T(att) {} NoIOAttribute(const T& att) : T(att) {}
NoIOAttribute<T>& operator = (const T& fa) { *this = NoIOAttribute<T>(fa); } NoIOAttribute<T>& operator = (const T& fa) { return *this = NoIOAttribute<T>(fa); }
friend std::ostream& operator<<( std::ostream &out, const NoIOAttribute<T>& fa ) { return out ; } friend std::ostream& operator<<( std::ostream &out, const NoIOAttribute<T>& fa ) { return out ; }
friend const std::istream& operator>>( const std::istream &in, NoIOAttribute<T>& fa ) { return in ; } friend const std::istream& operator>>( const std::istream &in, NoIOAttribute<T>& fa ) { return in ; }
...@@ -106,6 +124,27 @@ public: ...@@ -106,6 +124,27 @@ public:
static std::string CGoGNnameOfType() { return nameOfType(T()); } static std::string CGoGNnameOfType() { return nameOfType(T()); }
}; };
/**
* Ajoute tout ce qu'il faut a un type
* qui n'a pas de nom ni les operateurs << et >>
* pour qu'il soit utilisable (ca compile!)
*/
template <typename T>
class NoNameIOAttribute : public T
{
public:
NoNameIOAttribute() : T() {}
NoNameIOAttribute(int i) : T() {}
NoNameIOAttribute(const T& att) : T(att) {}
NoNameIOAttribute<T>& operator = (const T& fa) { return *this = NoNameIOAttribute<T>(fa); }
friend std::ostream& operator<<( std::ostream &out, const NoNameIOAttribute<T>& fa ) { return out ; }
friend const std::istream& operator>>( const std::istream &in, NoNameIOAttribute<T>& fa ) { return in ; }
static std::string CGoGNnameOfType() { return ""; }
};
/** /**
* Ajoute tout ce qu'il faut a un type (std::string par exemple) * Ajoute tout ce qu'il faut a un type (std::string par exemple)
* qui n'a pas les operateurs += -= *= /= et << , >> * qui n'a pas les operateurs += -= *= /= et << , >>
...@@ -119,12 +158,11 @@ public: ...@@ -119,12 +158,11 @@ public:
NoMathIOAttribute(int i) : T() {} NoMathIOAttribute(int i) : T() {}
NoMathIOAttribute(const T& att): T(att) {} NoMathIOAttribute(const T& att): T(att) {}
NoMathIOAttribute<T>& operator = (const T& fa) { return *this = NoMathIOAttribute<T>(fa); }
friend std::ostream& operator<<( std::ostream &out, const NoMathIOAttribute<T>& fa ) { return out ; } friend std::ostream& operator<<( std::ostream &out, const NoMathIOAttribute<T>& fa ) { return out ; }
friend const std::istream& operator>>( const std::istream &in, NoMathIOAttribute<T>& fa ) { return in ; } friend const std::istream& operator>>( const std::istream &in, NoMathIOAttribute<T>& fa ) { return in ; }
NoMathIOAttribute<T>& operator = (const T& fa) { return *this = NoMathIOAttribute<T>(fa); }
void operator += (const NoMathIOAttribute<T>& fa) {} void operator += (const NoMathIOAttribute<T>& fa) {}
void operator -= (const NoMathIOAttribute<T>& fa) {} void operator -= (const NoMathIOAttribute<T>& fa) {}
void operator *= (double v) {} void operator *= (double v) {}
...@@ -147,12 +185,11 @@ public: ...@@ -147,12 +185,11 @@ public:
NoMathIONameAttribute(int i) : T() {} NoMathIONameAttribute(int i) : T() {}
NoMathIONameAttribute(const T& att) : T(att) {} NoMathIONameAttribute(const T& att) : T(att) {}
NoMathIONameAttribute<T>& operator = (const T& fa) { return *this = NoMathIONameAttribute<T>(fa); }
friend std::ostream& operator<<( std::ostream &out, const NoMathIONameAttribute<T>& fa ) { return out ; } friend std::ostream& operator<<( std::ostream &out, const NoMathIONameAttribute<T>& fa ) { return out ; }
friend const std::istream& operator>>( const std::istream &in, NoMathIONameAttribute<T>& fa ) { return in ; } friend const std::istream& operator>>( const std::istream &in, NoMathIONameAttribute<T>& fa ) { return in ; }
NoMathIONameAttribute<T>& operator = (const T& fa) { return *this = NoMathIONameAttribute<T>(fa); }
void operator += (const NoMathIONameAttribute<T>& fa) {} void operator += (const NoMathIONameAttribute<T>& fa) {}
void operator -= (const NoMathIONameAttribute<T>& fa) {} void operator -= (const NoMathIONameAttribute<T>& fa) {}
void operator *= (double v) {} void operator *= (double v) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment