Commit faef5f07 authored by Pierre Kraemer's avatar Pierre Kraemer

la simplif fonctionne..

parent 6a8e9fff
......@@ -51,7 +51,7 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init()
{
float sideSize = 70.0f;
unsigned int nbSquares = 5;
unsigned int nbSquares = 15;
CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
......@@ -222,15 +222,10 @@ void EnvMap::agentChangeFace(Agent* agent, Dart oldFace)
{
Dart newFace = agent->part_.d;
if(!map.isDartValid(oldFace))
std::cout << "agentChangeFace : oldFace INVALID" << std::endl ;
if(!map.isDartValid(newFace))
std::cout << "agentChangeFace : newFace INVALID" << std::endl ;
popAgentInCells(agent, oldFace);
pushAgentInCells(agent, newFace);
if(!coarsenMark.isMarked(oldFace) && agentvect[oldFace].size() < nbAgentsToSimplify)
if(!coarsenMark.isMarked(oldFace) && agentvect[oldFace].size() < nbAgentsToSimplify / 2)
{
coarsenMark.mark(oldFace);
coarsenCandidate.push_back(oldFace);
......@@ -418,14 +413,16 @@ void EnvMap::updateMap()
{
map.setCurrentLevel(fLevel) ;
coarsenMark.unmark(fit) ;
for(std::vector<Dart>::iterator r = it + 1; r != coarsenCandidate.end(); ++r)
std::vector<Dart>::iterator start = it + 1 ;
if(start != coarsenCandidate.end())
{
if(*r == fit)
unsigned int fEmb = map.getEmbedding(FACE_ORBIT, fit) ;
while(start != coarsenCandidate.end())
{
std::vector<Dart>::iterator last = coarsenCandidate.end() ;
--last ;
std::swap(last, r) ;
coarsenCandidate.pop_back() ;
if(map.getEmbedding(FACE_ORBIT, *start) == fEmb)
start = coarsenCandidate.erase(start) ;
else
++start ;
}
}
PFP::AGENTS a(agentvect[fit]) ;
......@@ -453,14 +450,16 @@ void EnvMap::updateMap()
map.setCurrentLevel(fLevel) ;
Dart centerFace = map.phi2(map.phi1(old)) ;
coarsenMark.unmark(centerFace) ;
for(std::vector<Dart>::iterator r = it + 1; r != coarsenCandidate.end(); ++r)
std::vector<Dart>::iterator start = it + 1 ;
if(start != coarsenCandidate.end())
{
if(*r == centerFace)
unsigned int fEmb = map.getEmbedding(FACE_ORBIT, centerFace) ;
while(start != coarsenCandidate.end())
{
std::vector<Dart>::iterator last = coarsenCandidate.end() ;
--last ;
std::swap(last, r) ;
coarsenCandidate.pop_back() ;
if(map.getEmbedding(FACE_ORBIT, *start) == fEmb)
start = coarsenCandidate.erase(start) ;
else
++start ;
}
}
PFP::AGENTS a(agentvect[centerFace]) ;
......
......@@ -5,8 +5,8 @@ Simulator::Simulator() : globalTime_(0.0f), timeStep_(0.2f)
srand(10);
envMap_.init();
std::cout << "setup scenario" << std::endl;
// importAgents("myAgents.pos");
setupScenario(15000);
importAgents("myAgents.pos");
// setupScenario(15000);
// addPathsToAgents();
unsigned nbAgents = agents_.size();
......@@ -80,7 +80,10 @@ void Simulator::doStep()
globalTime_ += timeStep_;
if(globalTime_ - int(globalTime_) == 0.0f && int(globalTime_) % 500 == 0)
{
std::cout << "swap goals" << std::endl ;
swapAgentsGoals();
}
}
void Simulator::setupScenario(unsigned int nbMaxAgent)
......
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