Commit 6bd24868 authored by Pierre Kraemer's avatar Pierre Kraemer

Merge branch 'develop' into 'develop'

remove normal cycle computation from collectors

See merge request !66
parents 49adae74 0acabc38
...@@ -354,6 +354,7 @@ private: ...@@ -354,6 +354,7 @@ private:
VertexAttribute<VEC3, MAP> normal ; VertexAttribute<VEC3, MAP> normal ;
EdgeAttribute<EdgeInfo, MAP> edgeInfo ; EdgeAttribute<EdgeInfo, MAP> edgeInfo ;
EdgeAttribute<REAL, MAP> edgeangle ; EdgeAttribute<REAL, MAP> edgeangle ;
EdgeAttribute<REAL, MAP> edgearea ;
VertexAttribute<REAL, MAP> kmax ; VertexAttribute<REAL, MAP> kmax ;
VertexAttribute<REAL, MAP> kmin ; VertexAttribute<REAL, MAP> kmin ;
VertexAttribute<VEC3, MAP> Kmax ; VertexAttribute<VEC3, MAP> Kmax ;
...@@ -390,6 +391,13 @@ public: ...@@ -390,6 +391,13 @@ public:
Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ; Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
} }
edgearea = m.template getAttribute<REAL, EDGE, MAP>("edgearea") ;
if(!edgearea.isValid())
{
edgearea = m.template addAttribute<REAL, EDGE, MAP>("edgearea") ;
Algo::Surface::Geometry::computeAreaEdges<PFP>(m, pos, edgearea) ;
}
kmax = m.template getAttribute<REAL, VERTEX, MAP>("kmax") ; kmax = m.template getAttribute<REAL, VERTEX, MAP>("kmax") ;
kmin = m.template getAttribute<REAL, VERTEX, MAP>("kmin") ; kmin = m.template getAttribute<REAL, VERTEX, MAP>("kmin") ;
Kmax = m.template getAttribute<VEC3, VERTEX, MAP>("Kmax") ; Kmax = m.template getAttribute<VEC3, VERTEX, MAP>("Kmax") ;
...@@ -404,7 +412,7 @@ public: ...@@ -404,7 +412,7 @@ public:
Kmax = m.template addAttribute<VEC3, VERTEX, MAP>("Kmax") ; Kmax = m.template addAttribute<VEC3, VERTEX, MAP>("Kmax") ;
Kmin = m.template addAttribute<VEC3, VERTEX, MAP>("Kmin") ; Kmin = m.template addAttribute<VEC3, VERTEX, MAP>("Kmin") ;
Knormal = m.template addAttribute<VEC3, VERTEX, MAP>("Knormal") ; Knormal = m.template addAttribute<VEC3, VERTEX, MAP>("Knormal") ;
Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertices_NormalCycles<PFP>(m, radius, pos, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ;
...@@ -412,6 +420,7 @@ public: ...@@ -412,6 +420,7 @@ public:
~EdgeSelector_Curvature() ~EdgeSelector_Curvature()
{ {
// this->m_map.removeAttribute(edgeangle) ; // this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
// this->m_map.removeAttribute(kmax) ; // this->m_map.removeAttribute(kmax) ;
// this->m_map.removeAttribute(kmin) ; // this->m_map.removeAttribute(kmin) ;
// this->m_map.removeAttribute(Kmax) ; // this->m_map.removeAttribute(Kmax) ;
...@@ -452,6 +461,7 @@ private: ...@@ -452,6 +461,7 @@ private:
EdgeAttribute<EdgeInfo, MAP> edgeInfo ; EdgeAttribute<EdgeInfo, MAP> edgeInfo ;
EdgeAttribute<REAL, MAP> edgeangle ; EdgeAttribute<REAL, MAP> edgeangle ;
EdgeAttribute<REAL, MAP> edgearea ;
std::multimap<float,Dart> edges ; std::multimap<float,Dart> edges ;
typename std::multimap<float,Dart>::iterator cur ; typename std::multimap<float,Dart>::iterator cur ;
...@@ -473,11 +483,19 @@ public: ...@@ -473,11 +483,19 @@ public:
Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ; Algo::Surface::Geometry::computeAnglesBetweenNormalsOnEdges<PFP>(m, pos, edgeangle) ;
} }
edgearea = m.template getAttribute<REAL, EDGE, MAP>("edgearea") ;
if(!edgearea.isValid())
{
edgearea = m.template addAttribute<REAL, EDGE, MAP>("edgearea") ;
Algo::Surface::Geometry::computeAreaEdges<PFP>(m, pos, edgearea) ;
}
edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ; edgeInfo = m.template addAttribute<EdgeInfo, EDGE, MAP>("edgeInfo") ;
} }
~EdgeSelector_CurvatureTensor() ~EdgeSelector_CurvatureTensor()
{ {
// this->m_map.removeAttribute(edgeangle) ; // this->m_map.removeAttribute(edgeangle) ;
// this->m_map.removeAttribute(edgearea) ;
this->m_map.removeAttribute(edgeInfo) ; this->m_map.removeAttribute(edgeInfo) ;
} }
SelectorType getType() { return S_CurvatureTensor ; } SelectorType getType() { return S_CurvatureTensor ; }
......
...@@ -1022,14 +1022,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2) ...@@ -1022,14 +1022,14 @@ void EdgeSelector_Curvature<PFP>::updateAfterCollapse(Dart d2, Dart dd2)
MAP& m = this->m_map ; MAP& m = this->m_map ;
normal[d2] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ; normal[d2] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, edgearea, 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::Surface::Geometry::vertexNormal<PFP>(m, nVert, m_position) ; normal[nVert] = Algo::Surface::Geometry::vertexNormal<PFP>(m, nVert, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, nVert, radius, m_position, normal, edgeangle, edgearea, 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
...@@ -1131,7 +1131,7 @@ void EdgeSelector_Curvature<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1131,7 +1131,7 @@ 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::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ; normal[newV] = Algo::Surface::Geometry::vertexNormal<PFP>(m, d2, m_position) ;
Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; Algo::Surface::Geometry::computeCurvatureVertex_NormalCycles<PFP>(m, d2, radius, m_position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
// VEC3 norm = normal[newV] ; // VEC3 norm = normal[newV] ;
REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ; REAL mCurv = (kmax[newV] + kmin[newV]) / REAL(2) ;
...@@ -1330,7 +1330,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1330,7 +1330,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MATRIX tens1; MATRIX tens1;
Algo::Surface::Selection::Collector_OneRing_AroundEdge<PFP> col1(m); Algo::Surface::Selection::Collector_OneRing_AroundEdge<PFP> col1(m);
col1.collectAll(d); col1.collectAll(d);
col1.computeNormalCyclesTensor(m_position, edgeangle, tens1); // edgeangle is up to date here Algo::Surface::Geometry::normalCycles_computeTensor(col1, m_position, edgeangle, tens1); // edgeangle is up to date here
tens1 *= col1.computeArea(m_position); // mean tensor * area = integral of the tensor tens1 *= col1.computeArea(m_position); // mean tensor * area = integral of the tensor
Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens1); Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens1);
...@@ -1345,7 +1345,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo) ...@@ -1345,7 +1345,7 @@ void EdgeSelector_CurvatureTensor<PFP>::computeEdgeInfo(Dart d, EdgeInfo& einfo)
MATRIX tens2; MATRIX tens2;
Algo::Surface::Selection::Collector_OneRing<PFP> col2(m); Algo::Surface::Selection::Collector_OneRing<PFP> col2(m);
col2.collectAll(d); col2.collectAll(d);
col2.computeNormalCyclesTensor(m_position, tens2); // edgeangle is not up to date here Algo::Surface::Geometry::normalCycles_computeTensor(col2, m_position, tens2); // edgeangle is not up to date here
tens2 *= col2.computeArea(m_position); // mean tensor * area = integral of the tensor tens2 *= col2.computeArea(m_position); // mean tensor * area = integral of the tensor
Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens2); Algo::Surface::Geometry::normalCycles_SortTensor<PFP>(tens2);
......
...@@ -58,7 +58,8 @@ void computeCurvatureVertices_QuadraticFitting( ...@@ -58,7 +58,8 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin
);
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_QuadraticFitting( void computeCurvatureVertex_QuadraticFitting(
...@@ -69,7 +70,8 @@ void computeCurvatureVertex_QuadraticFitting( ...@@ -69,7 +70,8 @@ void computeCurvatureVertex_QuadraticFitting(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin
);
template <typename PFP> template <typename PFP>
void vertexQuadraticFitting( void vertexQuadraticFitting(
...@@ -78,20 +80,23 @@ void vertexQuadraticFitting( ...@@ -78,20 +80,23 @@ void vertexQuadraticFitting(
typename PFP::MATRIX33& localFrame, typename PFP::MATRIX33& localFrame,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
typename PFP::REAL& a, typename PFP::REAL& b, typename PFP::REAL& c, typename PFP::REAL& d, typename PFP::REAL& e) ; typename PFP::REAL& a, typename PFP::REAL& b, typename PFP::REAL& c, typename PFP::REAL& d, typename PFP::REAL& e
);
template <typename PFP> template <typename PFP>
void quadraticFittingAddVertexPos( void quadraticFittingAddVertexPos(
typename PFP::VEC3& v, typename PFP::VEC3& v,
typename PFP::VEC3& p, typename PFP::VEC3& p,
typename PFP::MATRIX33& localFrame) ; typename PFP::MATRIX33& localFrame
);
template <typename PFP> template <typename PFP>
void quadraticFittingAddVertexNormal( void quadraticFittingAddVertexNormal(
typename PFP::VEC3& v, typename PFP::VEC3& v,
typename PFP::VEC3& n, typename PFP::VEC3& n,
typename PFP::VEC3& p, typename PFP::VEC3& p,
typename PFP::MATRIX33& localFrame) ; typename PFP::MATRIX33& localFrame
);
/* /*
template <typename PFP> template <typename PFP>
...@@ -118,7 +123,8 @@ void computeCurvatureVertices_NormalCycles( ...@@ -118,7 +123,8 @@ void computeCurvatureVertices_NormalCycles(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal
);
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void computeCurvatureVertex_NormalCycles(
...@@ -133,27 +139,8 @@ void computeCurvatureVertex_NormalCycles( ...@@ -133,27 +139,8 @@ void computeCurvatureVertex_NormalCycles(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal
);
template <typename PFP>
void normalCycles_SortAndSetEigenComponents(
const typename PFP::VEC3& e_val,
const Geom::Matrix<3,3,typename PFP::REAL> & e_vec,
typename PFP::REAL& kmax,
typename PFP::REAL& kmin,
typename PFP::VEC3& Kmax,
typename PFP::VEC3& Kmin,
typename PFP::VEC3& Knormal,
const typename PFP::VEC3& normal) ;
template <typename PFP>
void normalCycles_SortTensor(
Geom::Matrix<3,3,typename PFP::REAL>& tensor) ;
template <typename PFP>
void normalCycles_ProjectTensor(
Geom::Matrix<3,3,typename PFP::REAL>& tensor,
const typename PFP::VEC3& normal_vector) ;
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected( void computeCurvatureVertices_NormalCycles_Projected(
...@@ -167,7 +154,8 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -167,7 +154,8 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal
);
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void computeCurvatureVertex_NormalCycles_Projected(
...@@ -182,70 +170,128 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -182,70 +170,128 @@ void computeCurvatureVertex_NormalCycles_Projected(
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal
);
/* normal cycles with collector as a parameter : not usable in parallel */
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles( void normalCycles_computeTensor(
typename PFP::MAP& map, Algo::Surface::Selection::Collector<PFP>& col,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal, Geom::Matrix<3,3,typename PFP::REAL>& tensor
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle, );
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles( void normalCycles_computeTensor(
Vertex v, Algo::Surface::Selection::Collector<PFP>& col,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea, Geom::Matrix<3,3,typename PFP::REAL>& tensor
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax, );
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles_Projected( void normalCycles_computeTensor(
typename PFP::MAP& map, Algo::Surface::Selection::Collector<PFP>& col,
Algo::Surface::Selection::Collector<PFP> & neigh,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea, const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax, Geom::Matrix<3,3,typename PFP::REAL>& tensor
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, );
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
template <typename PFP> template <typename PFP>
void computeCurvatureVertex_NormalCycles_Projected( void normalCycles_SortAndSetEigenComponents(
Vertex v, const typename PFP::VEC3& e_val,
Algo::Surface::Selection::Collector<PFP> & neigh, const Geom::Matrix<3,3,typename PFP::REAL> & e_vec,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, typename PFP::REAL& kmax,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal, typename PFP::REAL& kmin,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle, typename PFP::VEC3& Kmax,
const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea, typename PFP::VEC3& Kmin,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax, typename PFP::VEC3& Knormal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin, const typename PFP::VEC3& normal
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, );
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; template <typename PFP>
void normalCycles_SortTensor(Geom::Matrix<3,3,typename PFP::REAL>& tensor);
template <typename PFP>
void normalCycles_ProjectTensor(
Geom::Matrix<3,3,typename PFP::REAL>& tensor,
const typename PFP::VEC3& normal_vector
);
/* normal cycles with collector as a parameter : not usable in parallel */
//template <typename PFP>
//void computeCurvatureVertices_NormalCycles(
// typename PFP::MAP& map,
// Algo::Surface::Selection::Collector<PFP> & neigh,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
//template <typename PFP>
//void computeCurvatureVertex_NormalCycles(
// Vertex v,
// Algo::Surface::Selection::Collector<PFP> & neigh,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
//template <typename PFP>
//void computeCurvatureVertices_NormalCycles_Projected(
// typename PFP::MAP& map,
// Algo::Surface::Selection::Collector<PFP> & neigh,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
//template <typename PFP>
//void computeCurvatureVertex_NormalCycles_Projected(
// Vertex v,
// Algo::Surface::Selection::Collector<PFP> & neigh,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgeangle,
// const EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edgearea,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
namespace Parallel namespace Parallel
{ {
//template <typename PFP>
//void computeCurvatureVertices_QuadraticFitting(
// typename PFP::MAP& map,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
// const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
// VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
// VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin);
template <typename PFP> template <typename PFP>
void computeCurvatureVertices_NormalCycles( void computeCurvatureVertices_NormalCycles(
typename PFP::MAP& map, typename PFP::MAP& map,
...@@ -274,16 +320,6 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -274,16 +320,6 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ; VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) ;
template <typename PFP>
void computeCurvatureVertices_QuadraticFitting(
typename PFP::MAP& map,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position,
const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& normal,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmax,
VertexAttribute<typename PFP::REAL, typename PFP::MAP>& kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin);
} // namespace Parallel } // namespace Parallel
......
...@@ -49,22 +49,19 @@ void computeCurvatureVertices_QuadraticFitting( ...@@ -49,22 +49,19 @@ void computeCurvatureVertices_QuadraticFitting(
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmax,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin) VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin)
{ {
// TODO: nl not thread safe
if (CGoGN::Parallel::NumberOfThreads > 1) // if (CGoGN::Parallel::NumberOfThreads > 1)
{ // {
Parallel::computeCurvatureVertices_QuadraticFitting<PFP>(map, position, normal, kmax, kmin, Kmax, Kmin); // Parallel::computeCurvatureVertices_QuadraticFitting<PFP>(map, position, normal, kmax, kmin, Kmax, Kmin);
return; // return;
} // }
foreach_cell<VERTEX>(map, [&] (Vertex v) foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
computeCurvatureVertex_QuadraticFitting<PFP>(map, v, position, normal, kmax, kmin, Kmax, Kmin) ; computeCurvatureVertex_QuadraticFitting<PFP>(map, v, position, normal, kmax, kmin, Kmax, Kmin) ;
} }
, FORCE_CELL_MARKING); , FORCE_CELL_MARKING);
// TraversorV<typename PFP::MAP> t(map) ;
// for(Vertex v = t.begin(); v != t.end(); v = t.next())
// computeCurvatureVertex_QuadraticFitting<PFP>(map, v, position, normal, kmax, kmin, Kmax, Kmin) ;
} }
template <typename PFP> template <typename PFP>
...@@ -352,7 +349,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -352,7 +349,7 @@ void computeCurvatureVertex_NormalCycles(
neigh.collectAll(v) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle, edgearea, tensor); normalCycles_computeTensor(neigh, position, edgeangle, edgearea, 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));
...@@ -376,11 +373,11 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -376,11 +373,11 @@ void computeCurvatureVertices_NormalCycles_Projected(
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin, VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Kmin,
VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal) VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& Knormal)
{ {
// if (CGoGN::Parallel::NumberOfThreads > 1) if (CGoGN::Parallel::NumberOfThreads > 1)
// { {
// Parallel::computeCurvatureVertices_NormalCycles_Projected<PFP>(map, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal); Parallel::computeCurvatureVertices_NormalCycles_Projected<PFP>(map, radius, position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal);
// return; return;
// } }
foreach_cell<VERTEX>(map, [&] (Vertex v) foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
...@@ -415,7 +412,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -415,7 +412,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
neigh.collectAll(v) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle, edgearea, tensor); normalCycles_computeTensor(neigh, position, edgeangle, edgearea, tensor);
// project the tensor // project the tensor
normalCycles_ProjectTensor<PFP>(tensor, normal[v]); normalCycles_ProjectTensor<PFP>(tensor, normal[v]);
...@@ -428,113 +425,196 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -428,113 +425,196 @@ void computeCurvatureVertex_NormalCycles_Projected(
normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v]); normalCycles_SortAndSetEigenComponents<PFP>(ev,evec,kmax[v],kmin[v],Kmax[v],Kmin[v],Knormal[v],normal[v]);
} }
template <typename PFP> //template <typename PFP>