Commit 4882257e authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'develop' of icube-forge.unistra.fr:cgogn/cgogn into develop

parents f6eda487 49adae74
...@@ -74,9 +74,15 @@ typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex v, const ...@@ -74,9 +74,15 @@ typename PFP::REAL vertexBarycentricArea(typename PFP::MAP& map, Vertex v, const
template <typename PFP> template <typename PFP>
typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ; typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
template <typename PFP>
typename PFP::REAL edgeArea(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position);
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area) ; void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area) ;
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edge_area);
template <typename PFP> template <typename PFP>
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area) ; void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& vertex_area) ;
...@@ -88,9 +94,16 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty ...@@ -88,9 +94,16 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
namespace Parallel namespace Parallel
{ {
template <typename PFP>
typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) ;
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area); void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area);
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& area);
template <typename PFP> template <typename PFP>
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area); void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area);
...@@ -99,8 +112,10 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut ...@@ -99,8 +112,10 @@ void computeBarycentricAreaVertices(typename PFP::MAP& map, const VertexAttribut
template <typename PFP> template <typename PFP>
void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area); void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area);
} // namespace Parallel } // namespace Parallel
} // namespace Geometry } // namespace Geometry
} // namespace Surface } // namespace Surface
......
...@@ -74,15 +74,19 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Face d, const VertexAt ...@@ -74,15 +74,19 @@ typename PFP::REAL convexFaceArea(typename PFP::MAP& map, Face d, const VertexAt
template <typename PFP> template <typename PFP>
typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{ {
typename PFP::REAL area(0) ; if (CGoGN::Parallel::NumberOfThreads > 1)
{
return Parallel::totalArea<PFP>(map, position);
}
typename PFP::REAL area(0);
foreach_cell<FACE>(map, [&] (Face f) foreach_cell<FACE>(map, [&] (Face f)
{ {
area += convexFaceArea<PFP>(map, f, position); area += convexFaceArea<PFP>(map, f, position);
} }
,AUTO); ,AUTO);
return area ; return area;
} }
template <typename PFP> template <typename PFP>
...@@ -137,12 +141,23 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver ...@@ -137,12 +141,23 @@ typename PFP::REAL vertexVoronoiArea(typename PFP::MAP& map, Vertex v, const Ver
} }
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area) typename PFP::REAL edgeArea(typename PFP::MAP& map, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{ {
typename PFP::REAL area(0) ;
foreach_incident2<FACE>(map, e, [&] (Face f)
{
area += convexFaceArea<PFP>(map, f, position) / map.faceDegree(f) ;
});
return area ;
}
template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& face_area)
{
if (CGoGN::Parallel::NumberOfThreads > 1) if (CGoGN::Parallel::NumberOfThreads > 1)
{ {
Parallel::computeAreaFaces<PFP>(map,position,face_area); Parallel::computeAreaFaces<PFP>(map, position, face_area);
return; return;
} }
...@@ -151,7 +166,22 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP ...@@ -151,7 +166,22 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
face_area[f] = convexFaceArea<PFP>(map, f, position) ; face_area[f] = convexFaceArea<PFP>(map, f, position) ;
} }
,AUTO); ,AUTO);
}
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& edge_area)
{
if (CGoGN::Parallel::NumberOfThreads > 1)
{
Parallel::computeAreaEdges<PFP>(map, position, edge_area);
return;
}
foreach_cell<EDGE>(map, [&] (Edge e)
{
edge_area[e] = edgeArea<PFP>(map, e, position) ;
}
,AUTO);
} }
template <typename PFP> template <typename PFP>
...@@ -215,6 +245,24 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty ...@@ -215,6 +245,24 @@ void computeVoronoiAreaVertices(typename PFP::MAP& map, const VertexAttribute<ty
namespace Parallel namespace Parallel
{ {
template <typename PFP>
typename PFP::REAL totalArea(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{
std::vector<typename PFP::REAL> areas;
areas.resize(CGoGN::Parallel::NumberOfThreads);
CGoGN::Parallel::foreach_cell<FACE>(map, [&] (Face f, unsigned int thr)
{
areas[thr-1] += convexFaceArea<PFP>(map, f, position);
}
,AUTO);
typename PFP::REAL area(0);
for (typename PFP::REAL a : areas)
area += a;
return area;
}
template <typename PFP> template <typename PFP>
void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area) void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, FaceAttribute<typename PFP::REAL, typename PFP::MAP>& area)
{ {
...@@ -239,6 +287,14 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP ...@@ -239,6 +287,14 @@ void computeAreaFaces(typename PFP::MAP& map, const VertexAttribute<typename PFP
}); });
} }
template <typename PFP>
void computeAreaEdges(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, EdgeAttribute<typename PFP::REAL, typename PFP::MAP>& area)
{
CGoGN::Parallel::foreach_cell<EDGE>(map, [&] (Edge e, unsigned int /*thr*/)
{
area[e] = edgeArea<PFP>(map, e, position) ;
});
}
template <typename PFP> template <typename PFP>
void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area) void computeOneRingAreaVertices(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, VertexAttribute<typename PFP::REAL, typename PFP::MAP>& area)
......
...@@ -57,6 +57,58 @@ inline typename PFP::REAL edgeLength(typename PFP::MAP& map, Dart d, const Verte ...@@ -57,6 +57,58 @@ inline typename PFP::REAL edgeLength(typename PFP::MAP& map, Dart d, const Verte
return v.norm() ; return v.norm() ;
} }
namespace Parallel
{
template <typename PFP>
typename PFP::REAL meanEdgeLength(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{
std::vector<typename PFP::REAL> lengths;
std::vector<unsigned int> nbedges;
lengths.resize(CGoGN::Parallel::NumberOfThreads);
nbedges.resize(CGoGN::Parallel::NumberOfThreads);
CGoGN::Parallel::foreach_cell<EDGE>(map, [&] (Edge e, unsigned int thr)
{
lengths[thr-1] += edgeLength<PFP>(map, e, position);
++nbedges[thr-1];
}
,AUTO);
typename PFP::REAL length(0);
unsigned int nbe = 0;
for (unsigned int i = 0; i < CGoGN::Parallel::NumberOfThreads; ++i)
{
length += lengths[i];
nbe += nbedges[i];
}
return length / nbe;
}
} // namespace Parallel
template <typename PFP>
inline typename PFP::REAL meanEdgeLength(typename PFP::MAP& map,const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{
if (CGoGN::Parallel::NumberOfThreads > 1)
{
return Parallel::meanEdgeLength<PFP>(map, position);
}
typename PFP::REAL length(0);
unsigned int nbe = 0;
foreach_cell<EDGE>(map, [&] (Edge e)
{
length += edgeLength<PFP>(map, e, position);
++nbe;
}
,AUTO);
return length / nbe;
}
template <typename PFP> template <typename PFP>
inline float angle(typename PFP::MAP& map, Dart d1, Dart d2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position) inline float angle(typename PFP::MAP& map, Dart d1, Dart d2, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position)
{ {
......
...@@ -113,6 +113,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -113,6 +113,7 @@ void computeCurvatureVertices_NormalCycles(
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,
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,
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,
...@@ -127,6 +128,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -127,6 +128,7 @@ void computeCurvatureVertex_NormalCycles(
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,
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,
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,
...@@ -160,6 +162,7 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -160,6 +162,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
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,
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,
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,
...@@ -174,6 +177,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -174,6 +177,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
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,
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,
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,
...@@ -189,6 +193,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -189,6 +193,7 @@ void computeCurvatureVertices_NormalCycles(
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,
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,
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,
...@@ -202,6 +207,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -202,6 +207,7 @@ void computeCurvatureVertex_NormalCycles(
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,
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,
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,
...@@ -215,6 +221,7 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -215,6 +221,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
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,
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,
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,
...@@ -228,6 +235,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -228,6 +235,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
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,
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,
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,
...@@ -245,6 +253,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -245,6 +253,7 @@ void computeCurvatureVertices_NormalCycles(
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,
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,
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,
...@@ -258,6 +267,7 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -258,6 +267,7 @@ void computeCurvatureVertices_NormalCycles_Projected(
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,
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,
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,
......
...@@ -306,6 +306,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -306,6 +306,7 @@ void computeCurvatureVertices_NormalCycles(
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,
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,
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,
...@@ -314,19 +315,15 @@ void computeCurvatureVertices_NormalCycles( ...@@ -314,19 +315,15 @@ void computeCurvatureVertices_NormalCycles(
{ {
if (CGoGN::Parallel::NumberOfThreads > 1) if (CGoGN::Parallel::NumberOfThreads > 1)
{ {
Parallel::computeCurvatureVertices_NormalCycles<PFP>(map, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal); Parallel::computeCurvatureVertices_NormalCycles<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)
{ {
computeCurvatureVertex_NormalCycles<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; computeCurvatureVertex_NormalCycles<PFP>(map, v, radius, position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
,FORCE_CELL_MARKING); ,FORCE_CELL_MARKING);
// TraversorV<typename PFP::MAP> t(map) ;
// for(Vertex v = t.begin(); v != t.end(); v = t.next())
// computeCurvatureVertex_NormalCycles<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
template <typename PFP> template <typename PFP>
...@@ -337,6 +334,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -337,6 +334,7 @@ void computeCurvatureVertex_NormalCycles(
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,
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,
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,
...@@ -354,7 +352,7 @@ void computeCurvatureVertex_NormalCycles( ...@@ -354,7 +352,7 @@ void computeCurvatureVertex_NormalCycles(
neigh.collectAll(v) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle, tensor); neigh.computeNormalCyclesTensor(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));
...@@ -362,16 +360,6 @@ void computeCurvatureVertex_NormalCycles( ...@@ -362,16 +360,6 @@ void computeCurvatureVertex_NormalCycles(
const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors()); const MATRIX& evec = Utils::convertRef<MATRIX>(solver.eigenvectors());
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]);
// if (dart.index % 15000 == 0)
// {
// CGoGNout << solver.eigenvalues() << CGoGNendl;
// CGoGNout << solver.eigenvectors() << CGoGNendl;
// normalCycles_SortTensor<PFP>(tensor);
// solver.compute(Utils::convertRef<E_MATRIX>(tensor));
// CGoGNout << solver.eigenvalues() << CGoGNendl;
// CGoGNout << solver.eigenvectors() << CGoGNendl;
// }
} }
template <typename PFP> template <typename PFP>
...@@ -381,27 +369,24 @@ void computeCurvatureVertices_NormalCycles_Projected( ...@@ -381,27 +369,24 @@ void computeCurvatureVertices_NormalCycles_Projected(
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,
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,
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,
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, kmax, kmin, Kmax, Kmin, Knormal);
return; // return;
} // }
foreach_cell<VERTEX>(map, [&] (Vertex v) foreach_cell<VERTEX>(map, [&] (Vertex v)
{ {
computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ; computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, radius, position, normal, edgeangle, edgearea, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
,FORCE_CELL_MARKING); ,FORCE_CELL_MARKING);
// TraversorV<typename PFP::MAP> t(map) ;
// for(Vertex v = t.begin(); v.dart != t.end(); v = t.next())
// computeCurvatureVertex_NormalCycles_Projected<PFP>(map, v, radius, position, normal, edgeangle, kmax, kmin, Kmax, Kmin, Knormal) ;
} }
template <typename PFP> template <typename PFP>
...@@ -412,6 +397,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -412,6 +397,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
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,
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,
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,
...@@ -429,7 +415,7 @@ void computeCurvatureVertex_NormalCycles_Projected( ...@@ -429,7 +415,7 @@ void computeCurvatureVertex_NormalCycles_Projected(
neigh.collectAll(v) ; neigh.collectAll(v) ;
MATRIX tensor(0) ; MATRIX tensor(0) ;
neigh.computeNormalCyclesTensor(position, edgeangle, tensor); neigh.computeNormalCyclesTensor(position, edgeangle, edgearea, tensor);
// project the tensor // project the tensor
normalCycles_ProjectTensor<PFP>(tensor, normal[v]); normalCycles_ProjectTensor<PFP>(tensor, normal[v]);
...@@ -449,6 +435,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -449,6 +435,7 @@ void computeCurvatureVertices_NormalCycles(
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,
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,
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,
...@@ -457,7 +444,7 @@ void computeCurvatureVertices_NormalCycles( ...@@ -457,7 +444,7 @@ void computeCurvatureVertices_NormalCycles(
{ {
TraversorV<typename PFP::MAP> t(map) ; TraversorV<typename PFP::MAP> t(map) ;
for(Vertex v = t.begin(); v != t.end(); v = t.next()) for(Vertex v = t.begin(); v != t.end(); v = t.next())