Commit c8a9e6bf authored by Pierre Kraemer's avatar Pierre Kraemer

mini modifs

parent 7154420a
......@@ -90,8 +90,8 @@ public :
CellMarker obstacleMark;
CellMarker buildingMark;
static const unsigned int nbAgentsToSubdivide = 7;
static const unsigned int nbAgentsToSimplify = 5;
static const unsigned int nbAgentsToSubdivide = 5;
static const unsigned int nbAgentsToSimplify = 4;
CellMarker refineMark;
std::vector<Dart> refineCandidate;
......
......@@ -54,7 +54,7 @@ void EnvMap::init()
unsigned int nbSquares = 14;
CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
// CityGenerator::simplifyFreeSpace<PFP>(map, position, obstacleMark, buildingMark);
map.init();
registerObstaclesInFaces();
for(unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i))
......@@ -233,7 +233,7 @@ void EnvMap::agentChangeFace(Agent* agent, Dart oldFace)
}
}
if(!coarsenMark.isMarked(oldFace) && !refineMark.isMarked(oldFace) && agentvect[oldFace].size() < nbAgentsToSimplify / 2)
if(!coarsenMark.isMarked(oldFace) && !refineMark.isMarked(oldFace) && agentvect[oldFace].size() < nbAgentsToSimplify / 4)
{
coarsenMark.mark(oldFace);
coarsenCandidate.push_back(map.faceOldestDart(oldFace));
......@@ -247,7 +247,6 @@ void EnvMap::updateMap()
for(std::vector<Dart>::iterator it = refineCandidate.begin(); it != refineCandidate.end(); ++it)
{
Dart d = (*it) ;
refineMark.unmark(d);
if(agentvect[d].size() > nbAgentsToSubdivide)
......@@ -257,14 +256,14 @@ void EnvMap::updateMap()
bool subdivisable = true ;
std::pair<bool,bool>& sf = subdivisableFace[d] ;
std::pair<bool,bool>& sf = subdivisableFace[old] ;
if(sf.first == true)
subdivisable = sf.second ;
else
{
float maxEdgeSize = Agent::neighborDistSq_ ; // diametre de vision de l'agent au carré
float minDistSq = Agent::neighborDistSq_ ; // diametre de vision de l'agent au carré
fLevel = map.faceLevel(d) ;
fLevel = map.faceLevel(old) ;
map.setCurrentLevel(fLevel) ;
PFP::VEC3 fCenter = Algo::Geometry::faceCentroid<PFP>(map, old, position) ;
Dart fd = old ;
......@@ -273,8 +272,7 @@ void EnvMap::updateMap()
PFP::VEC3& p = position[fd] ;
PFP::VEC3 edge = Algo::Geometry::vectorOutOfDart<PFP>(map, fd, position) ;
PFP::VEC3 proj = fCenter - (p + (edge * (fCenter - p) / edge.norm2()) * edge) ;
if(proj.norm2() < maxEdgeSize)
// if(Algo::Geometry::vectorOutOfDart<PFP>(map, fd, position).norm2() < maxEdgeSize)
if(proj.norm2() < minDistSq)
{
subdivisable = false ;
break ;
......@@ -290,7 +288,7 @@ void EnvMap::updateMap()
if(subdivisable)
{
if(fLevel == -1)
fLevel = map.faceLevel(d) ;
fLevel = map.faceLevel(old) ;
sf.first = false ;
......@@ -365,12 +363,11 @@ void EnvMap::updateMap()
for(std::vector<Dart>::iterator it = coarsenCandidate.begin(); it != coarsenCandidate.end(); ++it)
{
Dart d = (*it) ;
coarsenMark.unmark(d) ;
Dart old = (*it) ;
coarsenMark.unmark(old) ;
unsigned int fLevel = map.faceLevel(d) ;
Dart old = map.faceOldestDart(d) ;
// Dart old = map.faceOldestDart(d) ;
unsigned int fLevel = map.faceLevel(old) ;
if(fLevel > 0 && map.getDartLevel(old) < fLevel)
{
......
......@@ -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(700);
importAgents("myAgents.pos");
// setupScenario(700);
// addPathsToAgents();
unsigned nbAgents = agents_.size();
......
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