Commit cb8f4fc5 authored by Basile Sauvage's avatar Basile Sauvage

diag de Voronoi centroidaux : ajout de l'accumulation des distances

parent c9120b7a
......@@ -73,9 +73,12 @@ public :
CentroidalVoronoiDiagram (typename PFP::MAP& m, const EdgeAttribute<REAL>& c, VertexAttribute<unsigned int>& r, VertexAttribute<REAL>& d, VertexAttribute<Dart>& o);
~CentroidalVoronoiDiagram ();
void cumulateDistancesOnPaths();
protected :
void clear();
void collectVertexFromFront(Dart e);
void cumulateDistancesFromSeed(Dart e);
};
......
......@@ -168,6 +168,26 @@ void CentroidalVoronoiDiagram<PFP>::collectVertexFromFront(Dart e){
VoronoiDiagram<PFP>::collectVertexFromFront(e);
}
template <typename PFP>
void CentroidalVoronoiDiagram<PFP>::cumulateDistancesOnPaths(){
for (unsigned int i = 0; i < this->seeds.size(); i++)
{
cumulateDistancesFromSeed(this->seeds[i]);
}
}
template <typename PFP>
void CentroidalVoronoiDiagram<PFP>::cumulateDistancesFromSeed(Dart e){
Traversor2VVaE<typename PFP::MAP> tv (this->map, e);
for (Dart f = tv.begin(); f != tv.end(); f=tv.next())
{
if ( pathOrigins[f] == this->map.phi2(f))
{
cumulateDistancesFromSeed(f);
distances[e] += distances[f];
}
}
}
}// end namespace Geometry
}// end namespace Algo
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment