Commit b5f9230a authored by pitiot's avatar pitiot
Browse files

merge

parents c6a193a8 76e8789f
......@@ -56,11 +56,15 @@ public:
Dart finalDart ;
MovingObstacle **movingObstacles_;
int nb_mos;
MovingObstacle **movingObstacles_;
int nb_mos;
static unsigned int maxNeighbors_ ;
static unsigned int maxMovingObstacles_;
static float averageMaxSpeed_ ;
static float neighborDist_ ;
static float neighborDistSq_ ;
......
......@@ -20,7 +20,7 @@ public:
void linkWithObstacle(MovingObstacle * mo);
void scale(float val);
void moveInFace(typename PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos);
void moveInFace(PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos);
void move();
void animate();
......@@ -28,7 +28,7 @@ public:
std::vector<VEC3> jarvisConvexHull(std::vector<VEC3> projectedPointSet);
std::vector<VEC3> computeSkeleton(std::vector<VEC3> projectedPointSet, unsigned int nodeNumber);
typename PFP::MAP map;
PFP::MAP map;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal;
......
......@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>211</width>
<width>219</width>
<height>457</height>
</rect>
</property>
......
......@@ -17,6 +17,7 @@ float Agent::neighborDistSq_ = neighborDist_ * neighborDist_ ;
float Agent::radius_ = 1.5f ;
float Agent::timeHorizon_ = 10.0f ;
float Agent::timeHorizonObst_ = 10.0f ;
float Agent::range_ = 2*timeHorizonObst_ * averageMaxSpeed_ + radius_ ;
float Agent::rangeSq_ = range_ * range_ ;
......@@ -36,6 +37,7 @@ Agent::Agent(Simulator* sim, const VEC3& start, const VEC3& goal, Dart d) :
sim_(sim),
alive(true)
{
init(start,goal);
}
......@@ -79,6 +81,8 @@ void Agent::init(const VEC3& start, const VEC3& goal)
}
//-----------------------------------------------------------------
//-----------------------------------------------------------------
VEC3 Agent::getPosition()
......@@ -623,6 +627,7 @@ void Agent::computeNewVelocity() // de arash
float previous_distSq = previous_relativePosition.norm2();
float previous_dist = sqrt(previous_distSq);
// const VEC3 u_other(relativePosition);
VEC3 u_other(relativePosition);
u_other = relativePosition;
......@@ -630,6 +635,7 @@ void Agent::computeNewVelocity() // de arash
// cerr << "dist=" << dist << " combinedRadius=" << combinedRadius << endl;
if(dist < combinedRadius)
{
collision_softening_factor = pow(1 - dist/combinedRadius,ag_power);
......
......@@ -32,14 +32,14 @@ void MovingMesh::linkWithObstacle(MovingObstacle * mo)
void MovingMesh::scale(float val)
{
TraversorV<typename PFP::MAP> tv(map);
TraversorV<PFP::MAP> tv(map);
for(Dart d = tv.begin() ; d != tv.end() ; d = tv.next())
{
position[d] *= val;
}
}
void MovingMesh::moveInFace(typename PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos)
void MovingMesh::moveInFace(PFP::MAP& motherMap, Dart d, VertexAttribute<VEC3> pos)
{
VEC3 n = Algo::Geometry::faceNormal<PFP>(motherMap, d, pos);
VEC3 b = Algo::Geometry::faceCentroid<PFP>(motherMap, d, pos);
......
......@@ -153,11 +153,6 @@ MovingObstacle::MovingObstacle(Simulator* sim, int ind, std::vector<VEC3> pos, s
gravity_dist = pos_max + 5.0f;
obstacle_range = 15.0f * 15.0f;
}
bool MovingObstacle::test_opposition(VEC3 o, VEC3 p1, VEC3 p2)
......@@ -351,6 +346,7 @@ void MovingObstacle::update()
// MAJ des particules
float abs_angle= angle > 0 ? 1 : -1;
float rotor=0;
if (index_parent==0)
{
......@@ -360,6 +356,7 @@ void MovingObstacle::update()
{
rotor = abs_angle*angle ;
}
// CGoGNout << "Obstacle "<< index << CGoGNendl;
// CGoGNout << "vitesse : "<< velocity_ << CGoGNendl;
// on fait tourner l'obstacle
......
......@@ -18,8 +18,10 @@ Simulator::Simulator(unsigned int config, unsigned int minS) :
detect_agent_collision=true;
srand(10) ;
nbStepsPerUnit_ = 1 / timeStep_ ;
this->config=config;
init(2.0f) ;
}
Simulator::~Simulator()
......@@ -462,7 +464,9 @@ void Simulator::setupSnakeCorridorScenario(unsigned int nbAgents, unsigned int n
goal = start ;
start = tmp ;
}
addAgent(start, goal) ;
}
// Départ des obstacles du quart haut sur toute une demi-largeur
......@@ -472,7 +476,9 @@ void Simulator::setupSnakeCorridorScenario(unsigned int nbAgents, unsigned int n
yStartDelta = envMap_.geometry.size(1) / 20 ;
// Arrivée des obstacles à l'opposée
yGoalDelta = 3* envMap_.geometry.size(1) / 5 ;
yGoalMin = envMap_.geometry.max()[1] - yBorder - yGoalDelta ;
VEC3 xSide (5.0f,0.0f,0.0f);
......
......@@ -65,9 +65,6 @@ void SocialAgents::initGUI()
dock.check_drawAgents->setChecked(drawAgents) ;
dock.check_drawMovingObstacles->setChecked(drawMovingObstacles) ;
setCallBack(dock.check_timer, SIGNAL(toggled(bool)), SLOT(slot_timer(bool))) ;
setCallBack(dock.check_drawEnvLines, SIGNAL(toggled(bool)), SLOT(slot_drawEnvLines(bool))) ;
setCallBack(dock.check_drawEnvFaces, SIGNAL(toggled(bool)), SLOT(slot_drawEnvFaces(bool))) ;
......@@ -318,6 +315,7 @@ void SocialAgents::cb_redraw()
glLineWidth(1.0f) ;
glBegin(GL_POLYGON) ;
renderObstacle(simulator.envMap_, *it,false,drawObstPath);
//////Affiche l'objectif actuel
......@@ -330,6 +328,7 @@ void SocialAgents::cb_redraw()
// glVertex3fv(p2.data());
// glEnd();
//////Affiche la direction
// glColor3f(0.0f, 1.0f, 1.0f) ;
// glLineWidth(3.0f) ;
......@@ -1380,6 +1379,7 @@ int main(int argc, char** argv)
{
QApplication app(argc, argv) ;
unsigned int minSize = Agent::range_ ;
unsigned int iterations = 0 ;
unsigned int config = 1 ;
......
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