Commit f5d9d943 authored by Jund Thomas's avatar Jund Thomas
Browse files

prise en compte des agens, debut pr export

parents 3ef26306 76df679c
......@@ -4,7 +4,7 @@ project(SocialAgents)
#add_definitions(-DSPATIAL_HASHING)
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../CGoGN CACHE STRING "CGoGN root dir")
include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
add_subdirectory(${CMAKE_SOURCE_DIR}/Release Release)
......
......@@ -67,9 +67,6 @@ public:
static float range_ ;
static float rangeSq_ ;
static float timeStep ;
static unsigned int cptAgent ;
float color1;
......
......@@ -528,13 +528,21 @@ void generatePathToUpperStair(typename PFP::MAP& map, typename PFP::TVEC3& posit
}
template <typename PFP>
void generatePlanet(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker<EDGE>& obstacleMark,
CellMarker<FACE>& buildingMark, float radius, unsigned int nbSquares)
void generatePlanet(EnvMap& envMap)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position) ;
prim.cylinder_topo(nbSquares, nbSquares, true, true) ;
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
if (nx < 1) nx = 1 ;
if (ny < 1) ny = 1 ;
Algo::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
prim.cylinder_topo(nx, ny, true, true) ;
double pi = 3.14159265358979323846f ;
double xRadius = envMap.geometry.size(0) / 2 * pi ;
double yRadius = envMap.geometry.size(1) / 2 * pi ;
prim.embedSphere(radius) ;
prim.embedSphere((xRadius+yRadius)/2.0f) ;
}
template <typename PFP>
......
......@@ -69,7 +69,6 @@ public:
REAL maxCellSize ;
REAL minCellSize ;
REAL obstacleDistance ;
REAL max_for_obstacles ;
EnvMap() ;
void init(unsigned int config, REAL width, REAL height, REAL minSize, REAL maxSize) ;
......
......@@ -12,10 +12,12 @@ PFP::VEC3 rotate (PFP::VEC3 pos1, PFP::VEC3 center, float angle);
float get_angle (PFP::VEC3 v1, PFP::VEC3 v2);
void register_add(Obstacle* o, int n, const std::list<Dart>& memo);
class Simulator ;
class MovingObstacle
{
public:
MovingObstacle(int index,EnvMap* envmap, std::vector<PFP::VEC3> pos, VEC3 goal,float rota);
MovingObstacle(Simulator* sim, int index, std::vector<PFP::VEC3> pos, VEC3 goal,float rota);
bool test_opposition(VEC3 o, VEC3 p1, VEC3 p2);
void updateFixedObstNeighbors();
bool is_inside (VEC3 p);
......@@ -60,15 +62,13 @@ public:
static unsigned int maxNeighbors_;
static float detectionFixedObst;
static float maxSpeed_;
static float timeStep ;
float obstacle_range;
static float timeHorizonObst_;
float velocity_factor;
VEC3 velocity_;
VEC3 newVelocity_;
VEC3 prefVelocity_;
EnvMap* envMap_;
Simulator* sim_;
};
#endif
......@@ -2,6 +2,7 @@
#define SIMULATOR_H
#include <limits>
#include <time.h>
#include "env_map.h"
#include "agent.h"
......
......@@ -77,7 +77,8 @@ public:
int maxIterations ;
// to count fps
int frames ;
clock_t nextUpdate ;
struct timespec startTime ;
time_t nextUpdate ;
Simulator sim ;
SelectorTrue allDarts ;
......
This diff is collapsed.
......@@ -11,8 +11,6 @@ float Agent::timeHorizonObst_ = 10.0f ;
float Agent::range_ = timeHorizonObst_ * maxSpeed_ + radius_ ;
float Agent::rangeSq_ = range_ * range_ ;
float Agent::timeStep = 0.25f ;
unsigned int Agent::cptAgent = 0 ;
#ifdef SPATIAL_HASHING
......@@ -28,7 +26,6 @@ Agent::Agent(Simulator* sim, const VEC3& position) :
{
agentNeighbors_.reserve(maxNeighbors_* 2) ;
obstacleNeighbors_.reserve(maxNeighbors_* 2) ;
timeStep = sim->timeStep_ ;
agentNo = cptAgent++ ;
}
#else
......@@ -48,7 +45,6 @@ Agent::Agent(Simulator* sim, const VEC3& position, Dart d) :
agentNeighbors_.reserve(maxNeighbors_ * 2) ;
obstacleNeighbors_.reserve(maxNeighbors_ * 2) ;
movingObstacleNeighbors_.reserve(maxNeighbors_ * 2) ;
timeStep = sim->timeStep_ ;
agentNo = cptAgent++ ;
}
#endif
......@@ -145,7 +141,7 @@ void Agent::updateObstacleNeighbors()
if(distSq < rangeSq_)
{
if(Geom::testOrientation2D(pos, (*it)->p1, (*it)->p2) == Geom::RIGHT)
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
}
......@@ -159,8 +155,12 @@ void Agent::updateObstacleNeighbors()
{
if (Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
if ((*it)->mo==NULL) obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
else movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
if ((*it)->mo==NULL)
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
else
{
movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
}
......@@ -172,16 +172,17 @@ void Agent::updateObstacleNeighbors()
{
if(Geom::testOrientation2D(part_.getPosition(), (*it)->p1, (*it)->p2) == Geom::RIGHT)
{
if ((*it)->mo==NULL) obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
else movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
if ((*it)->mo==NULL)
obstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
else
movingObstacleNeighbors_.push_back(std::make_pair(distSq, *it)) ;
}
}
}
#endif
if (obstacleNeighbors_.size() > maxNeighbors_) std::sort(obstacleNeighbors_.begin(),
obstacleNeighbors_.end(),
obstacleSort) ;
// if (obstacleNeighbors_.size() > maxNeighbors_)
// std::sort(obstacleNeighbors_.begin(), obstacleNeighbors_.end(), obstacleSort) ;
}
void Agent::update()
......@@ -192,9 +193,10 @@ void Agent::update()
velocity_[0] = newVelocity_[0] ;
velocity_[1] = newVelocity_[1] ;
#ifdef SPATIAL_HASHING
pos = pos + (velocity_ * timeStep) ;
pos = pos + (velocity_ * sim->timeStep_) ;
#else
VEC3 target = part_.getPosition() + (velocity_ * timeStep) ;
VEC3 target = part_.getPosition() + (velocity_ * sim_->timeStep_) ;
obstacle_priority(&target);
#endif
meanSpeed_ *= 3.0f ;
......@@ -230,12 +232,12 @@ void Agent::obstacle_priority(PFP::VEC3 * goalVector)
vec=y-x ;
vec.normalize() ;
norm.zero() ;
if (sim_->avoidance==0)// avoids with normal of obstacle side
if (sim_->avoidance==1)// avoids with normal of obstacle side
{
norm[0]=vec[1] ;
norm[1]=-vec[0] ;
}
else if (sim_->avoidance==1) // avoids along the obstacle side
else if (sim_->avoidance==0) // avoids along the obstacle side
{
norm[0]=(3.0f*vec[1]+vec[0])/4.0f ;
norm[1]=(vec[1]-3.0f*vec[0])/4.0f ;
......@@ -258,83 +260,19 @@ void Agent::computePrefVelocity()
VEC3 goalVector = goals_[curGoal_] - getPosition() ;
float goalDist2 = goalVector.norm2() ;
if (goalDist2 < 35.0f)
if (goalDist2 < radius_*radius_)
{
// if(color1==0)
// {
// if(color2==0)
// {
// color3-=0.5f;
// color1+=0.5f;
// }
// else {
// color2-=0.5f;
// color3+=0.5f;
// }
// }
// else
// {
// if(color3!=0)
// {
// color3-=0.5f;
// color1+=0.5f;
// }
// else
// {
// color1-=0.5f;color2+=0.5f;
// }
//
// }
// curGoal_ = (curGoal_ + 1) % goals_.size();
#ifdef SPATIAL_HASHING
curGoal_ = (curGoal_ + 1) % goals_.size() ;
goalVector = goals_[curGoal_] - getPosition() ;
#else
VEC3 possiblepos=goals_[curGoal_] ;
int x =rand() % 2 +1 ;
if (x==2)
{
possiblepos[1]*=-(x-1)*1.0f ;
x=rand() % 2 +1 ;
if (x==2) possiblepos[0]*=-(x-1)*1.0f ;
}
else possiblepos[0]*=-1.0f ;
Dart d1 =sim_->envMap_.getBelongingCell(possiblepos) ;
if (sim_->envMap_.buildingMark.isMarked(d1))
{
float sideSize=0.0f;
if (((possiblepos[0]+sideSize) < sim_->envMap_.max_for_obstacles)
&& ((possiblepos[1]+sideSize) <sim_->envMap_.max_for_obstacles))
possiblepos += VEC3(sideSize,sideSize,0) ;
else if (((possiblepos[0]-sideSize) <sim_->envMap_.max_for_obstacles)
&& ((possiblepos[1]-sideSize) <sim_->envMap_.max_for_obstacles))
possiblepos += VEC3(-sideSize,-sideSize,0) ;
else if (((possiblepos[0]-sideSize) <sim_->envMap_.max_for_obstacles)
&& ((possiblepos[1]+sideSize) <sim_->envMap_.max_for_obstacles))
possiblepos += VEC3(-sideSize,sideSize,0) ;
else possiblepos += VEC3(sideSize,-sideSize,0) ;
}
goals_[curGoal_]=possiblepos ;
goalVector = goals_[curGoal_] - part_.getPosition() ;
#endif
goalDist2 = goalVector.norm2() ;
}
if (goalDist2 > 1.0f)
goalVector.normalize() ;
obstacle_priority(&goalVector) ;
goalDist2 = goalVector.norm2() ;
if (goalDist2 > 1.0f)
goalVector.normalize() ;
if (goalDist2 > maxSpeed_)
{
goalVector.normalize() ;
goalVector *= maxSpeed_;
}
/*
* Perturb a little to avoid deadlocks due to perfect symmetry.
*/
// float angle = std::rand() * 2.0f * M_PI / RAND_MAX;
// float dist = std::rand() * 0.0001f / RAND_MAX;
// prefVelocity_ = goalVector + VEC3(dist * cos(angle), dist * sin(angle), 0.0f);
prefVelocity_ = goalVector ;
}
......@@ -398,6 +336,7 @@ void Agent::computeNewVelocity()
for (std::vector<std::pair<float, Obstacle*> >::iterator it = obstacleNeighbors_.begin() ;
it != obstacleNeighbors_.end() ; ++it)
{
const Obstacle* obst = it->second ;
const VEC3 relativePosition1(obst->p1 - getPosition()) ;
......@@ -421,7 +360,8 @@ void Agent::computeNewVelocity()
}
}
if (alreadyCovered) continue ;
if (alreadyCovered)
continue ;
/* Not yet covered. Check for collisions. */
......@@ -502,11 +442,9 @@ void Agent::computeNewVelocity()
const float leg1 = std::sqrt(distSq1 - radiusSq) ;
leftLegDirection = VEC3(relativePosition1[0] * leg1 - relativePosition1[1] * radius_,
relativePosition1[0] * radius_ + relativePosition1[1] * leg1, 0)
/ distSq1 ;
relativePosition1[0] * radius_ + relativePosition1[1] * leg1, 0) / distSq1 ;
rightLegDirection = VEC3(relativePosition1[0] * leg1 + relativePosition1[1] * radius_,
-relativePosition1[0] * radius_ + relativePosition1[1] * leg1,
0) / distSq1 ;
-relativePosition1[0] * radius_ + relativePosition1[1] * leg1, 0) / distSq1 ;
}
else if (s > 1 && distSqLine <= radiusSq)
{
......@@ -524,11 +462,9 @@ void Agent::computeNewVelocity()
const float leg2 = std::sqrt(distSq2 - radiusSq) ;
leftLegDirection = VEC3(relativePosition2[0] * leg2 - relativePosition2[1] * radius_,
relativePosition2[0] * radius_ + relativePosition2[1] * leg2, 0)
/ distSq2 ;
relativePosition2[0] * radius_ + relativePosition2[1] * leg2, 0) / distSq2 ;
rightLegDirection = VEC3(relativePosition2[0] * leg2 + relativePosition2[1] * radius_,
-relativePosition2[0] * radius_ + relativePosition2[1] * leg2,
0) / distSq2 ;
-relativePosition2[0] * radius_ + relativePosition2[1] * leg2, 0) / distSq2 ;
}
else
{
......@@ -537,8 +473,7 @@ void Agent::computeNewVelocity()
// {
const float leg1 = std::sqrt(distSq1 - radiusSq) ;
leftLegDirection = VEC3(relativePosition1[0] * leg1 - relativePosition1[1] * radius_,
relativePosition1[0] * radius_ + relativePosition1[1] * leg1, 0)
/ distSq1 ;
relativePosition1[0] * radius_ + relativePosition1[1] * leg1, 0) / distSq1 ;
// }
// else
// {
......@@ -550,8 +485,7 @@ void Agent::computeNewVelocity()
// {
const float leg2 = std::sqrt(distSq2 - radiusSq) ;
rightLegDirection = VEC3(relativePosition2[0] * leg2 + relativePosition2[1] * radius_,
-relativePosition2[0] * radius_ + relativePosition2[1] * leg2,
0) / distSq2 ;
-relativePosition2[0] * radius_ + relativePosition2[1] * leg2, 0) / distSq2 ;
// }
// else
// {
......@@ -740,7 +674,7 @@ void Agent::computeNewVelocity()
else
{
/* Project on cut-off circle of time timeStep. */
const float invTimeStep = 1.0f / timeStep ;
const float invTimeStep = 1.0f / sim_->timeStep_ ;
/* Vector from cutoff center to relative velocity. */
const VEC3 w = relativeVelocity - invTimeStep * relativePosition ;
......
......@@ -47,10 +47,6 @@ EnvMap::EnvMap() :
void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, REAL maxSize)
{
int nbSquares = 6;
float sideSize = 400.0f;
max_for_obstacles=(sideSize*nbSquares/2)-sideSize/2;
std::cout << "Init EnvMap" << std::endl ;
VEC3 bottomLeft(-width / 2, -height / 2, 0.0f) ;
VEC3 topRight(width / 2, height / 2, 0.0f) ;
......@@ -95,8 +91,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
CityGenerator::generateCity<PFP>(*this) ;
break ;
case 4 :
CityGenerator::generatePlanet<PFP>(map, position, obstacleMark, buildingMark, 200.0f,
nbSquares) ;
CityGenerator::generatePlanet<PFP>(*this) ;
break ;
}
......@@ -111,8 +106,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
registerWallInFaces() ;
// subdivideAllToMaxLevel();
for (unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end();
subdivisableFace.next(i))
for (unsigned int i = subdivisableFace.begin(); i < subdivisableFace.end(); subdivisableFace.next(i))
subdivisableFace[i].first = false ;
#endif
}
......
#include "moving_obstacle.h"
#include "obstacle.h"
#include "agent.h"
#include "simulator.h"
//float MovingObstacle::neighborDistSq_ = 5.0f * 5.0f;
float MovingObstacle::timeStep = 0.25f;
float MovingObstacle::maxSpeed_ = 1.0f;
float MovingObstacle::timeHorizonObst_ = 10.0f;
......@@ -63,10 +63,10 @@ VEC3 rotate(VEC3 pos1, VEC3 center, float angle)
return pos2;
}
MovingObstacle::MovingObstacle(int ind, EnvMap* envmap, std::vector<VEC3> pos, VEC3 goal, float rota) :
MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, VEC3 goal, float rota) :
index(ind),
newVelocity_(0),
envMap_(envmap)
sim_(sim)
{
assert(pos.size() > 2);
......@@ -92,9 +92,9 @@ MovingObstacle::MovingObstacle(int ind, EnvMap* envmap, std::vector<VEC3> pos, V
sum += pos[i];
// CGoGNout << "Au début : Obstacle "<< o << " position :" << pos[i] << CGoGNendl;
Dart d = envMap_->getBelongingCell(pos[i]);
Dart d = sim_->envMap_.getBelongingCell(pos[i]);
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>* part =
new CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>(envMap_->map, d, pos[i], envMap_->position);
new CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>(sim_->envMap_.map, d, pos[i], sim_->envMap_.position);
parts_[i] = part;
}
......@@ -120,7 +120,7 @@ MovingObstacle::MovingObstacle(int ind, EnvMap* envmap, std::vector<VEC3> pos, V
gravity_dist = pos_max + 5.0f;
obstacle_range = 15.0f * 15.0f;
make_half_turn = get_angle(finalGoal - center, parts_[0]->getPosition() - center) * nbVertices;
make_half_turn = get_angle(finalGoal - center, (parts_[0]->getPosition() + parts_[1]->getPosition()) / 2 - center) * nbVertices;
}
bool MovingObstacle::test_opposition(VEC3 o, VEC3 p1, VEC3 p2)
......@@ -143,7 +143,7 @@ void MovingObstacle::updateFixedObstNeighbors()
if (k==2)
k=nbVertices-1;
std::vector<Obstacle*>& obst = envMap_->obstvect[parts_[k]->d];
std::vector<Obstacle*>& obst = sim_->envMap_.obstvect[parts_[k]->d];
//search all obstacles around
for(std::vector<Obstacle*>::const_iterator it = obst.begin(); it != obst.end(); ++it)
......@@ -161,19 +161,22 @@ void MovingObstacle::updateFixedObstNeighbors()
if(test_opposition(toto_norm,parts_[0]->getPosition(),center)) //// à changer ////////////
{
int co=rand() % 2 + 1;
if(co==2)
co=-1;
int co = rand() % 2 ;
if (toto[0]==0)
{
finalGoal[0]=parts_[0]->getPosition()[0];
finalGoal[1]=co*envMap_->max_for_obstacles;
if (co == 0)
finalGoal[0]=sim_->envMap_.geometry.max()[1]-maxNeighbors_;
else
finalGoal[0]=sim_->envMap_.geometry.min()[1]+maxNeighbors_;
}
else
{
finalGoal[1]=parts_[0]->getPosition()[1];
finalGoal[0]=co*envMap_->max_for_obstacles;
if (co == 0)
finalGoal[0]=sim_->envMap_.geometry.max()[1]-maxNeighbors_;
else
finalGoal[0]=sim_->envMap_.geometry.min()[1]+maxNeighbors_;
}
float angle =get_angle(finalGoal-center,(parts_[0]->getPosition())-center);
......@@ -244,7 +247,7 @@ void MovingObstacle::update()
{
target += rotate(parts_[i]->getPosition(), center, rot);
}
target += (velocity_ * timeStep);
target += (velocity_ * sim_->timeStep_);
}
else
......@@ -309,24 +312,24 @@ void MovingObstacle::register_(Obstacle* o, Dart d, int n)
VEC3 stop = o->p2;
CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> * part =
new CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP>(envMap_->map, d, start, envMap_->position);
new CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP>(sim_->envMap_.map, d, start, sim_->envMap_.position);
part->move(stop);
belonging_cells[n] = part->memo_cross;
envMap_->addObstAsNeighbor(o, belonging_cells[n], &(neighbor_cells[n]));
sim_->envMap_.addObstAsNeighbor(o, belonging_cells[n], &(neighbor_cells[n]));
// CGoGNout << "coucou je suis sorti de addNeighbor" << CGoGNendl;
for (std::list<Dart>::iterator it = part->memo_cross.begin(); it != part->memo_cross.end(); ++it)
{
general_belonging.push_back(*it);
envMap_->pushObstacleInCells(o, *it);
sim_->envMap_.pushObstacleInCells(o, *it);
}
for (std::list<Dart>::iterator it = this->neighbor_cells[n].begin(); it != this->neighbor_cells[n].end(); ++it)
{
this->envMap_->pushObstNeighborInCells(o, *it);
sim_->envMap_.pushObstNeighborInCells(o, *it);
}
}
......@@ -338,22 +341,22 @@ void register_pop(Obstacle* o, int n)
{
for (std::list<Dart>::iterator it = mo->belonging_cells[n].begin(); it != mo->belonging_cells[n].end(); ++it)
{
mo->envMap_->popObstacleInCells(o, *it);
mo->sim_->envMap_.popObstacleInCells(o, *it);
}
for (std::list<Dart>::iterator it = mo->neighbor_cells[n].begin(); it != mo->neighbor_cells[n].end(); ++it)
{
mo->envMap_->popObstNeighborInCells(o, *it);
mo->sim_->envMap_.popObstNeighborInCells(o, *it);
}
}
}
void MovingObstacle::register_oneRingAdd(Obstacle * o, Dart d, int n)
{
assert(this->envMap_->map.getCurrentLevel() == this->envMap_->map.getMaxLevel());
assert(std::find(this->envMap_->obstvect[d].begin(), this->envMap_->obstvect[d].end(), o) == this->envMap_->obstvect[d].end());
assert(sim_->envMap_.map.getCurrentLevel() == sim_->envMap_.map.getMaxLevel());
assert(std::find(sim_->envMap_.obstvect[d].begin(), sim_->envMap_.obstvect[d].end(), o) == sim_->envMap_.obstvect[d].end());
envMap_->pushObstacleInCells(o, d);
sim_->envMap_.pushObstacleInCells(o, d);
belonging_cells[n].clear();
belonging_cells[n].push_back(d);
......@@ -362,15 +365,15 @@ void MovingObstacle::register_oneRingAdd(Obstacle * o, Dart d, int n)
Dart dd = d;
do
{
Dart ddd = this->envMap_->map.alpha1(this->envMap_->map.alpha1(dd));
Dart ddd = sim_->envMap_.map.alpha1(sim_->envMap_.map.alpha1(dd));
while(ddd != dd)
{
envMap_->pushObstNeighborInCells(o, ddd);
sim_->envMap_.pushObstNeighborInCells(o, ddd);
this->neighbor_cells[n].push_back(ddd);
ddd = this->envMap_->map.alpha1(ddd);
ddd = sim_->envMap_.map.alpha1(ddd);
}
dd = this->envMap_->map.phi1(dd);
dd = sim_->envMap_.map.phi1(dd);
} while(dd != d);
}
......@@ -384,15 +387,15 @@ void register_add(Obstacle* o, int n, const std::list<Dart>& memo_cross)
for (std::list<Dart>::iterator it = mo->belonging_cells[n].begin(); it != mo->belonging_cells[n].end(); ++it)
{
// CGoGNout <<"obstacle"<< o->p1 << "new cell : "<< *it << CGoGNendl;
mo->envMap_->pushObstacleInCells(o, *it);
mo->sim_->envMap_.pushObstacleInCells(o, *it);
}
mo->envMap_->addObstAsNeighbor(o, mo->belonging_cells[n], &(mo->neighbor_cells[n]));
mo->sim_->envMap_.addObstAsNeighbor(o, mo->belonging_cells[n], &(mo->neighbor_cells[n]));
for (std::list<Dart>::iterator it = mo->neighbor_cells[n].begin(); it != mo->neighbor_cells[n].end(); ++it)
{
// CGoGNout <<"obstacle"<< o->p1 << "new cell : "<< *it << CGoGNendl;
mo->envMap_->pushObstNeighborInCells(o, *it);
mo->sim_->envMap_.pushObstNeighborInCells(o, *it);
}
}
......@@ -402,7 +405,7 @@ std::list<Dart> MovingObstacle::getMemoCross(const Algo::MovingObjects::Particle
Dart d = p1->d;
const VEC3& start = p1->getPosition();
CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> part(envMap_->map, d, start, envMap_->position);
CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> part(sim_->envMap_.map, d, start, sim_->envMap_.position);
part.move(dest);
return part.memo_cross;
......@@ -417,26 +420,26 @@ void MovingObstacle::register_update(Obstacle* o, Dart d, int n)
bool modif=false;
if(p1->crossCell != CGoGN::Algo::MovingObjects::NO_CROSS
|| p2->crossCell != CGoGN::Algo::MovingObjects::NO_CROSS)
{
memo = getMemoCross(p1,p2->