Commit 90704e8e authored by Pierre Kraemer's avatar Pierre Kraemer

SocialAgents -> config exemple

parent 7bc719f8
......@@ -148,7 +148,7 @@ void generateSmallCity(typename PFP::MAP& map, EMBV& position, DartMarker& close
// sideSize *= 0.2f;
unsigned int nbBuilding=1000;
float height = sideSize/2.0f;
unsigned int side = 20;
unsigned int side = 5;
generateGrid<PFP,EMBV>(map,position,side,side,sideSize,closeMark);
Dart dEnd = map.end();
......
......@@ -339,29 +339,6 @@ void EnvMap::addNeighborAgents(PFP::AGENTS agentsFrom,PFP::AGENTS agentsTo)
void EnvMap::updateMap()
{
// simplifyFaces();
CellMarker m(map, FACE_CELL) ;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!m.isMarked(d))
{
m.mark(d) ;
std::vector<Agent*>& agents = agentvect[d] ;
for(std::vector<Agent*>::iterator it = agents.begin(); it != agents.end(); ++it)
{
if(!map.sameFace(d, (*it)->part->d))
{
std::cout << "aaaaaaaaaaaaaaaaaaa" << std::endl ;
std::cout << (*it)->part->state << std::endl ;
if(map.sameFace(map.phi2(d), (*it)->part->d))
{
std::cout << "saucisse" << std::endl ;
}
}
}
}
}
subdivideFaces() ;
map.setCurrentLevel(map.getMaxLevel()) ;
}
......@@ -374,7 +351,7 @@ void EnvMap::subdivideFaces()
if(!m.isMarked(d))
{
m.mark(d) ;
if(!closeMark.isMarked(d) && agentvect[d].size() > 5)
if(!closeMark.isMarked(d) && agentvect[d].size() > 3)
{
if(!map.faceIsSubdivided(d))
{
......@@ -386,16 +363,6 @@ void EnvMap::subdivideFaces()
unsigned int cur = map.getCurrentLevel() ;
unsigned int fLevel = map.faceLevel(d) ;
// std::cout << "cur -> " << cur << " / fLevel -> " << fLevel << " :" ;
// Dart fit = d ;
// do
// {
// unsigned int e = map.getDartEmbedding(FACE_ORBIT, fit) ;
// if(e == EMBNULL) std::cout << " -" ; else std::cout << " " << e ;
// fit = map.phi1(fit) ;
// } while(fit != d) ;
// std::cout << std::endl ;
map.setCurrentLevel(fLevel) ;
std::vector<Dart> marked ;
Dart fit = d ;
......@@ -409,35 +376,18 @@ void EnvMap::subdivideFaces()
Algo::IHM::subdivideFace<PFP>(map, d, position) ;
map.setCurrentLevel(fLevel + 1) ;
// Dart cv = map.phi2(map.phi1(d)) ;
// Dart vit = cv ;
// unsigned int i = 1 ;
// do
// {
// std::cout << " face " << i << " -> " ;
// Dart f = vit ;
// do
// {
// unsigned int e = map.getDartEmbedding(FACE_ORBIT, f) ;
// if(e == EMBNULL) std::cout << " -" ; else std::cout << " " << e ;
// f = map.phi1(f) ;
// } while(f != vit) ;
// std::cout << std::endl ;
// vit = map.alpha1(vit) ;
// ++i ;
// } while(vit != cv) ;
for(std::vector<Dart>::iterator it = marked.begin(); it != marked.end(); ++it)
closeMark.mark(map.phi2(*it)) ;
map.setCurrentLevel(cur) ;
map.setCurrentLevel(map.getMaxLevel()) ;
for(PFP::AGENTS::iterator it = agents.begin(); it != agents.end(); ++it)
{
resetAgentInFace(*it) ;
agentvect[(*it)->part->d].push_back(*it) ;
}
map.setCurrentLevel(cur) ;
}
}
}
......
......@@ -20,7 +20,7 @@ Simulator::Simulator() : agents_(), defaultAgent_(0), globalTime_(0.0f), timeSte
// CGoGN::CityGenerator::generateToboggan<PFP>(envMap.map,envMap.position,envMap.closeMark,100,0.25,200,10);
// std::cout << "simplify" << std::endl;
// envMap.simplify();
envMap.simplify();
envMap.map.init();
std::cout << "setup scenario" << std::endl;
setupScenario();
......
......@@ -87,7 +87,7 @@ void MyGlutWin::initGUI()
bool MyGlutWin::reachedGoal(Simulator* sim)
{
if((int(sim->globalTime_)%1000)==0)
if((int(sim->globalTime_)%500)==0)
std::random_shuffle( sim->goals.begin(), sim->goals.end() );
// /* Check if all agents have reached their goals. */
// for (size_t i = 0; i < sim->getNumAgents(); ++i) {
......@@ -381,7 +381,7 @@ void updateVisualization(Simulator* sim)
void MyGlutWin::animate(void)
{
// if(int(sim->globalTime_)%2)
// CGoGN::CityGenerator::animateCity<PFP,PFP::TVEC3,PFP::TAB_AGENTVECT>(sim->envMap.map,sim->envMap.position,sim->envMap.agentvect,sim->envMap.closeMark,sim->envMap.newBuildings);
// CGoGN::CityGenerator::animateCity<PFP,PFP::TVEC3,PFP::TAB_AGENTVECT>(sim->envMap.map,sim->envMap.position,sim->envMap.agentvect,sim->envMap.closeMark,sim->envMap.newBuildings);
// sim->envMap.map.check();
// posToReach[0] += sin(rand());
// posToReach[1] += cos(rand());
......
......@@ -163,7 +163,7 @@ bool arePointsEquals(const VEC3& point1, const VEC3& point2)
{
VEC3 v(point1 - point2);
#define PRECISION 1e-20
#define PRECISION 1e-6
return v.norm2() <= PRECISION ;
#undef PRECISION
}
......
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