Commit b57cf78f authored by CGoGN GIT Supervisor's avatar CGoGN GIT Supervisor

Merge branch 'master' of /home/sauvage/CGoGN

* 'master' of /home/sauvage/CGoGN:
  voronoi centroidau
  voronoi centroidaux
parents 8750e5fd d5b0e86f
...@@ -38,7 +38,7 @@ protected : ...@@ -38,7 +38,7 @@ protected :
VertexAttribute<VertexInfo> vertexInfo; VertexAttribute<VertexInfo> vertexInfo;
std::multimap<float,Dart> front ; std::multimap<float,Dart> front ;
CellMarkerStore<VERTEX> vmReached; CellMarker<VERTEX> vmReached;
public : public :
VoronoiDiagram (typename PFP::MAP& m, const EdgeAttribute<REAL>& c, VertexAttribute<unsigned int>& r); VoronoiDiagram (typename PFP::MAP& m, const EdgeAttribute<REAL>& c, VertexAttribute<unsigned int>& r);
......
...@@ -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