Commit f0adcdd9 authored by Thomas's avatar Thomas
Browse files

correction add path

parent 8d93b635
...@@ -555,6 +555,7 @@ void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, Cell ...@@ -555,6 +555,7 @@ void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, Cell
obstacleMark.mark(dIn); obstacleMark.mark(dIn);
buildingMark.mark(dIn); buildingMark.mark(dIn);
buildingMark.mark(dExt); buildingMark.mark(dExt);
buildingMark.mark(dIn);
railVert.mark(map.phi_1(dIn)); railVert.mark(map.phi_1(dIn));
railVert.mark(map.phi1(dExt)); railVert.mark(map.phi1(dExt));
// obstacleMark.mark(map.phi_1(dIn)); // obstacleMark.mark(map.phi_1(dIn));
......
...@@ -43,9 +43,9 @@ void EnvMap::init() ...@@ -43,9 +43,9 @@ void EnvMap::init()
{ {
float sideSize = 70.0f; float sideSize = 70.0f;
unsigned int nbSquares = 40; unsigned int nbSquares = 40;
CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares); // CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize); CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark); // CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
map.init(); map.init();
registerObstaclesInFaces(); registerObstaclesInFaces();
for(unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i)) for(unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i))
......
...@@ -5,8 +5,8 @@ Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.1f) ...@@ -5,8 +5,8 @@ Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.1f)
srand(10); srand(10);
envMap_.init(); envMap_.init();
std::cout << "setup scenario" << std::endl; std::cout << "setup scenario" << std::endl;
importAgents("myAgents.pos"); // importAgents("myAgents.pos");
// setupScenario(15000); setupScenario(15000);
addPathsToAgents(); addPathsToAgents();
for(unsigned int i = 0; i < agents_.size(); ++i) for(unsigned int i = 0; i < agents_.size(); ++i)
{ {
...@@ -124,7 +124,9 @@ void Simulator::setupScenario(unsigned int nbMaxAgent) ...@@ -124,7 +124,9 @@ void Simulator::setupScenario(unsigned int nbMaxAgent)
void Simulator::addPathsToAgents() void Simulator::addPathsToAgents()
{ {
unsigned int dartDistForPath=50; //city
// unsigned int dartDistForPath=50;
unsigned int dartDistForPath=4;
for(unsigned int i = 0; i < agents_.size(); ++i) for(unsigned int i = 0; i < agents_.size(); ++i)
{ {
agents_[i]->goals_.clear(); agents_[i]->goals_.clear();
...@@ -133,9 +135,9 @@ void Simulator::addPathsToAgents() ...@@ -133,9 +135,9 @@ void Simulator::addPathsToAgents()
Dart dStop = dStart; Dart dStop = dStart;
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop) || j < dartDistForPath+rand()*20; ++j) for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop) || j < dartDistForPath+rand()*20; ++j)
{ {
envMap_.map.next(dStop);
if(dStop == envMap_.map.end()) if(dStop == envMap_.map.end())
dStop = envMap_.map.begin(); dStop = envMap_.map.begin();
envMap_.map.next(dStop);
} }
std::vector<Dart> path = CGoGN::PathFinder::pathFindAStar<PFP>(envMap_.map, envMap_.position, dStart, dStop, envMap_.buildingMark); std::vector<Dart> path = CGoGN::PathFinder::pathFindAStar<PFP>(envMap_.map, envMap_.position, dStart, dStop, envMap_.buildingMark);
...@@ -146,9 +148,9 @@ void Simulator::addPathsToAgents() ...@@ -146,9 +148,9 @@ void Simulator::addPathsToAgents()
Dart dStop2 = dStop; Dart dStop2 = dStop;
for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop2) || j < dartDistForPath+rand()*20; ++j) for(unsigned int j = 0; envMap_.buildingMark.isMarked(dStop2) || j < dartDistForPath+rand()*20; ++j)
{ {
envMap_.map.next(dStop2);
if(dStop2 == envMap_.map.end()) if(dStop2 == envMap_.map.end())
dStop2 = envMap_.map.begin(); dStop2 = envMap_.map.begin();
envMap_.map.next(dStop2);
} }
path = CGoGN::PathFinder::pathFindAStar<PFP>(envMap_.map, envMap_.position, dStop, dStop2, envMap_.buildingMark); path = CGoGN::PathFinder::pathFindAStar<PFP>(envMap_.map, envMap_.position, dStop, dStop2, envMap_.buildingMark);
......
...@@ -247,7 +247,7 @@ void SocialAgents::animate() ...@@ -247,7 +247,7 @@ void SocialAgents::animate()
std::ostringstream tmpNb; std::ostringstream tmpNb;
tmpNb << std::setfill('0') << std::setw(4) << nbGenerated; tmpNb << std::setfill('0') << std::setw(4) << nbGenerated;
nbGenerated++; nbGenerated++;
oss << "./planSerre/exportSceneOle" << tmpNb.str() << ".pov"; oss << "./planMall/mallScene" << tmpNb.str() << ".pov";
std::string chaine = oss.str(); std::string chaine = oss.str();
// VEC3 agPos = sim.agents_[0]->meanPos_; // VEC3 agPos = sim.agents_[0]->meanPos_;
// agPos[2] = agPos[1]; // agPos[2] = agPos[1];
......
Supports Markdown
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