Commit 6ef4541e authored by Thomas's avatar Thomas
Browse files

Merge branch 'master' of cgogn:~kraemer/CGoGN_Apps/SocialAgents2

parents 3c89a66b 869ef92b
......@@ -129,26 +129,12 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
} while(dd != d);
}
inline void EnvMap::removeAgentFromVector(PFP::AGENTS& a, Agent* ag)
{
PFP::AGENTS::iterator end = a.end();
for(PFP::AGENTS::iterator it = a.begin(); it != end; ++it)
{
if(*it == ag)
{
*it = a.back();
a.pop_back();
return;
}
}
}
inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
{
assert(map.getCurrentLevel() == map.getMaxLevel());
assert(std::find(agentvect[d].begin(), agentvect[d].end(), agent) != agentvect[d].end());
removeAgentFromVector(agentvect[d],agent);
removeAgentFromVector(agentvect[d], agent);
Dart dd = d;
do
......@@ -163,6 +149,20 @@ inline void EnvMap::popAgentInCells(Agent* agent, Dart d)
} while(dd != d);
}
inline void EnvMap::removeAgentFromVector(PFP::AGENTS& a, Agent* ag)
{
PFP::AGENTS::iterator end = a.end();
for(PFP::AGENTS::iterator it = a.begin(); it != end; ++it)
{
if(*it == ag)
{
*it = a.back();
a.pop_back();
return;
}
}
}
inline void EnvMap::clearUpdateCandidates()
{
refineCandidate.clear();
......
......@@ -238,12 +238,6 @@ void EnvMap::registerObstaclesInFaces()
}
}
}
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(m.isMarked(d) && !buildingMark.isMarked(d))
m.unmark(d);
}
}
void EnvMap::addNeighborObstacles(PFP::OBSTACLES& obst, Dart d, bool edgeNeighbor)
......@@ -429,22 +423,32 @@ void EnvMap::updateMap()
neighborAgentvect[old].clear() ;
map.setCurrentLevel(fLevel) ;
CellMarkerStore newF(map, FACE);
newF.mark(old);
Algo::IHM::subdivideFace<PFP>(map, old, position) ;
CellMarkerStore newF(map, FACE) ;
unsigned int degree = 0 ;
Dart dd = old ;
do
{
++degree ;
newF.mark(dd);
dd = map.phi1(dd) ;
} while(dd != old) ;
if(degree == 3)
{
Dart centerFace = map.phi2(map.phi1(old)) ;
newF.mark(centerFace);
}
map.setCurrentLevel(map.getMaxLevel()) ;
for(PFP::AGENTS::iterator ait = oldAgents.begin(); ait != oldAgents.end(); ++ait)
{
resetAgentInFace(*ait) ;
pushAgentInCells(*ait, (*ait)->part_.d) ;
}
unsigned int degree = 0 ;
Dart dd = old ;
dd = old ;
do
{
++degree ;
Dart d3 = dd ;
do
{
......
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