Commit 08833c9c authored by Thomas Pitiot 's avatar Thomas Pitiot

up

parent 900ad261
...@@ -15,7 +15,7 @@ public: ...@@ -15,7 +15,7 @@ public:
Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals); Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals);
Agent(Simulator* sim, VEC3 startingPoint,std::vector<VEC3> goals,Dart d) ; Agent(Simulator* sim, VEC3 startingPoint,std::vector<VEC3> goals,Dart d) ;
~Agent(); ~Agent();
void init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d); void init(Simulator * sim ,VEC3 startingPoint,std::vector<VEC3> goals,Dart d);
void updatePosition(); void updatePosition();
......
#include "simulator.h" #include "simulator.h"
// initialisation Agent // initialisation Agent
void Agent::init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d) void Agent::init(Simulator * sim ,VEC3 startingPoint,std::vector<VEC3> goals,Dart d)
{ {
sim_=sim;
goals_=goals; goals_=goals;
r=0.0f; r=0.0f;
g=0.0f; g=0.0f;
...@@ -16,21 +17,19 @@ void Agent::init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d) ...@@ -16,21 +17,19 @@ void Agent::init(VEC3 startingPoint,std::vector<VEC3> goals,Dart d)
maxVelocity_=3.0f; maxVelocity_=3.0f;
//lien simulateur //lien simulateur
agentNo=sim_->agents.size() ; agentNo=sim_->agents.size() ;
Simulator* sim_;
alive=true; alive=true;
sim_->agents.push_back(this); sim_->agents.push_back(this);
} }
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals, Dart d): Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals, Dart d)
sim_(sim)
{ {
init(startingPoint,goals,d); init(sim,startingPoint,goals,d);
} }
Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals): Agent::Agent(Simulator* sim,VEC3 startingPoint,std::vector<VEC3> goals)
sim_(sim)
{ {
Dart d=sim_->envMap_.getBelongingCell(startingPoint); Dart d=sim->envMap_.getBelongingCell(startingPoint);
init(startingPoint,goals,d); init(sim,startingPoint,goals,d);
} }
void Agent::updatePosition() void Agent::updatePosition()
......
...@@ -84,6 +84,7 @@ void Simulator::initAgents(int nbAgents) ...@@ -84,6 +84,7 @@ void Simulator::initAgents(int nbAgents)
goals.push_back(goal); goals.push_back(goal);
goals.push_back(start); goals.push_back(start);
Agent * ag = new Agent(this,start,goals); Agent * ag = new Agent(this,start,goals);
CGoGNout<<"agent initialisé : "<<ag->agentNo<<CGoGNendl;
// CGoGNout<<"agent n°" << agents_[i]->agentNo << " : "<< agents_[i]<<CGoGNendl; // CGoGNout<<"agent n°" << agents_[i]->agentNo << " : "<< agents_[i]<<CGoGNendl;
} }
} }
......
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