Commit e00046db authored by Basile Sauvage's avatar Basile Sauvage

deuxieme algo voronoi centroidaux

parent 7acfd5c2
......@@ -219,7 +219,6 @@ void CentroidalVoronoiDiagram<PFP>::cumulateEnergyOnPaths(){
template <typename PFP>
unsigned int CentroidalVoronoiDiagram<PFP>::moveSeeds(){
// TODO : je pense qu'il y a un bug : ça devrait convergerger bien mieux en n'utilisant que l'energie globale comme critere d'arret
unsigned int m = 0;
globalEnergy = 0.0;
for (unsigned int i = 0; i < this->seeds.size(); i++)
......@@ -231,6 +230,30 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeeds(){
return m;
}
template <typename PFP>
unsigned int CentroidalVoronoiDiagram<PFP>::moveSeeds2(){
unsigned int m = 0;
globalEnergy = 0.0;
for (unsigned int i = 0; i < this->seeds.size(); i++)
{
Dart oldSeed = this->seeds[i];
int r = moveSeed(i);
Dart newSeed = this->seeds[i];
globalEnergy += distances[oldSeed];
REAL regionEnergy = distances[oldSeed];
if (r==1)
{
this->computeDistancesWithinRegion(newSeed);
cumulateEnergyFromRoot(newSeed);
if (distances[newSeed] < regionEnergy)
m+=1;
else
this->seeds[i] = oldSeed;
}
}
return m;
}
template <typename PFP>
typename PFP::REAL CentroidalVoronoiDiagram<PFP>::cumulateEnergyFromRoot(Dart e){
REAL distArea = areaElts[e] * distances[e];
......
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