Coupure prévue mardi 3 Août au matin pour maintenance du serveur. Nous faisons au mieux pour que celle-ci soit la plus brève possible.

Commit ab4e079a authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

add some Cell typing

parent d944530c
...@@ -35,7 +35,8 @@ public: ...@@ -35,7 +35,8 @@ public:
virtual void select(Dart d, bool emitSignal = true) = 0; virtual void select(Dart d, bool emitSignal = true) = 0;
virtual void unselect(Dart d, bool emitSignal = true) = 0; virtual void unselect(Dart d, bool emitSignal = true) = 0;
inline void select(const std::vector<Dart>& d) template <unsigned int ORBIT>
inline void select(const std::vector<Cell<ORBIT> >& d)
{ {
for(unsigned int i = 0; i < d.size(); ++i) for(unsigned int i = 0; i < d.size(); ++i)
select(d[i], false); select(d[i], false);
...@@ -47,7 +48,8 @@ public: ...@@ -47,7 +48,8 @@ public:
} }
} }
inline void unselect(const std::vector<Dart>& d) template <unsigned int ORBIT>
inline void unselect(const std::vector<Cell<ORBIT> >& d)
{ {
for(unsigned int i = 0; i < d.size(); ++i) for(unsigned int i = 0; i < d.size(); ++i)
unselect(d[i], false); unselect(d[i], false);
......
...@@ -63,7 +63,7 @@ void computeCurvatureVertices_QuadraticFitting( ...@@ -63,7 +63,7 @@ void computeCurvatureVertices_QuadraticFitting(
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_QuadraticFitting( void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax,
...@@ -74,7 +74,7 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -74,7 +74,7 @@ void computeCurvatureVertex_QuadraticFitting(
template <typename PFP> template <typename PFP>
void vertexQuadraticFitting( void vertexQuadraticFitting(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::MATRIX33& localFrame, typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -104,7 +104,8 @@ template <typename PFP> ...@@ -104,7 +104,8 @@ template <typename PFP>
void cubicFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ; void cubicFittingAddVertexNormal(typename PFP::VEC3& v, typename PFP::VEC3& n, typename PFP::VEC3& p, typename PFP::MATRIX33& localFrame) ;
*/ */
/* normal cycles by [ACDLD03] : useful for parallel computing*/ /* normal cycles by [ACDLD03] : useful for parallel computing */
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles( void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
...@@ -122,7 +123,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -122,7 +123,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::REAL radius, typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -174,7 +175,7 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -174,7 +175,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::REAL radius, typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -204,8 +205,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -204,8 +205,7 @@ void computeCurvatureVertices_NormalCycles(
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map, Vertex v,
Dart dart,
Algo::Surface::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -233,8 +233,7 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -233,8 +233,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map, Vertex v,
Dart dart,
Algo::Surface::Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
......
...@@ -50,14 +50,14 @@ void computeCurvatureVertices_QuadraticFitting( ...@@ -50,14 +50,14 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& Kmin) VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& Kmin)
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_QuadraticFitting<PFP>(map, d, position, normal, kmax, kmin, Kmax, Kmin) ; computeCurvatureVertex_QuadraticFitting<PFP>(map, v, position, normal, kmax, kmin, Kmax, Kmin) ;
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_QuadraticFitting( void computeCurvatureVertex_QuadraticFitting(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax, VertexAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& kmax,
...@@ -69,17 +69,17 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -69,17 +69,17 @@ void computeCurvatureVertex_QuadraticFitting(
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::MATRIX33 MATRIX33 ; typedef typename PFP::MATRIX33 MATRIX33 ;
VEC3 n = normal[dart] ; VEC3 n = normal[v] ;
MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(map, dart, position, n) ; MATRIX33 localFrame = Algo::Geometry::vertexLocalFrame<PFP>(map, v, position, n) ;
MATRIX33 invLocalFrame ; MATRIX33 invLocalFrame ;
localFrame.invert(invLocalFrame) ; localFrame.invert(invLocalFrame) ;
REAL a, b, c, d, e; REAL a, b, c, d, e;
//vertexCubicFitting(map,dart,localFrame,a,b,c,d,e,f,g,h,i) ; //vertexCubicFitting(map,dart,localFrame,a,b,c,d,e,f,g,h,i) ;
vertexQuadraticFitting<PFP>(map, dart, localFrame, position, normal, a, b, c, d, e) ; vertexQuadraticFitting<PFP>(map, v, localFrame, position, normal, a, b, c, d, e) ;
REAL kmax_v, kmin_v, Kmax_x, Kmax_y ; // REAL kmax_v, kmin_v, Kmax_x, Kmax_y ;
// /*int res = */slaev2_(&a, &b, &c, &kmax_v, &kmin_v, &Kmax_x, &Kmax_y) ; // /*int res = */slaev2_(&a, &b, &c, &kmax_v, &kmin_v, &Kmax_x, &Kmax_y) ;
Eigen::Matrix<REAL,2,2> m; Eigen::Matrix<REAL,2,2> m;
...@@ -89,8 +89,8 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -89,8 +89,8 @@ void computeCurvatureVertex_QuadraticFitting(
Eigen::SelfAdjointEigenSolver<Eigen::Matrix<REAL,2,2> > solver(m); Eigen::SelfAdjointEigenSolver<Eigen::Matrix<REAL,2,2> > solver(m);
const Eigen::Matrix<REAL,2,1>& ev = solver.eigenvalues(); const Eigen::Matrix<REAL,2,1>& ev = solver.eigenvalues();
kmax_v = ev[0]; REAL kmax_v = ev[0];
kmin_v = ev[1]; REAL kmin_v = ev[1];
const Eigen::Matrix<REAL,2,2>& evec = solver.eigenvectors(); const Eigen::Matrix<REAL,2,2>& evec = solver.eigenvectors();
VEC3 Kmax_v(evec(0,0), evec(1,0), 0.0f) ; VEC3 Kmax_v(evec(0,0), evec(1,0), 0.0f) ;
...@@ -101,30 +101,30 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -101,30 +101,30 @@ void computeCurvatureVertex_QuadraticFitting(
if (kmax_v < kmin_v) if (kmax_v < kmin_v)
{ {
kmax[dart] = -kmax_v ; kmax[v] = -kmax_v ;
kmin[dart] = -kmin_v ; kmin[v] = -kmin_v ;
Kmax[dart] = Kmax_v ; Kmax[v] = Kmax_v ;
Kmin[dart] = Kmin_v ; Kmin[v] = Kmin_v ;
} }
else else
{ {
kmax[dart] = -kmin_v ; kmax[v] = -kmin_v ;
kmin[dart] = -kmax_v ; kmin[v] = -kmax_v ;
Kmax[dart] = Kmin_v ; Kmax[v] = Kmin_v ;
Kmin[dart] = Kmax_v ; Kmin[v] = Kmax_v ;
} }
} }
template <typename PFP> template <typename PFP>
void vertexQuadraticFitting( void vertexQuadraticFitting(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::MATRIX33& localFrame, typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
float& a, float& b, float& c, float& d, float& e) float& a, float& b, float& c, float& d, float& e)
{ {
typename PFP::VEC3 p = position[dart] ; typename PFP::VEC3 p = position[v] ;
NLContext nlContext = nlNewContext() ; NLContext nlContext = nlNewContext() ;
nlMakeCurrent(nlContext) ; nlMakeCurrent(nlContext) ;
...@@ -132,14 +132,12 @@ void vertexQuadraticFitting( ...@@ -132,14 +132,12 @@ void vertexQuadraticFitting(
nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE) ; nlSolverParameteri(NL_LEAST_SQUARES, NL_TRUE) ;
nlBegin(NL_SYSTEM) ; nlBegin(NL_SYSTEM) ;
nlBegin(NL_MATRIX) ; nlBegin(NL_MATRIX) ;
Traversor2VVaE<typename PFP::MAP> tav(map, dart) ; foreach_adjacent2<EDGE>(map, v, [&] (Vertex it) {
for(Dart it = tav.begin(); it != tav.end(); it = tav.next()) typename PFP::VEC3 itp = position[it] ;
{ quadraticFittingAddVertexPos<PFP>(v, itp, localFrame) ;
typename PFP::VEC3 v = position[it] ; typename PFP::VEC3 itn = normal[it] ;
quadraticFittingAddVertexPos<PFP>(v, p, localFrame) ; quadraticFittingAddVertexNormal<PFP>(itp, itn, p, localFrame) ;
typename PFP::VEC3 n = normal[it] ; });
quadraticFittingAddVertexNormal<PFP>(v, n, p, localFrame) ;
}
nlEnd(NL_MATRIX) ; nlEnd(NL_MATRIX) ;
nlEnd(NL_SYSTEM) ; nlEnd(NL_SYSTEM) ;
nlSolve() ; nlSolve() ;
...@@ -303,14 +301,14 @@ void computeCurvatureVertices_NormalCycles( ...@@ -303,14 +301,14 @@ void computeCurvatureVertices_NormalCycles(
unsigned int thread) unsigned int thread)
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, d, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ; computeCurvatureVertex_NormalCycles<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::REAL radius, typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -330,17 +328,17 @@ void computeCurvatureVertex_NormalCycles( ...@@ -330,17 +328,17 @@ void computeCurvatureVertex_NormalCycles(
// collect the normal cycle tensor // collect the normal cycle tensor
Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ; Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ;
neigh.collectAll(dart) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor); neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// solve eigen problem // solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor)); Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues()); const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors()); const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread); normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
// if (dart.index % 15000 == 0) // if (dart.index % 15000 == 0)
// { // {
...@@ -368,14 +366,14 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -368,14 +366,14 @@ void computeCurvatureVertices_NormalCycles_Projected(
unsigned int thread) unsigned int thread)
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Vertex v = t.begin(); v.dart != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, d, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ; computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal, thread) ;
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map, typename PFP::MAP& map,
Dart dart, Vertex v,
typename PFP::REAL radius, typename PFP::REAL radius,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
...@@ -395,26 +393,26 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -395,26 +393,26 @@ void computeCurvatureVertex_NormalCycles_Projected(
// collect the normal cycle tensor // collect the normal cycle tensor
Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ; Selection::Collector_WithinSphere<PFP> neigh(map, position, radius, thread) ;
neigh.collectAll(dart) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor); neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// project the tensor // project the tensor
normalCycles_ProjectTensor<PFP>(tensor,normal[dart],thread); normalCycles_ProjectTensor<PFP>(tensor, normal[v], thread);
// solve eigen problem // solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor)); Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues()); const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors()); const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread); normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles( void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
...@@ -426,15 +424,14 @@ void computeCurvatureVertices_NormalCycles( ...@@ -426,15 +424,14 @@ void computeCurvatureVertices_NormalCycles(
unsigned int thread) unsigned int thread)
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles<PFP>(map, d, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ; computeCurvatureVertex_NormalCycles<PFP>(map, v, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
typename PFP::MAP& map, Vertex v,
Dart dart, Algo::Surface::Selection::Collector<PFP>& neigh,
Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
...@@ -452,23 +449,23 @@ void computeCurvatureVertex_NormalCycles( ...@@ -452,23 +449,23 @@ void computeCurvatureVertex_NormalCycles(
typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX; typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX;
// collect the normal cycle tensor // collect the normal cycle tensor
neigh.collectAll(dart) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor); neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// solve eigen problem // solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor)); Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues()); const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors()); const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread); normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected( void computeCurvatureVertices_NormalCycles_Projected(
typename PFP::MAP& map, typename PFP::MAP& map,
Selection::Collector<PFP> & neigh, Algo::Surface::Selection::Collector<PFP>& neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
...@@ -480,15 +477,14 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -480,15 +477,14 @@ void computeCurvatureVertices_NormalCycles_Projected(
unsigned int thread) unsigned int thread)
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Dart d = t.begin(); d != t.end(); d = t.next()) for(Vertex v = t.begin(); v != t.end(); v = t.next())
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, d, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ; computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, neigh, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal,thread) ;
} }
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
typename PFP::MAP& map, Vertex v,
Dart dart, Algo::Surface::Selection::Collector<PFP>& neigh,
Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP::IMPL>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP::IMPL>& edgeangle,
...@@ -506,20 +502,20 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -506,20 +502,20 @@ void computeCurvatureVertex_NormalCycles_Projected(
typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX; typedef Eigen::Matrix<REAL,3,3,Eigen::RowMajor> E_MATRIX;
// collect the normal cycle tensor // collect the normal cycle tensor
neigh.collectAll(dart) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle,tensor); neigh.computeNormalCyclesTensor(position, edgeangle, tensor);
// project the tensor // project the tensor
normalCycles_ProjectTensor<PFP>(tensor,normal[dart],thread); normalCycles_ProjectTensor<PFP>(tensor, normal[v], thread);
// solve eigen problem // solve eigen problem
Eigen::SelfAdjointEigenSolver<E_MATRIX> solver (Utils::convertRef<E_MATRIX>(tensor)); Eigen::SelfAdjointEigenSolver<E_MATRIX> solver(Utils::convertRef<E_MATRIX>(tensor));
const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues()); const VEC3& ev = Utils::convertRef<VEC3>(solver.eigenvalues());
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors()); const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[dart],kmin[dart],Kmax[dart],Kmin[dart],Knormal[dart],normal[dart],thread); normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v],thread);
} }
template <typename PFP> template <typename PFP>
...@@ -535,7 +531,7 @@ void normalCycles_SortAndSetEigenComponents( ...@@ -535,7 +531,7 @@ void normalCycles_SortAndSetEigenComponents(
unsigned int /*thread*/) unsigned int /*thread*/)
{ {
// sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax // sort eigen components : ev[inormal] has minimal absolute value ; kmin = ev[imin] <= ev[imax] = kmax
int inormal=0, imin, imax ; int inormal = 0, imin, imax ;
if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1; if (fabs(e_val[1]) < fabs(e_val[inormal])) inormal = 1;
if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2; if (fabs(e_val[2]) < fabs(e_val[inormal])) inormal = 2;
imin = (inormal + 1) % 3; imin = (inormal + 1) % 3;
...@@ -562,7 +558,7 @@ void normalCycles_SortAndSetEigenComponents( ...@@ -562,7 +558,7 @@ void normalCycles_SortAndSetEigenComponents(
} }
template <typename PFP> template <typename PFP>
void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsigned int /*thread*/) void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL>& tensor, unsigned int /*thread*/)
{ {
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
...@@ -571,12 +567,12 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi ...@@ -571,12 +567,12 @@ void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL> & tensor, unsi