Commit cb708f28 authored by pitiot's avatar pitiot

correction initialisation

parent 7f90ed0e
...@@ -16,6 +16,8 @@ include_directories( ...@@ -16,6 +16,8 @@ include_directories(
${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}
) )
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui ) QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
QT4_WRAP_CPP( socialAgents_moc ../include/viewer.h ) QT4_WRAP_CPP( socialAgents_moc ../include/viewer.h )
add_executable( socialAgents add_executable( socialAgents
......
...@@ -6,7 +6,14 @@ ...@@ -6,7 +6,14 @@
#include "utils.h" #include "utils.h"
#include "env_map.h" #include "env_map.h"
#include "spatialHashing.h" #include "spatialHashing.h"
#include "Algo/MovingObjects/particle_cell_2D.h"
//#define SECURED
#ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
#else
#include "Algo/MovingObjects/particle_cell_2D.h"
#endif
class Simulator ; class Simulator ;
...@@ -46,7 +53,11 @@ public: ...@@ -46,7 +53,11 @@ public:
#ifdef SPATIAL_HASHING #ifdef SPATIAL_HASHING
VEC3 pos ; VEC3 pos ;
#else #else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ; #ifdef SECURED
CGoGN::Algo::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
#else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ;
#endif
#endif #endif
unsigned int curGoal_ ; unsigned int curGoal_ ;
...@@ -63,6 +74,7 @@ public: ...@@ -63,6 +74,7 @@ public:
static unsigned int maxMovingObstacles_; static unsigned int maxMovingObstacles_;
static float averageMaxSpeed_ ; static float averageMaxSpeed_ ;
static float neighborDist_ ; static float neighborDist_ ;
static float neighborDistSq_ ; static float neighborDistSq_ ;
static float radius_ ; static float radius_ ;
......
...@@ -79,7 +79,7 @@ public: ...@@ -79,7 +79,7 @@ public:
void popAgentInCells(Agent* agent, Dart d) ; void popAgentInCells(Agent* agent, Dart d) ;
void agentChangeFace(Agent* agent, Dart oldFace) ; void agentChangeFace(Agent* agent, Dart oldFace) ;
void popAndPushObstacleInCells(Obstacle* o, int n); Dart popAndPushObstacleInCells(Obstacle* o, int n);
void pushObstacleInCells(Obstacle * mo); void pushObstacleInCells(Obstacle * mo);
void pushObstacleInOneRingCells(Obstacle * o, Dart d, int n); void pushObstacleInOneRingCells(Obstacle * o, Dart d, int n);
void pushObstacleInCells(Obstacle* o, int n, const std::vector<Dart>& memo_cross); void pushObstacleInCells(Obstacle* o, int n, const std::vector<Dart>& memo_cross);
...@@ -328,7 +328,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b ...@@ -328,7 +328,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
} while(first==NIL && d!=beg); } while(first==NIL && d!=beg);
++it; ++it;
}while(first==NIL && it!=belonging_cells.end()); }while(first==NIL && it!=belonging_cells.end());
assert(!buildingMark.isMarked(d)) ; // assert(!buildingMark.isMarked(d)) ;
assert(first!=NIL) ; assert(first!=NIL) ;
// CGoGNout<<"first : "<<first<<CGoGNendl; // CGoGNout<<"first : "<<first<<CGoGNendl;
d=first; d=first;
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "agent.h" #include "agent.h"
#include "Utils/colorMaps.h" #include "Utils/colorMaps.h"
#include "Algo/Render/GL1/map_glRender.h"
inline void renderDart(EnvMap& m, Dart d) inline void renderDart(EnvMap& m, Dart d)
{ {
PFP::VEC3 p1 = m.position[d] ; PFP::VEC3 p1 = m.position[d] ;
...@@ -44,17 +46,66 @@ inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p) ...@@ -44,17 +46,66 @@ inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
} }
inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false) inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false, bool showVertices=false)
{ {
glBegin(GL_POLYGON) ; glBegin(GL_POLYGON) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
// glColor3f(0,1,0);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(obst->map, Algo::Render::GL1::LINE,
// 1.0, obst->position,
// obst->normal) ;
if(showVertices)
{
glPointSize(3.0f) ;
glColor3f(0.0,0.0,1.0);
glBegin(GL_POINTS) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
glPointSize(1.0f) ;
}
glColor3f(1.0,0.0,1.0);
glBegin(GL_LINE_LOOP) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i) for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{ {
const VEC3& p = obst->parts_[i]->getPosition() ; const VEC3& p = obst->getDilatedPosition(i) ;
glVertex3fv(p.data()) ; glVertex3fv(p.data()) ;
} }
glEnd() ; glEnd() ;
// glColor3f(0.0,1.0,1.0);
// glBegin(GL_LINES) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getPosition(i) ;
// glVertex3fv(p.data()) ;
// const VEC3& p2 = obst->getDilatedPosition(i) ;
// glVertex3fv(p2.data()) ;
// }
// glEnd() ;
glLineWidth(5.0f) ;
glColor3f(1.0,1.0,0.0);
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p += 20.0f*obst->velocity_;
glVertex3fv(p.data()) ;
glEnd() ;
if (renderPath) if (renderPath)
{ {
glLineWidth(3.0f) ; glLineWidth(3.0f) ;
...@@ -62,10 +113,19 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging= ...@@ -62,10 +113,19 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
for (std::vector<VEC3>::iterator it = ++(obst->goals_.begin()) ; it != obst->goals_.end() ; for (std::vector<VEC3>::iterator it = ++(obst->goals_.begin()) ; it != obst->goals_.end() ;
++it) ++it)
{ {
glVertex3f((*it)[0], (*it)[1], (*it)[2]) ; // glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
glVertex3f((*it)[0], (*it)[1], obst->index) ;
} }
glEnd() ; glEnd() ;
glLineWidth(1.0f) ; glLineWidth(1.0f) ;
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p = obst->goals_[obst->curGoal_];
glVertex3fv(p.data()) ;
glEnd() ;
} }
} }
...@@ -127,13 +187,22 @@ inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false, ...@@ -127,13 +187,22 @@ inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false,
{ {
glLineWidth(3.0f) ; glLineWidth(3.0f) ;
glBegin(GL_LINE_STRIP) ; glBegin(GL_LINE_STRIP) ;
for (std::vector<VEC3>::iterator it = ++(agent->goals_.begin()) ; it != agent->goals_.end() ; for (std::vector<VEC3>::iterator it = (agent->goals_.begin()) ; it != agent->goals_.end() ;
++it) ++it)
{ {
glVertex3f((*it)[0], (*it)[1], (*it)[2]) ; glVertex3f((*it)[0], (*it)[1], agent->agentNo) ;
} }
glVertex3f((*(agent->goals_.begin()))[0], (*(agent->goals_.begin()))[1], (*(agent->goals_.begin()))[2]) ;
glEnd() ; glEnd() ;
glLineWidth(1.0f) ; glLineWidth(1.0f) ;
glPointSize(5.0f) ;
glBegin(GL_POINTS) ;
VEC3 g = agent->goals_[agent->curGoal_];
glVertex3fv(g.data()) ;
glEnd() ;
glPointSize(1.0f) ;
} }
if (showNeighborDist) if (showNeighborDist)
......
...@@ -15,23 +15,32 @@ using namespace std; ...@@ -15,23 +15,32 @@ using namespace std;
class MovingMesh class MovingMesh
{ {
public: public:
MovingMesh(EnvMap * envMap, Dart d, std::string filename); MovingMesh(EnvMap& envMap, Dart d, std::string filename);
void linkWithObstacle(MovingObstacle * mo); void linkWithObstacle(MovingObstacle * mo);
void transform(Geom::Matrix44f m);
void translate(VEC3 v);
void scale(float val); void scale(float val);
void moveInFace(PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos); void moveInFace(PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos);
void move(); void move();
void animate(); void animate();
std::vector<VEC3> computeProjectedPointSet(); void draw();
std::vector<VEC3> jarvisConvexHull(std::vector<VEC3> projectedPointSet);
std::vector<VEC3> computeProjectedPointSet(float maxHeight);
void simplifyCurve(std::vector<VEC3>& pointSet, std::vector<bool>& active, int start, int end, float epsilon);
std::vector<VEC3> jarvisConvexHull(const std::vector<VEC3>& projectedPointSet);
std::vector<VEC3> computeSkeleton(std::vector<VEC3> projectedPointSet, unsigned int nodeNumber); std::vector<VEC3> computeSkeleton(std::vector<VEC3> projectedPointSet, unsigned int nodeNumber);
PFP::MAP& motherMap;
VertexAttribute<VEC3>& motherPosition;
PFP::MAP map; PFP::MAP map;
VertexAttribute<VEC3> position; VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal; VertexAttribute<VEC3> normal;
float scaleValue;
ShapeMatchingQuadratic<PFP> * smg; ShapeMatchingQuadratic<PFP> * smg;
std::vector<VEC3> skeleton; std::vector<VEC3> skeleton;
......
...@@ -7,16 +7,18 @@ ...@@ -7,16 +7,18 @@
#include "env_map.h" #include "env_map.h"
#include <set> #include <set>
#include "Algo/MovingObjects/particle_cell_2D_memo.h" #include "Algo/MovingObjects/particle_cell_2D_memo.h"
using namespace std; using namespace std;
PFP::VEC3 rotate (PFP::VEC3 pos1, PFP::VEC3 center, float angle); PFP::VEC3 rotate (PFP::VEC3 pos1, PFP::VEC3 center, float angle);
float get_angle (PFP::VEC3 v1, PFP::VEC3 v2); float get_angle (PFP::VEC3 v1, PFP::VEC3 v2);
PFP::VEC3 get_center (ArticulatedObstacle * art, int index); PFP::VEC3 get_center (ArticulatedObstacle * art, int index);
class Simulator ; class Simulator ;
class MovingMesh;
class MovingObstacle class MovingObstacle
{ {
public: public:
MovingObstacle(Simulator* sim, int index, std::vector<PFP::VEC3> pos, std::vector<VEC3> goals,bool spin, ArticulatedObstacle * art=NULL, int ind2=-1); MovingObstacle(Simulator* sim, int index, std::vector<PFP::VEC3> pos, std::vector<VEC3> goals, bool rigid, bool spin,int curGoal=0, Dart d=NIL, ArticulatedObstacle * art=NULL, int indParent=-1);
bool test_opposition(VEC3 o, VEC3 p1, VEC3 p2); bool test_opposition(VEC3 o, VEC3 p1, VEC3 p2);
// void contournerBatiment(); // void contournerBatiment();
void updateAgentNeighbors() ; void updateAgentNeighbors() ;
...@@ -25,13 +27,40 @@ public: ...@@ -25,13 +27,40 @@ public:
void computePrefVelocity(); void computePrefVelocity();
void computeNewVelocity(); void computeNewVelocity();
std::vector<Dart> getMemoCross(const VEC3& pos, const VEC3& dest, Dart& d1, CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> * registering_part); std::vector<Dart> getMemoCross(const VEC3& pos, const VEC3& dest, Dart& d1, CGoGN::Algo::MovingObjects::ParticleCell2DMemo<PFP> * registering_part);
VEC3 getDilatedPosition(unsigned int ind); //vertex position with velocity dilatation
VEC3 getPosition(unsigned int ind); // vertex position
void update(); void update();
PFP::REAL computeMVC(PFP::VEC3 p, Dart vertex);
void computePointMVC(PFP::VEC3 point, std::vector<PFP::REAL>& coordinates);
void attachMesh(MovingMesh* mm);
void updateMesh();
unsigned int nbVertices; unsigned int nbVertices;
std::vector<PFP::VEC3> vertices; std::vector<PFP::VEC3> vertices;
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>* * parts_; CGoGN::Algo::MovingObjects::ParticleCell2D<PFP>* * parts_;
float gravity_dist;
PFP::MAP map;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal;
VertexAttribute<VEC3> deformation;
VertexAttribute<VEC3> velocity;
EdgeAttribute<float> edgeLength;
Dart groundFace;
//vector de détails pour la deformation
// std::vector<PFP::VEC3> verticesDeformation;
//gestion pour du mass-ressort
// std::vector<PFP::VEC3> verticesVelocity;
// std::vector<float> edgeLength;
// std::vector<float> verticesAngle;
// float rigidity;
// float gravity_dist;
VEC3 center; VEC3 center;
int nb_agents_voisins; int nb_agents_voisins;
int nb_register_cells; int nb_register_cells;
...@@ -53,6 +82,7 @@ public: ...@@ -53,6 +82,7 @@ public:
std::vector<VEC3> goals_ ; std::vector<VEC3> goals_ ;
unsigned int curGoal_; unsigned int curGoal_;
Dart dDir;
// static float neighborDistSq_; // static float neighborDistSq_;
static unsigned int maxNeighbors_; static unsigned int maxNeighbors_;
...@@ -60,7 +90,7 @@ public: ...@@ -60,7 +90,7 @@ public:
static float neighborDist_; static float neighborDist_;
static float neighborDistSq_; static float neighborDistSq_;
static float maxSpeed_; static float maxSpeed_;
float obstacle_range; // float obstacle_range;
static float timeHorizonObst_; static float timeHorizonObst_;
float velocity_factor; float velocity_factor;
float color1; float color1;
...@@ -71,9 +101,13 @@ public: ...@@ -71,9 +101,13 @@ public:
VEC3 newVelocity_; VEC3 newVelocity_;
VEC3 prefVelocity_; VEC3 prefVelocity_;
Simulator* sim_; Simulator* sim_;
bool rigid_;
bool spinning; bool spinning;
ArticulatedObstacle * parent; ArticulatedObstacle * parent;
int index_parent; int index_parent;
MovingMesh* mm_;
VertexAttribute<NoMathIONameAttribute<std::vector<PFP::REAL> > > mvc_;
}; };
#endif #endif
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
class Obstacle class Obstacle
{ {
public: public:
Obstacle(const VEC3& point1, const VEC3& point2, const VEC3& prevPoint, const VEC3& nextPoint, Obstacle(const VEC3 point1, const VEC3 point2, const VEC3 prevPoint, const VEC3 nextPoint,
MovingObstacle * moving1, unsigned int ind) : MovingObstacle * moving1, unsigned int ind) :
p1(point1), p2(point2), prevP(prevPoint), nextP(nextPoint), p1(point1), p2(point2), prevP(prevPoint), nextP(nextPoint),
mo(moving1), index(ind) mo(moving1), index(ind)
...@@ -17,10 +17,10 @@ public: ...@@ -17,10 +17,10 @@ public:
// nextP[2] = 0 ; // nextP[2] = 0 ;
} }
const VEC3& p1 ; VEC3 p1 ;
const VEC3& p2 ; VEC3 p2 ;
const VEC3& prevP ; VEC3 prevP ;
const VEC3& nextP ; VEC3 nextP ;
MovingObstacle * mo ; MovingObstacle * mo ;
unsigned int index ; unsigned int index ;
} ; } ;
......
...@@ -83,8 +83,6 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit ...@@ -83,8 +83,6 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit
// inCurrentFace = map.phi1(inCurrentFace) ; // inCurrentFace = map.phi1(inCurrentFace) ;
// } while (inCurrentFace != currentFace) ; // } while (inCurrentFace != currentFace) ;
} while (facesToTry.size() > 0 && !map.sameFace(start, currentFace)) ; } while (facesToTry.size() > 0 && !map.sameFace(start, currentFace)) ;
// If a path has been found, push all predecessors from start to stop // If a path has been found, push all predecessors from start to stop
...@@ -96,6 +94,13 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit ...@@ -96,6 +94,13 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit
path.push_back(toPush) ; path.push_back(toPush) ;
toPush = faceNextFaceToGoal[toPush] ; toPush = faceNextFaceToGoal[toPush] ;
} while (toPush != goal) ; } while (toPush != goal) ;
// Dart dS = path[0];
// do
// {
// dS = map.phi1(dS);
// } while(dS!=path[0] || !map.sameFace(map.phi2(dS),path[1]));
// path[0] = dS;
} }
else else
{ {
......
...@@ -80,11 +80,11 @@ public: ...@@ -80,11 +80,11 @@ public:
class Simulator class Simulator
{ {
public: public:
Simulator(unsigned int config, unsigned int minSize) ; Simulator(unsigned int config, unsigned int minSize, unsigned int nbAgent=1000, unsigned int nbObst=20) ;
~Simulator() ; ~Simulator() ;
void init(float dimension, bool enablePathFinding = false) ; void init(float dimension, unsigned int nbAgent, unsigned int nbObst, bool enablePathFinding = false) ;
void doStep() ; void doStep() ;
...@@ -120,6 +120,7 @@ public: ...@@ -120,6 +120,7 @@ public:
EnvMap envMap_ ; EnvMap envMap_ ;
std::vector<Agent*> agents_ ; std::vector<Agent*> agents_ ;
std::vector<MovingObstacle*> movingObstacles_; std::vector<MovingObstacle*> movingObstacles_;
std::vector<MovingMesh*> movingMeshes_; //for visualization only
int minSize; int minSize;
unsigned int config; unsigned int config;
float timeStep_ ; float timeStep_ ;
......
...@@ -129,6 +129,19 @@ ...@@ -129,6 +129,19 @@
<item> <item>
<widget class="QSpinBox" name="check_slide"/> <widget class="QSpinBox" name="check_slide"/>
</item> </item>
<item>
<widget class="QCheckBox" name="check_pos">
<property name="text">
<string>Draw X line</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="check_x_val"/>
</item>
<item>
<widget class="QSpinBox" name="check_y_val"/>
</item>
<item> <item>
<widget class="QCheckBox" name="check_elipse"> <widget class="QCheckBox" name="check_elipse">
<property name="text"> <property name="text">
......
...@@ -51,7 +51,7 @@ class SocialAgents : public Utils::QT::SimpleQT ...@@ -51,7 +51,7 @@ class SocialAgents : public Utils::QT::SimpleQT
Q_OBJECT Q_OBJECT
public: public:
SocialAgents(unsigned int config, unsigned int minSize, unsigned int iterations) ; SocialAgents(unsigned int config, unsigned int minSize, unsigned int nbAgent , unsigned int nbObst , unsigned int iterations) ;
void initGUI() ; void initGUI() ;
...@@ -103,8 +103,11 @@ public: ...@@ -103,8 +103,11 @@ public:
bool drawObstPredictionTri ; bool drawObstPredictionTri ;
bool drawObstPath ; bool drawObstPath ;
bool draw_dart; bool draw_dart;
bool draw_posX;
bool draw_elipse; bool draw_elipse;
unsigned int dartSlider; unsigned int dartSlider;
int posXSlider;
int posYSlider;
public slots: public slots:
void animate() ; void animate() ;
...@@ -183,9 +186,24 @@ public slots: ...@@ -183,9 +186,24 @@ public slots:
dartSlider = i; dartSlider = i;
updateGL(); updateGL();
} }
void slot_posX(bool b)
{
draw_posX = b ;
updateGL() ;
}
void slot_slide2(int i)
{
posXSlider = i;
updateGL();
}
void slot_slide3(int i)
{
posYSlider = i;
updateGL();
}
void slot_elipse(bool b) void slot_elipse(bool b)
{ {
draw_elipse = b; draw_elipse = b;
updateGL(); updateGL();
} }
} ; } ;
This diff is collapsed.
...@@ -4,13 +4,13 @@ ArticulatedObstacle::ArticulatedObstacle(Simulator* sim, int index, int currentI ...@@ -4,13 +4,13 @@ ArticulatedObstacle::ArticulatedObstacle(Simulator* sim, int index, int currentI
{ {
this->index=index; this->index=index;
nbBodyPart = size; nbBodyPart = size;
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1 ,pos[0],goals,true,this,0); MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1 ,pos[0],goals,true,true,1, NIL,this,0);
members.push_back(mo4); members.push_back(mo4);
for(int i =1; i<nbBodyPart; i++) for(int i =1; i<nbBodyPart; i++)
{ {
std::vector<VEC3> goal; std::vector<VEC3> goal;
goal.push_back(members[i-1]->center); goal.push_back(members[i-1]->center);
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1+i ,pos[i],goal,true, this,i); MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1+i ,pos[i],goal, true, true,0, NIL, this,i);
members.push_back(mo4); members.push_back(mo4);
} }
......
...@@ -74,7 +74,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -74,7 +74,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
{ {
case 0 : case 0 :
// CityGenerator::generateGrid<PFP>(*this) ; // CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateCity<PFP>(*this,1) ; CityGenerator::generateCity<PFP>(*this,0) ;
break ; break ;
case 1 : case 1 :
CityGenerator::generateGrid<PFP>(*this) ; CityGenerator::generateGrid<PFP>(*this) ;
...@@ -98,13 +98,13 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE ...@@ -98,13 +98,13 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
Algo::Import::importSVG<PFP>(map, filename, position, obstacleMark, buildingMark) ; Algo::Import::importSVG<PFP>(map, filename, position, obstacleMark, buildingMark) ;
std::string filename2 = "./svg/mapBuild.svg" ; std::string filename2 = "./svg/mapBuild.svg" ;
Algo::Import::importSVG<PFP>(mapScenary, filename2, positionScenary, obstacleMarkS, buildingMarkS) ; // Algo::Import::importSVG<PFP>(mapScenary, filename2, positionScenary, obstacleMarkS, buildingMarkS) ;
Geom::BoundingBox<PFP::VEC3> bb1, bb2 ; Geom::BoundingBox<PFP::VEC3> bb1, bb2 ;
bb1 = Algo::Geometry::computeBoundingBox<PFP>(map, position) ; bb1 = Algo::Geometry::computeBoundingBox<PFP>(map, position) ;
bb2 = Algo::Geometry::computeBoundingBox<PFP>(mapScenary, positionScenary) ; // bb2 = Algo::Geometry::computeBoundingBox<PFP>(mapScenary, positionScenary) ;
bb1.addPoint(bb2.min()); // bb1.addPoint(bb2.min());
bb1.addPoint(bb2.max()); // bb1.addPoint(bb2.max());
// CityGenerator::planetify<PFP>(map, position, 100.0f, bb1); // CityGenerator::planetify<PFP>(map, position, 100.0f, bb1);
// CityGenerator::planetify<PFP>(mapScenary, positionScenary, 100.0f, bb1); // CityGenerator::planetify<PFP>(mapScenary, positionScenary, 100.0f, bb1);
...@@ -558,7 +558,7 @@ void EnvMap::pushObstacleInCells(Obstacle * o)// réenregistre l'obstacle en que ...@@ -558,7 +558,7 @@ void EnvMap::pushObstacleInCells(Obstacle * o)// réenregistre l'obstacle en que
} }
} }
void EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistrement Dart EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistrement
{ {
MovingObstacle * mo = o->mo; MovingObstacle * mo = o->mo;
VEC3 p1 = mo->parts_[n]->getPosition(); VEC3 p1 = mo->parts_[n]->getPosition();
...@@ -599,6 +599,8 @@ void EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistre ...@@ -599,6 +599,8 @@ void EnvMap::popAndPushObstacleInCells(Obstacle* o, int n)// maj de l'enregistre
pushObstacleInCells(o, n, memo); pushObstacleInCells(o, n, memo);
} }
} }
return d1;
} }
void EnvMap::pushObstacleInOneRingCells(Obstacle * o, Dart d, int n) void EnvMap::pushObstacleInOneRingCells(Obstacle * o, Dart d, int n)
...@@ -722,7 +724,8 @@ void EnvMap::refine() ...@@ -722,7 +724,8 @@ void EnvMap::refine()
subdivisable = sf.second ; subdivisable = sf.second ;
else else
{ {
float minSizeSq = minCellSize * minCellSize ; // diametre de vision de l'agent au carré // float minSizeSq = minCellSize * minCellSize ; // diametre de vision de l'agent au carré
float minSizeSq = Agent::neighborDistSq_;
fLevel = map.faceLevel(old) ; fLevel = map.faceLevel(old) ;
map.setCurrentLevel(fLevel) ; map.setCurrentLevel(fLevel) ;
......
#include "moving_mesh.h" #include "moving_mesh.h"
#include "Algo/Render/GL1/map_glRender.h"
MovingMesh::MovingMesh(EnvMap * envMap, Dart d, std::string filename): MovingMesh::MovingMesh(EnvMap& envMap, Dart d, std::string filename):
motherMap(envMap.map),
motherPosition(envMap.position),
constrainedV(map)