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,
......
This diff is collapsed.
...@@ -83,7 +83,7 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const ...@@ -83,7 +83,7 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const
* et v1 et v2 les deux sommets de l'arête * et v1 et v2 les deux sommets de l'arête
*/ */
template <typename PFP> template <typename PFP>
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, typename PFP::REAL& alpha) ; bool intersectionSphereEdge(typename PFP::MAP& map, const typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, typename PFP::REAL& alpha) ;
} // namespace Geometry } // namespace Geometry
......
...@@ -238,7 +238,7 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const ...@@ -238,7 +238,7 @@ bool areTrianglesInIntersection(typename PFP::MAP& map, Face t1, Face t2, const
} }
template <typename PFP> template <typename PFP>
bool intersectionSphereEdge(typename PFP::MAP& map, typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, typename PFP::REAL& alpha) bool intersectionSphereEdge(typename PFP::MAP& map, const typename PFP::VEC3& center, typename PFP::REAL radius, Edge e, const VertexAttribute<typename PFP::VEC3, typename PFP::MAP>& position, typename PFP::REAL& alpha)
{ {
typedef typename PFP::VEC3 VEC3 ; typedef typename PFP::VEC3 VEC3 ;
typedef typename PFP::REAL REAL ; typedef typename PFP::REAL REAL ;
......
...@@ -122,16 +122,12 @@ public: ...@@ -122,16 +122,12 @@ public:
template <typename PPFP> template <typename PPFP>
friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c); friend std::ostream& operator<<(std::ostream &out, const Collector<PPFP>& c);
virtual REAL computeArea (const VertexAttribute<VEC3, MAP>& /*pos*/) virtual REAL computeArea (const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgearea*/)
{ {
assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes"); assert(!"Warning: Collector<PFP>::computeArea() should be overloaded in non-virtual derived classes");
return 0.0; return 0.0;
} }
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgeangle*/, typename PFP::MATRIX33&) virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& /*pos*/, const EdgeAttribute<REAL, MAP>& /*edgeangle*/, const EdgeAttribute<REAL, MAP>& /*edgearea*/, typename PFP::MATRIX33&)
{
assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes");
}
virtual void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& /*pos*/, typename PFP::MATRIX33&)
{ {
assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes"); assert(!"Warning: Collector<PFP>::computeNormalCyclesTensor() should be overloaded in non-virtual derived classes");
} }
...@@ -162,9 +158,8 @@ public: ...@@ -162,9 +158,8 @@ public:
void collectAll(Dart d); void collectAll(Dart d);
void collectBorder(Dart d); void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos); REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, typename PFP::MATRIX33&); void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, typename PFP::MATRIX33&);
}; };
/********************************************************* /*********************************************************
...@@ -194,10 +189,8 @@ public: ...@@ -194,10 +189,8 @@ public:
void collectAll(Dart d); void collectAll(Dart d);
void collectBorder(Dart d); void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos); REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, typename PFP::MATRIX33&); void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, typename PFP::MATRIX33&);
}; };
/********************************************************* /*********************************************************
...@@ -234,9 +227,8 @@ public: ...@@ -234,9 +227,8 @@ public:
void collectAll(Dart d); void collectAll(Dart d);
void collectBorder(Dart d); void collectBorder(Dart d);
REAL computeArea(const VertexAttribute<VEC3, MAP>& pos); REAL computeArea(const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgearea);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, typename PFP::MATRIX33&); void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, const EdgeAttribute<REAL, MAP>& edgeangle, const EdgeAttribute<REAL, MAP>& edgearea, typename PFP::MATRIX33&);
void computeNormalCyclesTensor (const VertexAttribute<VEC3, MAP>& pos, typename PFP::MATRIX33&);
}; };
/********************************************************* /*********************************************************
......
This diff is collapsed.
...@@ -44,10 +44,12 @@ template <typename PFP> ...@@ -44,10 +44,12 @@ template <typename PFP>
void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close) void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
{ {
// nb vertices // nb vertices
int nb = x*y +1; unsigned int nbV = x*y +1;
unsigned int nbF = x*y;
// vertice reservation // vertice reservation
this->m_tableVertDarts.reserve(nb); this->m_tableVertDarts.reserve(nbV);
this->m_tableFaceDarts.reserve(nbF);
// creation of triangles and storing vertices // creation of triangles and storing vertices
for (unsigned int i = 0; i < y; ++i) for (unsigned int i = 0; i < y; ++i)
...@@ -61,6 +63,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close) ...@@ -61,6 +63,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
this->m_tableVertDarts.push_back(this->m_map.phi_1(d)); this->m_tableVertDarts.push_back(this->m_map.phi_1(d));
if (j == x) if (j == x)
this->m_tableVertDarts.push_back(this->m_map.phi1(this->m_map.phi1(d))); this->m_tableVertDarts.push_back(this->m_map.phi1(this->m_map.phi1(d)));
this->m_tableFaceDarts.push_back(d);
} }
} }
......
...@@ -46,10 +46,12 @@ template <typename PFP> ...@@ -46,10 +46,12 @@ template <typename PFP>
void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close) void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
{ {
// nb vertices // nb vertices
int nb = (x+1)*(y+1); unsigned int nbV = (x+1)*(y+1);
unsigned int nbF = x*y;
// vertice reservation // vertice reservation
this->m_tableVertDarts.reserve(nb); this->m_tableVertDarts.reserve(nbV);
this->m_tableFaceDarts.reserve(nbF);
// creation of quads and storing vertices // creation of quads and storing vertices
for (unsigned int i = 0; i < y; ++i) for (unsigned int i = 0; i < y; ++i)
...@@ -60,6 +62,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close) ...@@ -60,6 +62,7 @@ void Grid<PFP>::grid(unsigned int x, unsigned int y, bool close)
this->m_tableVertDarts.push_back(d); this->m_tableVertDarts.push_back(d);
if (j == x) if (j == x)
this->m_tableVertDarts.push_back(this->m_map.phi1(d)); this->m_tableVertDarts.push_back(this->m_map.phi1(d));
this->m_tableFaceDarts.push_back(d);
} }
} }
...@@ -174,10 +177,12 @@ void Grid<PFP>::embedIntoHelicoid(VertexAttribute<VEC3, MAP>& position, float ra ...@@ -174,10 +177,12 @@ void Grid<PFP>::embedIntoHelicoid(VertexAttribute<VEC3, MAP>& position, float ra
template <typename PFP> template <typename PFP>
void Cylinder<PFP>::cylinder(unsigned int n, unsigned int z) void Cylinder<PFP>::cylinder(unsigned int n, unsigned int z)
{ {
int nb = (n)*(z+1)+2; unsigned int nbV = (n)*(z+1)+2;
unsigned int nbF = n*z;