Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 37ee91e4 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

swapGoals and stuff..

parent b3b10bd1
......@@ -63,4 +63,3 @@ public:
};
#endif
......@@ -43,4 +43,3 @@ public:
};
#endif
......@@ -43,7 +43,7 @@ void EnvMap::init()
float sideSize = 70.0f;
unsigned int nbSquares = 25;
CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
map.init();
registerObstaclesInFaces();
}
......
......@@ -5,8 +5,8 @@ Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.25f)
srand(10);
envMap_.init();
std::cout << "setup scenario" << std::endl;
// importAgents("myAgents.pos");
setupScenario();
importAgents("myAgents.pos");
// setupScenario();
for(unsigned int i = 0; i < agents_.size(); ++i)
{
agents_[i]->updateObstacleNeighbors();
......@@ -104,7 +104,7 @@ void Simulator::setupScenario()
agents_.push_back(new Agent(this, posagent, dCell));
agents_.back()->goals_.push_back(posagent);
agents_.back()->goals_.push_back(-1.0f * posagent);
agents_.back()->curGoal_ = 0;
agents_.back()->curGoal_ = 1;
}
}
}
......@@ -186,13 +186,14 @@ bool Simulator::importAgents(std::string filename)
Dart dCell = envMap_.getBelongingCell(pos);
agents_.push_back(new Agent(this, pos, dCell));
agents_.back()->goals_.push_back(pos);
agents_.back()->goals_.push_back(-1.0f * pos);
agents_.back()->curGoal_ = 0;
agents_.back()->curGoal_ = 1;
}
}
swapAgentsGoals();
for (unsigned int i = 0; i < agents_.size(); ++i)
envMap_.pushAgentInCells(agents_[i], agents_[i]->part_.d);
......@@ -218,6 +219,14 @@ bool Simulator::exportAgents(std::string filename)
void Simulator::swapAgentsGoals()
{
std::cout << "Write swapAgentsGoals function !!" << std::endl;
unsigned int nbAgents = agents_.size();
for(unsigned int i = 0; i < nbAgents; ++i)
{
unsigned int r = rand() % nbAgents;
VEC3 g = agents_[i]->goals_[1];
agents_[i]->goals_[1] = agents_[r]->goals_[1];
agents_[r]->goals_[1] = g;
}
}
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