Commit 1666a619 authored by Sylvain Thery's avatar Sylvain Thery

REAL/float

parent 70c5a48f
...@@ -481,7 +481,7 @@ protected: ...@@ -481,7 +481,7 @@ protected:
typedef struct typedef struct
{ {
typename std::multimap<float,Dart>::iterator it ; typename std::multimap<REAL, Dart>::iterator it;
bool valid ; bool valid ;
static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; } static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
} DijkstraVertexInfo ; } DijkstraVertexInfo ;
...@@ -489,7 +489,7 @@ protected: ...@@ -489,7 +489,7 @@ protected:
VertexAttribute<VertexInfo, MAP> vertexInfo ; VertexAttribute<VertexInfo, MAP> vertexInfo ;
std::multimap<float, Dart> front ; std::multimap<REAL, Dart> front;
public: public:
Collector_Dijkstra_Vertices(MAP& m, const EdgeAttribute<REAL, MAP>& c, REAL d = 0) : Collector_Dijkstra_Vertices(MAP& m, const EdgeAttribute<REAL, MAP>& c, REAL d = 0) :
...@@ -532,7 +532,7 @@ protected: ...@@ -532,7 +532,7 @@ protected:
typedef struct typedef struct
{ {
typename std::multimap<float, Dart>::iterator it ; typename std::multimap<REAL, Dart>::iterator it;
bool valid ; bool valid ;
static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; } static std::string CGoGNnameOfType() { return "DijkstraVertexInfo" ; }
} DijkstraVertexInfo ; } DijkstraVertexInfo ;
...@@ -540,7 +540,7 @@ protected: ...@@ -540,7 +540,7 @@ protected:
VertexAttribute<VertexInfo, MAP> vertexInfo ; VertexAttribute<VertexInfo, MAP> vertexInfo ;
std::multimap<float, Dart> front ; std::multimap<REAL, Dart> front;
public: public:
Collector_Dijkstra(MAP& m, const VertexAttribute<VEC3, MAP>& p, REAL d = 0) : Collector_Dijkstra(MAP& m, const VertexAttribute<VEC3, MAP>& p, REAL d = 0) :
...@@ -563,7 +563,7 @@ public: ...@@ -563,7 +563,7 @@ public:
void collectBorder(Dart d); void collectBorder(Dart d);
private : private :
inline float edgeLength (Dart d); inline REAL edgeLength(Dart d);
// inline Dart oppositeVertex (Dart d); // inline Dart oppositeVertex (Dart d);
}; };
......
...@@ -948,14 +948,14 @@ void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit) ...@@ -948,14 +948,14 @@ void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit)
this->isInsideCollected = true; this->isInsideCollected = true;
CellMarkerStore<MAP, VERTEX> vmReached (this->map); CellMarkerStore<MAP, VERTEX> vmReached (this->map);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<REAL,Dart>(0.0f, this->centerDart));
vertexInfo[this->centerDart].valid = true; vertexInfo[this->centerDart].valid = true;
vmReached.mark(this->centerDart); vmReached.mark(this->centerDart);
while ( !front.empty() && front.begin()->first < this->maxDist) while ( !front.empty() && front.begin()->first < this->maxDist)
{ {
Dart e = front.begin()->second; Dart e = front.begin()->second;
float d = front.begin()->first; REAL d = front.begin()->first;
front.erase(vertexInfo[e].it); front.erase(vertexInfo[e].it);
vertexInfo[e].valid=false; vertexInfo[e].valid=false;
this->insideVertices.push_back(e); this->insideVertices.push_back(e);
...@@ -968,17 +968,17 @@ void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit) ...@@ -968,17 +968,17 @@ void Collector_Dijkstra_Vertices<PFP>::collectAll(Dart dinit)
{ {
if (vi.valid) // probably useless (because of distance test) but faster if (vi.valid) // probably useless (because of distance test) but faster
{ {
float dist = d + edge_cost[f]; REAL dist = d + edge_cost[f];
if (dist < vi.it->first) if (dist < vi.it->first)
{ {
front.erase(vi.it); front.erase(vi.it);
vi.it = front.insert(std::pair<float,Dart>(dist, f)); vi.it = front.insert(std::pair<REAL,Dart>(dist, f));
} }
} }
} }
else else
{ {
vi.it = front.insert(std::pair<float,Dart>(d + edge_cost[f], f)); vi.it = front.insert(std::pair<REAL,Dart>(d + edge_cost[f], f));
vi.valid=true; vi.valid=true;
vmReached.mark(f); vmReached.mark(f);
} }
...@@ -1033,14 +1033,14 @@ void Collector_Dijkstra_Vertices<PFP>::collectBorder(Dart dinit) ...@@ -1033,14 +1033,14 @@ void Collector_Dijkstra_Vertices<PFP>::collectBorder(Dart dinit)
init(dinit); init(dinit);
CellMarkerStore<MAP, VERTEX> vmReached (this->map); CellMarkerStore<MAP, VERTEX> vmReached (this->map);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<REAL,Dart>(0.0f, this->centerDart));
vertexInfo[this->centerDart].valid = true; vertexInfo[this->centerDart].valid = true;
vmReached.mark(this->centerDart); vmReached.mark(this->centerDart);
while ( !front.empty() && front.begin()->first < this->maxDist) while ( !front.empty() && front.begin()->first < this->maxDist)
{ {
Dart e = front.begin()->second; Dart e = front.begin()->second;
float d = front.begin()->first; REAL d = front.begin()->first;
front.erase(vertexInfo[e].it); front.erase(vertexInfo[e].it);
vertexInfo[e].valid=false; vertexInfo[e].valid=false;
this->insideVertices.push_back(e); this->insideVertices.push_back(e);
...@@ -1053,17 +1053,17 @@ void Collector_Dijkstra_Vertices<PFP>::collectBorder(Dart dinit) ...@@ -1053,17 +1053,17 @@ void Collector_Dijkstra_Vertices<PFP>::collectBorder(Dart dinit)
{ {
if (vi.valid) // probably useless (because of distance test) but faster if (vi.valid) // probably useless (because of distance test) but faster
{ {
float dist = d + edge_cost[f]; REAL dist = d + edge_cost[f];
if (dist < vi.it->first) if (dist < vi.it->first)
{ {
front.erase(vi.it); front.erase(vi.it);
vi.it = front.insert(std::pair<float,Dart>(dist, f)); vi.it = front.insert(std::pair<REAL,Dart>(dist, f));
} }
} }
} }
else else
{ {
vi.it = front.insert(std::pair<float,Dart>(d + edge_cost[f], f)); vi.it = front.insert(std::pair<REAL,Dart>(d + edge_cost[f], f));
vi.valid = true; vi.valid = true;
vmReached.mark(f); vmReached.mark(f);
} }
...@@ -1107,14 +1107,14 @@ void Collector_Dijkstra<PFP>::collectAll(Dart dinit) ...@@ -1107,14 +1107,14 @@ void Collector_Dijkstra<PFP>::collectAll(Dart dinit)
this->isInsideCollected = true; this->isInsideCollected = true;
CellMarkerStore<MAP, VERTEX> vmReached (this->map); CellMarkerStore<MAP, VERTEX> vmReached (this->map);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<REAL,Dart>(0.0f, this->centerDart));
vertexInfo[this->centerDart].valid = true; vertexInfo[this->centerDart].valid = true;
vmReached.mark(this->centerDart); vmReached.mark(this->centerDart);
while ( !front.empty() && front.begin()->first < this->maxDist) while ( !front.empty() && front.begin()->first < this->maxDist)
{ {
Dart e = front.begin()->second; Dart e = front.begin()->second;
float d = front.begin()->first; REAL d = front.begin()->first;
front.erase(vertexInfo[e].it); front.erase(vertexInfo[e].it);
vertexInfo[e].valid=false; vertexInfo[e].valid=false;
this->insideVertices.push_back(e); this->insideVertices.push_back(e);
...@@ -1127,17 +1127,17 @@ void Collector_Dijkstra<PFP>::collectAll(Dart dinit) ...@@ -1127,17 +1127,17 @@ void Collector_Dijkstra<PFP>::collectAll(Dart dinit)
{ {
if (vi.valid) // probably useless (because of distance test) but faster if (vi.valid) // probably useless (because of distance test) but faster
{ {
float dist = d + edgeLength(f); REAL dist = d + edgeLength(f);
if (dist < vi.it->first) if (dist < vi.it->first)
{ {
front.erase(vi.it); front.erase(vi.it);
vi.it = front.insert(std::pair<float,Dart>(dist, f)); vi.it = front.insert(std::pair<REAL,Dart>(dist, f));
} }
} }
} }
else else
{ {
vi.it = front.insert(std::pair<float,Dart>(d + edgeLength(f), f)); vi.it = front.insert(std::pair<REAL,Dart>(d + edgeLength(f), f));
vi.valid = true; vi.valid = true;
vmReached.mark(f); vmReached.mark(f);
} }
...@@ -1190,14 +1190,14 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit) ...@@ -1190,14 +1190,14 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit)
init(dinit); init(dinit);
CellMarkerStore<MAP, VERTEX> vmReached (this->map); CellMarkerStore<MAP, VERTEX> vmReached (this->map);
vertexInfo[this->centerDart].it = front.insert(std::pair<float,Dart>(0.0, this->centerDart)); vertexInfo[this->centerDart].it = front.insert(std::pair<REAL,Dart>(0.0f, this->centerDart));
vertexInfo[this->centerDart].valid = true; vertexInfo[this->centerDart].valid = true;
vmReached.mark(this->centerDart); vmReached.mark(this->centerDart);
while ( !front.empty() && front.begin()->first < this->maxDist) while ( !front.empty() && front.begin()->first < this->maxDist)
{ {
Dart e = front.begin()->second; Dart e = front.begin()->second;
float d = front.begin()->first; REAL d = front.begin()->first;
front.erase(vertexInfo[e].it); front.erase(vertexInfo[e].it);
vertexInfo[e].valid=false; vertexInfo[e].valid=false;
this->insideVertices.push_back(e); this->insideVertices.push_back(e);
...@@ -1210,17 +1210,17 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit) ...@@ -1210,17 +1210,17 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit)
{ {
if (vi.valid) // probably useless (because of distance test) but faster if (vi.valid) // probably useless (because of distance test) but faster
{ {
float dist = d + edgeLength(f); REAL dist = d + edgeLength(f);
if (dist < vi.it->first) if (dist < vi.it->first)
{ {
front.erase(vi.it); front.erase(vi.it);
vi.it = front.insert(std::pair<float,Dart>(dist, f)); vi.it = front.insert(std::pair<REAL,Dart>(dist, f));
} }
} }
} }
else else
{ {
vi.it = front.insert(std::pair<float,Dart>(d + edgeLength(f), f)); vi.it = front.insert(std::pair<REAL,Dart>(d + edgeLength(f), f));
vi.valid = true; vi.valid = true;
vmReached.mark(f); vmReached.mark(f);
} }
...@@ -1255,7 +1255,7 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit) ...@@ -1255,7 +1255,7 @@ void Collector_Dijkstra<PFP>::collectBorder(Dart dinit)
} }
template <typename PFP> template <typename PFP>
inline float Collector_Dijkstra<PFP>::edgeLength (Dart d) inline typename PFP::REAL Collector_Dijkstra<PFP>::edgeLength(Dart d)
{ {
typename PFP::VEC3 v = Algo::Geometry::vectorOutOfDart<PFP>(this->map, d, this->position); typename PFP::VEC3 v = Algo::Geometry::vectorOutOfDart<PFP>(this->map, d, this->position);
return v.norm(); return v.norm();
......
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