Commit c6d8c4e1 authored by Kenneth Vanhoey's avatar Kenneth Vanhoey

Merge cgogn:~cgogn/CGoGN

parents 4e5e69b1 695d8500
...@@ -186,7 +186,6 @@ void Viewer::importMesh(std::string& filename) ...@@ -186,7 +186,6 @@ void Viewer::importMesh(std::string& filename)
m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ; m_render->initPrimitives<PFP>(myMap, allDarts, Algo::Render::GL2::TRIANGLES) ;
bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ; bb = Algo::Geometry::computeBoundingBox<PFP>(myMap, position) ;
gPosObj = bb.center() ;
normalBaseSize = bb.diagSize() / 100.0f ; normalBaseSize = bb.diagSize() / 100.0f ;
vertexBaseSize = normalBaseSize * 2.0f ; vertexBaseSize = normalBaseSize * 2.0f ;
...@@ -198,7 +197,7 @@ void Viewer::importMesh(std::string& filename) ...@@ -198,7 +197,7 @@ void Viewer::importMesh(std::string& filename)
m_positionVBO->updateData(position) ; m_positionVBO->updateData(position) ;
m_normalVBO->updateData(normal) ; m_normalVBO->updateData(normal) ;
setParamObject(bb.maxSize(), gPosObj.data()) ; setParamObject(bb.maxSize(), bb.center().data()) ;
updateGLMatrices() ; updateGLMatrices() ;
} }
......
...@@ -78,7 +78,6 @@ public: ...@@ -78,7 +78,6 @@ public:
float shininess ; float shininess ;
Geom::BoundingBox<PFP::VEC3> bb ; Geom::BoundingBox<PFP::VEC3> bb ;
Geom::Vec3f gPosObj ;
float normalBaseSize ; float normalBaseSize ;
float normalScaleFactor ; float normalScaleFactor ;
float vertexBaseSize ; float vertexBaseSize ;
......
...@@ -27,6 +27,11 @@ ...@@ -27,6 +27,11 @@
#include "Algo/Decimation/selector.h" #include "Algo/Decimation/selector.h"
#include "Container/fakeAttribute.h"
#include "Utils/qem.h"
#include "Utils/quadricRGBfunctions.h"
#include "Algo/Geometry/curvature.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -246,12 +251,17 @@ private: ...@@ -246,12 +251,17 @@ private:
} CurvatureEdgeInfo ; } CurvatureEdgeInfo ;
typedef NoMathIOAttribute<CurvatureEdgeInfo> EdgeInfo ; typedef NoMathIOAttribute<CurvatureEdgeInfo> EdgeInfo ;
Geom::BoundingBox<VEC3> bb ;
REAL radius ;
typename PFP::TVEC3 normal ; typename PFP::TVEC3 normal ;
AttributeHandler<EdgeInfo> edgeInfo ; AttributeHandler<EdgeInfo> edgeInfo ;
typename PFP::TREAL k1 ; typename PFP::TREAL edgeangle ;
typename PFP::TREAL k2 ; typename PFP::TREAL kmax ;
typename PFP::TVEC3 K1 ; typename PFP::TREAL kmin ;
typename PFP::TVEC3 K2 ; typename PFP::TVEC3 Kmax ;
typename PFP::TVEC3 Kmin ;
typename PFP::TVEC3 Knormal ;
std::multimap<float,Dart> edges ; std::multimap<float,Dart> edges ;
typename std::multimap<float,Dart>::iterator cur ; typename std::multimap<float,Dart>::iterator cur ;
...@@ -266,6 +276,9 @@ public: ...@@ -266,6 +276,9 @@ 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 = SelectorTrue()) :
EdgeSelector<PFP>(m, pos, approx, select) EdgeSelector<PFP>(m, pos, approx, select)
{ {
bb = Algo::Geometry::computeBoundingBox<PFP>(m, pos) ;
radius = bb.diagSize() * 0.003 ;
normal = m.template getAttribute<VEC3>(VERTEX, "normal") ; normal = m.template getAttribute<VEC3>(VERTEX, "normal") ;
if(!normal.isValid()) if(!normal.isValid())
{ {
...@@ -273,29 +286,40 @@ public: ...@@ -273,29 +286,40 @@ public:
Algo::Geometry::computeNormalVertices<PFP>(m, pos, normal) ; Algo::Geometry::computeNormalVertices<PFP>(m, pos, normal) ;
} }
k1 = m.template getAttribute<REAL>(VERTEX, "k1") ; edgeangle = m.template getAttribute<REAL>(VERTEX, "edgeangle") ;
k2 = m.template getAttribute<REAL>(VERTEX, "k2") ; if(!edgeangle.isValid())
K1 = m.template getAttribute<VEC3>(VERTEX, "K1") ; {
K2 = m.template getAttribute<VEC3>(VERTEX, "K2") ; edgeangle = m.template addAttribute<REAL>(EDGE, "edgeangle") ;
Algo::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
}
kmax = m.template getAttribute<REAL>(VERTEX, "kmax") ;
kmin = m.template getAttribute<REAL>(VERTEX, "kmin") ;
Kmax = m.template getAttribute<VEC3>(VERTEX, "Kmax") ;
Kmin = m.template getAttribute<VEC3>(VERTEX, "Kmin") ;
Knormal = m.template getAttribute<VEC3>(VERTEX, "Knormal") ;
// as all these attributes are computed simultaneously by computeCurvatureVertices // as all these attributes are computed simultaneously by computeCurvatureVertices
// one can assume that if one of them is not valid, the others must be created too // one can assume that if one of them is not valid, the others must be created too
if(!k1.isValid()) if(!kmax.isValid())
{ {
k1 = m.template addAttribute<REAL>(VERTEX, "k1") ; kmax = m.template addAttribute<REAL>(VERTEX, "kmax") ;
k2 = m.template addAttribute<REAL>(VERTEX, "k2") ; kmin = m.template addAttribute<REAL>(VERTEX, "kmin") ;
K1 = m.template addAttribute<VEC3>(VERTEX, "K1") ; Kmax = m.template addAttribute<VEC3>(VERTEX, "Kmax") ;
K2 = m.template addAttribute<VEC3>(VERTEX, "K2") ; Kmin = m.template addAttribute<VEC3>(VERTEX, "Kmin") ;
Algo::Geometry::computeCurvatureVertices<PFP>(m, this->m_position, normal, k1, k2, K1, K2) ; Knormal = m.template addAttribute<VEC3>(VERTEX, "Knormal") ;
Algo::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo>(EDGE, "edgeInfo") ;
} }
~EdgeSelector_Curvature() ~EdgeSelector_Curvature()
{ {
this->m_map.removeAttribute(k1) ; this->m_map.removeAttribute(edgeangle) ;
this->m_map.removeAttribute(k2) ; this->m_map.removeAttribute(kmax) ;
this->m_map.removeAttribute(K1) ; this->m_map.removeAttribute(kmin) ;
this->m_map.removeAttribute(K2) ; this->m_map.removeAttribute(Kmax) ;
this->m_map.removeAttribute(Kmin) ;
this->m_map.removeAttribute(Knormal) ;
this->m_map.removeAttribute(edgeInfo) ; this->m_map.removeAttribute(edgeInfo) ;
} }
SelectorType getType() { return S_Curvature ; } SelectorType getType() { return S_Curvature ; }
......
...@@ -795,14 +795,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2) ...@@ -795,14 +795,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
MAP& m = this->m_map ; MAP& m = this->m_map ;
normal[d2] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ; normal[d2] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ;
Algo::Geometry::computeCurvatureVertex<PFP>(m, d2, this->m_position, normal, k1, k2, K1, K2) ; Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
Dart vit = d2 ; Dart vit = d2 ;
do do
{ {
Dart nVert = m.phi1(vit) ; Dart nVert = m.phi1(vit) ;
normal[nVert] = Algo::Geometry::vertexNormal<PFP>(m, nVert, this->m_position) ; normal[nVert] = Algo::Geometry::vertexNormal<PFP>(m, nVert, this->m_position) ;
Algo::Geometry::computeCurvatureVertex<PFP>(m, nVert, this->m_position, normal, k1, k2, K1, K2) ; Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the updateEdgeInfo(m.phi1(vit), false) ; // must recompute some edge infos in the
if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge if(vit == d2 || vit == dd2) // neighborhood of the collapsed edge
...@@ -891,11 +891,11 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -891,11 +891,11 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
// compute things on the coarse version of the mesh // compute things on the coarse version of the mesh
normal[newV] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ; normal[newV] = Algo::Geometry::vertexNormal<PFP>(m, d2, this->m_position) ;
Algo::Geometry::computeCurvatureVertex<PFP>(m, d2, this->m_position, normal, k1, k2, K1, K2) ; Algo::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, this->m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
VEC3 norm = normal[newV] ; // VEC3 norm = normal[newV] ;
REAL mCurv = ( k1[newV] + k2[newV] ) / REAL(2) ; REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ;
VEC3 cDir1 = K1[newV] ; // VEC3 cDir1 = Kmax[newV] ;
// vertex split to reset the initial connectivity and embeddings // vertex split to reset the initial connectivity and embeddings
m.insertTrianglePair(d, d2, dd2) ; m.insertTrianglePair(d, d2, dd2) ;
...@@ -904,17 +904,17 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -904,17 +904,17 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
REAL err = 0 ; REAL err = 0 ;
REAL norm_deviation_1 = REAL(1) / abs(norm * normal[v1]) ; // REAL norm_deviation_1 = REAL(1) / abs(norm * normal[v1]) ;
REAL norm_deviation_2 = REAL(1) / abs(norm * normal[v2]) ; // REAL norm_deviation_2 = REAL(1) / abs(norm * normal[v2]) ;
err += norm_deviation_1 + norm_deviation_2 ; // err += norm_deviation_1 + norm_deviation_2 ;
REAL mCurv_deviation_1 = abs(mCurv - (k1[v1] + k2[v1] / REAL(2))) ; REAL mCurv_deviation_1 = abs(mCurv - (kmax[v1] + kmin[v1] / REAL(2))) ;
REAL mCurv_deviation_2 = abs(mCurv - (k1[v2] + k2[v2] / REAL(2))) ; REAL mCurv_deviation_2 = abs(mCurv - (kmax[v2] + kmin[v2] / REAL(2))) ;
err += mCurv_deviation_1 + mCurv_deviation_2 ; err += mCurv_deviation_1 + mCurv_deviation_2 ;
REAL cDir1_deviation_1 = REAL(1) / abs(cDir1 * K1[v1]) ; // REAL cDir1_deviation_1 = REAL(1) / abs(cDir1 * Kmax[v1]) ;
REAL cDir1_deviation_2 = REAL(1) / abs(cDir1 * K1[v2]) ; // REAL cDir1_deviation_2 = REAL(1) / abs(cDir1 * Kmax[v2]) ;
err += cDir1_deviation_1 + cDir1_deviation_2 ; // err += cDir1_deviation_1 + cDir1_deviation_2 ;
einfo.it = edges.insert(std::make_pair(err, d)) ; einfo.it = edges.insert(std::make_pair(err, d)) ;
einfo.valid = true ; einfo.valid = true ;
......
...@@ -25,11 +25,6 @@ ...@@ -25,11 +25,6 @@
#ifndef __SELECTOR_H__ #ifndef __SELECTOR_H__
#define __SELECTOR_H__ #define __SELECTOR_H__
#include "Utils/qem.h"
#include "Utils/quadricRGBfunctions.h"
#include "Container/fakeAttribute.h"
#include "Algo/Geometry/curvature.h"
namespace CGoGN namespace CGoGN
{ {
...@@ -39,7 +34,6 @@ namespace Algo ...@@ -39,7 +34,6 @@ namespace Algo
namespace Decimation namespace Decimation
{ {
enum SelectorType enum SelectorType
{ {
S_MapOrder, S_MapOrder,
...@@ -53,11 +47,9 @@ enum SelectorType ...@@ -53,11 +47,9 @@ enum SelectorType
S_hLightfield S_hLightfield
} ; } ;
template <typename PFP> class ApproximatorGen ; template <typename PFP> class ApproximatorGen ;
template <typename PFP, typename T> class Approximator ; template <typename PFP, typename T> class Approximator ;
template <typename PFP> template <typename PFP>
class EdgeSelector class EdgeSelector
{ {
...@@ -91,5 +83,4 @@ public: ...@@ -91,5 +83,4 @@ public:
} // namespace CGoGN } // namespace CGoGN
#endif #endif
...@@ -30,7 +30,7 @@ namespace CGoGN ...@@ -30,7 +30,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace Filters2D namespace Filtering
{ {
/** /**
...@@ -48,7 +48,6 @@ void computeNewPositionsFromFaceNormals( ...@@ -48,7 +48,6 @@ void computeNewPositionsFromFaceNormals(
const typename PFP::TVEC3& faceNewNormal, const typename PFP::TVEC3& faceNewNormal,
const FunctorSelect& select) const FunctorSelect& select)
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
...@@ -70,9 +69,7 @@ void computeNewPositionsFromFaceNormals( ...@@ -70,9 +69,7 @@ void computeNewPositionsFromFaceNormals(
{ {
sumAreas += faceArea[dd] ; sumAreas += faceArea[dd] ;
VEC3 vT = faceCentroid[dd] - pos_d ; VEC3 vT = faceCentroid[dd] - pos_d ;
const VEC3& normal = faceNewNormal[dd] ; vT = (vT * faceNewNormal[dd]) * faceNormal[dd] ;
REAL scal = vT * normal ;
vT = scal * faceNormal[dd] ;
displ += faceArea[dd] * vT ; displ += faceArea[dd] * vT ;
dd = map.phi1(map.phi2(dd)) ; dd = map.phi1(map.phi2(dd)) ;
} while(dd != d) ; } while(dd != d) ;
...@@ -84,9 +81,8 @@ void computeNewPositionsFromFaceNormals( ...@@ -84,9 +81,8 @@ void computeNewPositionsFromFaceNormals(
template <typename PFP> template <typename PFP>
void filterAverageNormals(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select) void filterAverageNormals(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
...@@ -148,9 +144,8 @@ void filterAverageNormals(typename PFP::MAP& map, const typename PFP::TVEC3& pos ...@@ -148,9 +144,8 @@ void filterAverageNormals(typename PFP::MAP& map, const typename PFP::TVEC3& pos
} }
template <typename PFP> template <typename PFP>
void filterMMSE(typename PFP::MAP& map, float sigmaN2, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select) void filterMMSE(typename PFP::MAP& map, float sigmaN2, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
...@@ -252,9 +247,8 @@ void filterMMSE(typename PFP::MAP& map, float sigmaN2, const typename PFP::TVEC3 ...@@ -252,9 +247,8 @@ void filterMMSE(typename PFP::MAP& map, float sigmaN2, const typename PFP::TVEC3
} }
template <typename PFP> template <typename PFP>
void filterTNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select) void filterTNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
...@@ -392,9 +386,8 @@ void filterTNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con ...@@ -392,9 +386,8 @@ void filterTNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
} }
template <typename PFP> template <typename PFP>
void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select) void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::MAP MAP ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
...@@ -550,7 +543,7 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con ...@@ -550,7 +543,7 @@ void filterVNBA(typename PFP::MAP& map, float sigmaN2, float SUSANthreshold, con
// CGoGNout <<" adaptive rate = "<< float(nbAdapt)/float(nbTot)<<CGoGNendl; // CGoGNout <<" adaptive rate = "<< float(nbAdapt)/float(nbTot)<<CGoGNendl;
} }
} //namespace Filters2D } //namespace Filtering
} //namespace Algo } //namespace Algo
......
...@@ -22,20 +22,26 @@ ...@@ -22,20 +22,26 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include "Algo/Filtering/functors.h"
#include "Algo/Selection/collector.h"
namespace CGoGN namespace CGoGN
{ {
namespace Algo namespace Algo
{ {
namespace Filters2D namespace Filtering
{ {
template <typename PFP> template <typename PFP>
void filterAverage(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select) void filterAveragePositions(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
FunctorAverage<typename PFP::MAP, typename PFP::VEC3> fa(map, position) ;
Algo::Selection::Collector_OneRing<PFP> c(map) ;
CellMarker markV(map, VERTEX); CellMarker markV(map, VERTEX);
for(Dart d = map.begin(); d != map.end(); map.next(d)) for(Dart d = map.begin(); d != map.end(); map.next(d))
{ {
...@@ -43,30 +49,16 @@ void filterAverage(typename PFP::MAP& map, const typename PFP::TVEC3& position, ...@@ -43,30 +49,16 @@ void filterAverage(typename PFP::MAP& map, const typename PFP::TVEC3& position,
{ {
markV.mark(d); markV.mark(d);
// get position of vertex c.collectBorder(d) ;
const VEC3& pos_d = position[d] ; fa.reset() ;
c.applyOnBorder(fa) ;
// traversal of neighbour vertices position2[d] = fa.getAverage() ;
VEC3 l(0) ;
int nbE = 0 ;
Dart dd = d ;
do
{
Dart e = map.phi2(dd) ;
l += position[e] - pos_d ;
nbE++ ;
dd = map.phi1(e) ;
} while(dd != d) ;
l /= float(nbE) ;
position2[d] = pos_d + l ;
} }
} }
} }
} //namespace Filters2D } // namespace Filtering
} //namespace Algo } // namespace Algo
} //namespace CGoGN } // namespace CGoGN
...@@ -30,7 +30,7 @@ namespace CGoGN ...@@ -30,7 +30,7 @@ namespace CGoGN
namespace Algo namespace Algo
{ {
namespace Filters2D namespace Filtering
{ {
...@@ -57,8 +57,7 @@ void sigmaBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position, ...@@ -57,8 +57,7 @@ void sigmaBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position,
Dart e = map.phi2(dd) ; Dart e = map.phi2(dd) ;
if(!mv.isMarked(e)) if(!mv.isMarked(e))
{ {
VEC3 vec = Algo::Geometry::vectorOutOfDart<PFP>(map, dd, position) ; sumLengths += Algo::Geometry::edgeLength<PFP>(map, dd, position) ;
sumLengths += vec.norm() ;
sumAngles += Geom::angle(normal[d], normal[e]) ; sumAngles += Geom::angle(normal[d], normal[e]) ;
++nbEdges ; ++nbEdges ;
} }
...@@ -74,7 +73,7 @@ void sigmaBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position, ...@@ -74,7 +73,7 @@ void sigmaBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position,
} }
template <typename PFP> template <typename PFP>
void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select) void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
...@@ -112,7 +111,7 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position ...@@ -112,7 +111,7 @@ void filterBilateral(typename PFP::MAP& map, const typename PFP::TVEC3& position
} }
template <typename PFP> template <typename PFP>
void filterSUSAN(typename PFP::MAP& map, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select) void filterSUSAN(typename PFP::MAP& map, float SUSANthreshold, const typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const typename PFP::TVEC3& normal, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
...@@ -171,7 +170,7 @@ void filterSUSAN(typename PFP::MAP& map, float SUSANthreshold, const typename PF ...@@ -171,7 +170,7 @@ void filterSUSAN(typename PFP::MAP& map, float SUSANthreshold, const typename PF
// CGoGNout <<" susan rate = "<< float(nbSusan)/float(nbTot)<<CGoGNendl; // CGoGNout <<" susan rate = "<< float(nbSusan)/float(nbTot)<<CGoGNendl;
} }
} //namespace Filters2D } //namespace Filtering
} //namespace Algo } //namespace Algo
......
...@@ -22,50 +22,92 @@ ...@@ -22,50 +22,92 @@
* * * *
*******************************************************************************/ *******************************************************************************/
#include "Algo/Filtering/functors.h"
#include "Algo/Selection/collector.h"
namespace CGoGN namespace CGoGN
{ {
namespace Algo namespace Algo
{ {
namespace Filters2D namespace Filtering
{
template <typename PFP>
void filterTaubin(typename PFP::MAP& map, typename PFP::TVEC3& position, typename PFP::TVEC3& position2, const FunctorSelect& select = SelectorTrue())
{ {
typedef typename PFP::VEC3 VEC3 ;
FunctorAverage<typename PFP::MAP, typename PFP::VEC3> fa(map, position) ;
Algo::Selection::Collector_OneRing<PFP> c(map) ;
const float lambda = 0.6307 ;
const float mu = -0.6732 ;