Commit bb6a8e0e authored by pitiot's avatar pitiot

evitement de loin

parent 86512eb7
......@@ -12,7 +12,7 @@ SET (CGoGN_EXT_LIBS ${CGoGN_EXT_LIBS} ${QT_LIBRARIES} ${QGLVIEWER_LIBRARIES})
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
add_subdirectory(${CMAKE_SOURCE_DIR}/Release Release)
......
......@@ -389,9 +389,8 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
obstacleMark.mark(dd) ;
Dart next = map.phi1(dd) ;
Dart previous = map.phi_1(dd) ;
Obstacle* o = new Obstacle(position[dd], position[next], position[previous],
position[map.phi1(next)], NIL, NIL, NULL, 0);
Obstacle* o = new Obstacle(position[dd], position[next], NULL, 0);
#ifdef SPATIAL_HASHING
VEC3 ov = o->p2 - o->p1 ;
......
......@@ -34,7 +34,7 @@ class ArticulatedObstacle;
//#define EXPORTING3
#define TWO_AND_HALF_DIM
//#define TWO_AND_HALF_DIM
#ifdef EXPORTING3
......@@ -377,20 +377,7 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
for (std::vector<Dart>::const_iterator it =belonging_cells.begin();it<belonging_cells.end();++it)
memo_mark.mark(*it);
///////TENTATIVE D'AJOUT RATE
// MovingObstacle * mo = o->mo;
// int n = o->index;
// int m = (n+1)%mo->nbVertices;
//#ifdef TWO_AND_HALF_DIM
// CGoGN::Algo::Surface::MovingObjects::ParticleCell2DAndHalfMemo<PFP> * registering_part = new CGoGN::Algo::Surface::MovingObjects::ParticleCell2DAndHalfMemo<PFP>(mo->sim_->envMap_.map, mo->parts_[n]->d,o->p1,mo->sim_->envMap_.position);
//#else
// CGoGN::Algo::Surface::MovingObjects::ParticleCell2DMemo<PFP> * registering_part = new CGoGN::Algo::Surface::MovingObjects::ParticleCell2DMemo<PFP>(mo->sim_->envMap_.map, mo->position[n],o->p1,mo->sim_->envMap_.position);
//#endif
// registering_part->move(mo->velocity_[n]*mo->velocityAvoidanceFactor+mo->position[n],memo_mark_speed);
// registering_part->move(mo->velocity_[m]*mo->velocityAvoidanceFactor+mo->position[m],memo_mark_speed);
// std::vector<Dart> result =();
// d2=registering_part->d;
// CGoGNout<<"d1 : "<< *d1<<"|| d2 : "<< *d2<<"|| start : "<< pos<<"|| stop : "<< dest<<CGoGNendl;
......
......@@ -6,7 +6,7 @@
#include "utils.h"
#include "env_map.h"
#include <set>
// #define LINEAR
#define LINEAR
// #define SECURED
#ifdef LINEAR
#include "ShapeMatching/shapeMatchingLinear.h"
......@@ -78,6 +78,7 @@ public:
void attachAgent(Agent* ag);
unsigned int nbVertices;
unsigned int nbParticles;
#ifdef SECURED
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DSecured<PFP> * * parts_ ;
......@@ -124,7 +125,7 @@ public:
int max_x_ind;
int min_x_ind;
Obstacle* * obstacles_;
std::vector<Obstacle *> obstacles_;
std::vector<Dart> * belonging_cells;
std::vector<Dart> * neighbor_cells;
......
......@@ -6,10 +6,10 @@
class Obstacle
{
public:
Obstacle(const VEC3 point1, const VEC3 point2, const VEC3 prevPoint, const VEC3 nextPoint, Dart d_1, Dart d_2,
Obstacle(const VEC3 point1, const VEC3 point2,
MovingObstacle * moving1=NULL, unsigned int ind=0) :
d1(d_1), d2(d_2), p1(point1), p2(point2), prevP(prevPoint), nextP(nextPoint),
mo(moving1), index(ind),p3(0,0,0)
p1(point1), p2(point2),
mo(moving1), index(ind),p3(0,0,0),obst_stiffness_agent(20),obst_stiffness_obst(20)
{
// p1[2] = 0 ;
// p2[2] = 0 ;
......@@ -17,16 +17,18 @@ public:
// nextP[2] = 0 ;
}
Dart d1;
Dart d2;
VEC3 p1 ;
VEC3 p2 ;
VEC3 prevP ;
VEC3 nextP ;
MovingObstacle * mo ;
unsigned int index ;
VEC3 p3; //pour les ellipses
double obst_stiffness_agent;
double obst_stiffness_obst;
} ;
#endif
......@@ -15,7 +15,7 @@ VEC3 Agent::xyPlane = VEC3(0,0,1);
unsigned int Agent::maxNeighbors_ = 10 ;
unsigned int Agent::maxMovingObstacles_ = 20;
float Agent::averageMaxSpeed_ = 2.0f ;
float Agent::averageMaxSpeed_ = 0.5f ;
// float Agent::averageMaxSpeed_ = 20.0f ;
float Agent::neighborDist_ = 10.0f ;
//float Agent::neighborDist_ = 20.0f ;
......@@ -25,7 +25,7 @@ float Agent::neighborDistSq_ = neighborDist_ * neighborDist_ ;
float Agent::radius_ = 1.5f ;
float Agent::timeHorizon_ = 10.0f ;
//float Agent::timeHorizon_ = 100.0f ;
float Agent::timeHorizonObst_ = 10.0f ;
float Agent::timeHorizonObst_ = 20.0f ;
float Agent::range_ = 2*timeHorizonObst_ * averageMaxSpeed_ + radius_ ;
float Agent::rangeSq_ = range_ * range_ ;
......@@ -809,12 +809,12 @@ void Agent::computeNewVelocity()
//----- forces dues à la répulsion des obstacles en mouvement ----------
VEC3 norm;
double obst_stiffness = 100.0; // agent-obstacle interaction stiffness
int obst_power = 1 ; // the power to which elevate the agent-obstacle distance
int obst_power = 2 ; // the power to which elevate the agent-obstacle distance
double obst_radius_infl;
if(sim_->config==0)
obst_radius_infl = 100.; // scenario 0
obst_radius_infl = 1000.; // scenario 0
else
obst_radius_infl = 40.; // scenario 1 et 3
float force_value;
......@@ -842,7 +842,7 @@ void Agent::computeNewVelocity()
if(sum_of_dists < rest_sum_of_dists)
{
collision_softening_factor = pow(1-sum_of_dists/rest_sum_of_dists,obst_power);
force_value = obst_stiffness*collision_softening_factor*(rest_sum_of_dists - sum_of_dists);
force_value = obst->obst_stiffness_agent*collision_softening_factor*(rest_sum_of_dists - sum_of_dists);
VEC3 v_obst = p2 - p1;
VEC3 normal = normFace ^v_obst;
// Ajouter une composante tangentielle
......
This diff is collapsed.
This diff is collapsed.
......@@ -699,9 +699,8 @@ void EnvMap::registerWallInFaces()
{
Dart dd2 = map.phi2(dd) ;
Dart next = map.phi1(dd2) ;
Dart previous = map.phi_1(dd2) ;
Obstacle* o = new Obstacle(position[next], position[dd2], position[previous],
position[map.phi1(next)], next, dd2, NULL, 0) ;
Obstacle* o = new Obstacle(position[next], position[dd2], NULL, 0) ;
obstvect[dd2].push_back(o) ;
}
dd = map.phi1(dd) ;
......@@ -745,10 +744,8 @@ void EnvMap::registerObstaclesInFaces()
{
Dart dd2 = map.phi2(dd) ;
Dart next = map.phi1(dd2) ;
Dart previous = map.phi_1(dd2) ;
Obstacle* o = new Obstacle(position[dd2], position[next],
position[previous], position[map.phi1(next)],
next, dd2,
NULL, 0) ;
obstvect[d].push_back(o) ;
}
......@@ -798,9 +795,8 @@ void EnvMap::addNeighborObstacles(PFP::OBSTACLES& obst, Dart d, bool edgeNeighbo
// {
Dart dd2 = map.phi2(dd) ;
Dart next = map.phi1(dd2) ;
Dart previous = map.phi_1(dd2) ;
Obstacle* o = new Obstacle(position[dd2], position[next], position[previous],
position[map.phi1(next)], next, dd2, NULL, 0) ;
Obstacle* o = new Obstacle(position[dd2], position[next], NULL, 0) ;
obst.push_back(o) ;
// }
}
......
This diff is collapsed.
......@@ -20,7 +20,7 @@ Simulator::Simulator(unsigned int config, unsigned int minS, unsigned int nbAgen
timeStep_(0.5f),
#else
// timeStep_(config > 2 ? 0.01f : 0.25f),
timeStep_(0.01f),
timeStep_(0.25f),
#endif
globalTime_(0.0f),
......
......@@ -803,8 +803,8 @@ void SocialAgents::cb_redraw()
MovingObstacle * mo =simulator.movingObstacles_[i];
if (drawEnvTopo)
{
unsigned int n = 0;
if(n<mo->nbVertices)
unsigned int n = mo->nbVertices;
if(n<mo->nbParticles)
{
for (std::vector<Dart>::iterator it = mo->belonging_cells[n].begin(); it != mo->belonging_cells[n].end(); ++it)
{
......
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