Commit 52d99577 authored by Sylvain Thery's avatar Sylvain Thery

Merge branch 'master' of cgogn:~sauvage/CGoGN

parents 8750e5fd 887a19c7
...@@ -140,7 +140,7 @@ void VoronoiDiagram<PFP>::computeDiagram () ...@@ -140,7 +140,7 @@ void VoronoiDiagram<PFP>::computeDiagram ()
template <typename PFP> template <typename PFP>
void VoronoiDiagram<PFP>::computeDistancesWithinRegion (Dart seed) void VoronoiDiagram<PFP>::computeDistancesWithinRegion (Dart seed)
{ // TODO : this algo has not yet been tested {
// init // init
front.clear(); front.clear();
vmReached.unmarkAll(); vmReached.unmarkAll();
...@@ -257,31 +257,6 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeNoCheck(){ ...@@ -257,31 +257,6 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeNoCheck(){
return m; return m;
} }
template <typename PFP>
unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeCheck(){
// TODO : probable bug (memoire ?) car les iterations ralentissent inexplicablement
unsigned int m = 0;
for (unsigned int i = 0; i < this->seeds.size(); i++)
{
Dart oldSeed = this->seeds[i];
Dart newSeed = selectBestNeighborFromSeed(i);
// move the seed
if (newSeed != oldSeed)
{
REAL regionEnergy = distances[oldSeed];
this->computeDistancesWithinRegion(newSeed);
cumulateEnergyFromRoot(newSeed);
if (distances[newSeed] < regionEnergy)
{
this->seeds[i] = newSeed;
m++;
}
}
}
return m;
}
/*
template <typename PFP> template <typename PFP>
unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeCheck(){ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeCheck(){
// TODO : probable bug (memoire ?) car les iterations ralentissent inexplicablement // TODO : probable bug (memoire ?) car les iterations ralentissent inexplicablement
...@@ -301,34 +276,42 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeCheck(){ ...@@ -301,34 +276,42 @@ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsOneEdgeCheck(){
if (distances[newSeed] < regionEnergy) if (distances[newSeed] < regionEnergy)
m++; m++;
else else
this->seeds[i] = newSeed; this->seeds[i] = oldSeed;
} }
} }
return m; return m;
} }
*/
template <typename PFP> template <typename PFP>
unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsToMedioid(){ unsigned int CentroidalVoronoiDiagram<PFP>::moveSeedsToMedioid(){
unsigned int m = 0; unsigned int m = 0;
/* for (unsigned int i = 0; i < this->seeds.size(); i++) for (unsigned int i = 0; i < this->seeds.size(); i++)
{ {
Dart oldSeed = this->seeds[i]; Dart oldSeed, newSeed;
Dart newSeed = selectBestNeighborFromSeed(i);
unsigned int seedMoved = 0; unsigned int seedMoved = 0;
REAL regionEnergy = distances[oldSeed]; REAL regionEnergy;
// move the seed do
while (newSeed != oldSeed)
{ {
this->cumulateEnergyAndGradientFromSeed(numSeed); oldSeed = this->seeds[i];
cumulateEnergyFromRoot(newSeed); regionEnergy = distances[oldSeed];
newSeed = selectBestNeighborFromSeed(i);
this->seeds[i] = newSeed;
this->computeDistancesWithinRegion(newSeed);
cumulateEnergyAndGradientFromSeed(i);
if (distances[newSeed] < regionEnergy) if (distances[newSeed] < regionEnergy)
seedMoved = 1;
else
{ {
this->seeds[i] = newSeed; this->seeds[i] = oldSeed;
m++; newSeed = oldSeed;
} }
}
} */ } while (newSeed != oldSeed);
m += seedMoved;
}
return m; return m;
} }
......
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