Commit 2bc8563e authored by Pierre Kraemer's avatar Pierre Kraemer

set template FUNC parameter in collectors

parent 72295fdd
......@@ -23,7 +23,7 @@
*******************************************************************************/
#include "Topology/generic/traversor/traversorCell.h"
#include "Topology/generic/traversor2.h"
#include "Topology/generic/traversor/traversor2.h"
namespace CGoGN
{
......@@ -79,6 +79,7 @@ void computeNewPositionsFromFaceNormals(
template <typename PFP>
void filterAverageNormals(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position2)
{
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ;
......@@ -93,14 +94,14 @@ void filterAverageNormals(typename PFP::MAP& map, const VertexAttribute<typename
FaceAutoAttribute<VEC3, MAP> faceNewNormal(map, "faceNewNormal") ;
// Compute new normals
TraversorF<typename PFP::MAP> tf(map) ;
TraversorF<MAP> tf(map) ;
for(Dart d = tf.begin(); d != tf.end(); d = tf.next())
{
REAL sumArea = 0 ;
VEC3 meanFilter(0) ;
// traversal of adjacent faces (by edges and vertices)
Traversor2FFaV<typename PFP::MAP> taf(map, d) ;
Traversor2FFaV<MAP> taf(map, d) ;
for(Dart it = taf.begin(); it != taf.end(); it = taf.next())
{
sumArea += faceArea[it] ;
......
......@@ -89,10 +89,14 @@ public:
virtual void collectAll(Dart d) = 0;
virtual void collectBorder(Dart d) = 0;
bool applyOnInsideVertices(FunctorType& f);
bool applyOnInsideEdges(FunctorType& f);
bool applyOnInsideFaces(FunctorType& f);
bool applyOnBorder(FunctorType& f);
template <typename FUNC>
void applyOnInsideVertices(FUNC& f);
template <typename FUNC>
void applyOnInsideEdges(FUNC& f);
template <typename FUNC>
void applyOnInsideFaces(FUNC& f);
template <typename FUNC>
void applyOnBorder(FUNC& f);
inline void sort()
{
......
......@@ -47,42 +47,38 @@ Collector<PFP>::Collector(MAP& m, unsigned int thread) : map(m), m_thread(thread
{}
template <typename PFP>
inline bool Collector<PFP>::applyOnInsideVertices(FunctorType& f)
template <typename FUNC>
inline void Collector<PFP>::applyOnInsideVertices(FUNC& f)
{
assert(isInsideCollected || !"applyOnInsideVertices: inside cells have not been collected.") ;
for(std::vector<Vertex>::iterator iv = insideVertices.begin(); iv != insideVertices.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
f((*iv).dart);
}
template <typename PFP>
inline bool Collector<PFP>::applyOnInsideEdges(FunctorType& f)
template <typename FUNC>
inline void Collector<PFP>::applyOnInsideEdges(FUNC& f)
{
assert(isInsideCollected || !"applyOnInsideEdges: inside cells have not been collected.") ;
for(std::vector<Edge>::iterator iv = insideEdges.begin(); iv != insideEdges.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
f((*iv).dart);
}
template <typename PFP>
inline bool Collector<PFP>::applyOnInsideFaces(FunctorType& f)
template <typename FUNC>
inline void Collector<PFP>::applyOnInsideFaces(FUNC& f)
{
assert(isInsideCollected || !"applyOnInsideFaces: inside cells have not been collected.") ;
for(std::vector<Face>::iterator iv = insideFaces.begin(); iv != insideFaces.end(); ++iv)
if(f((*iv).dart))
return true ;
return false ;
f((*iv).dart);
}
template <typename PFP>
inline bool Collector<PFP>::applyOnBorder(FunctorType& f)
template <typename FUNC>
inline void Collector<PFP>::applyOnBorder(FUNC& f)
{
for(std::vector<Dart>::iterator iv = border.begin(); iv != border.end(); ++iv)
if(f(*iv))
return true ;
return false ;
f(*iv);
}
template <typename PPFP>
......
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