Commit b7f81b10 authored by pitiot's avatar pitiot

ok serpent

parent 2596423f
925 268.919 -599.764 174.022 229.193 -513.318 143.218 -0.154631 0.267809 0.950982
1420 114.119 -361.09 564.72 97.6865 -312.66 478.787 -0.25495 0.820722 0.511289
3115 -119.914 -198.458 186.027 -85.6747 -137.812 114.265 0.346014 0.628714 0.696415
4784 -179.491 -194.446 135.444 -125.036 -132.211 79.2166 0.368223 0.424929 0.826951
7798 -179.204 -102.848 442.481 -148.784 -85.0303 348.901 0.727103 0.591244 0.34893
12828 -125.14 -65.2268 467.511 -106.094 -55.2945 369.845 0.762254 0.611961 0.210886
123 -185.685 -467.24 348.076 -161.367 -389.597 289.936 0.0875394 0.57938 0.810343
123 -185.685 -467.24 348.076 -161.367 -389.597 289.936 0.0875394 0.57938 0.810343
499 -82.8172 -181.343 312.474 -70.7052 -131.43 226.672 0.136105 0.847868 0.512441
937 -7.18517 -11.3042 207.64 -10.3007 -0.634028 108.259 0.0767988 0.991602 0.104058
1563 -62.3674 -142.75 137.936 -37.9392 -68.8674 75.1295 0.201799 0.594775 0.778151
2352 20.072 -60.9946 203.32 25.6662 -15.5125 114.438 0.00685043 0.890023 0.455864
3027 -81.1169 -21.0707 779.242 -72.419 -15.6418 679.769 0.0251416 0.998076 0.0566697
......@@ -9,9 +9,9 @@
// #define SECURED
//#define EXPORTING_AGENT
//#define EXPORTING_AGENT // trainée derriere l'agent
//#define EXPORTING_OBJ
//#define EXPORTING_OBJ // skin mexicain
#define ARASH
......
......@@ -14,6 +14,10 @@ public:
int nbBodyPart;
std::vector<VEC3> goals;
VEC3 curGoal;
float old_Factor; // pour modification de vitesses
PFP::VEC3 get_center ( int index);
PFP::VEC3 get_front ( int index);
};
#endif
......@@ -18,7 +18,16 @@
using namespace std;
//#define EXPORTING2
//#define EXPORTING2 // textures des limaces
#ifdef EXPORTING2
#include "Utils/Shaders/shaderPhongTexture.h"
#include "Utils/Shaders/shaderSimpleTexture.h"
#include "shaderCustomTex.h"
#include "Algo/Import/importObjTex.h"
#endif
float get_angle3D(VEC3 v1, VEC3 v2);
......
......@@ -7,7 +7,7 @@
#include "env_map.h"
#include <set>
#define LINEAR
// #define LINEAR //shapematching linéaire ou quadratic ?
// #define SECURED
......@@ -28,7 +28,7 @@
#endif
#endif
#define EXPORTING_BOXES
#define EXPORTING_BOXES // boites des obstacles
#ifdef EXPORTING_BOXES
#include "Algo/Render/GL2/mapRender.h"
......@@ -44,7 +44,7 @@ using namespace std;
PFP::VEC3 rotate2D (PFP::VEC3 pos1, PFP::VEC3 center, float angle);
VEC3 computeForce(VEC3 p, VEC3 p1, VEC3 p2, float obst_radius_infl, float obst_power, float obst_stiffness, VEC3 normFace);
float get_angle (PFP::VEC3 v1, PFP::VEC3 v2);
PFP::VEC3 get_center (ArticulatedObstacle * art, int index);
class Simulator ;
class MovingMesh;
......@@ -173,6 +173,19 @@ public:
Agent* ag_;
int index_parent;
float gravity_dist; /// distance entre le centre du MO et son sommet le plus éloigné
double stiff_agent;
double radius_agent;
double stiff_obst;
double radius_obst;
double long_radius_agent;
double long_radius_obst;
VertexAttribute<NoMathIONameAttribute<std::vector<PFP::REAL> > > mvc_;
/////// ShapeMatching
......
......@@ -7,7 +7,7 @@ class Obstacle
{
public:
Obstacle(const VEC3 point1, const VEC3 point2,
MovingObstacle * moving1=NULL, unsigned int ind=0,double stiff_agent=20,double stiff_obst=5,double radius_agent=500,double radius_obst=10) :
MovingObstacle * moving1=NULL, unsigned int ind=0,double stiff_agent=20,double stiff_obst=10,double radius_agent=500,double radius_obst=30) :
p1(point1), p2(point2),
mo(moving1), index(ind),p3(0,0,0),obst_stiffness_agent(stiff_agent),obst_stiffness_obst(stiff_obst),obst_radius_infl_agent(radius_agent),obst_radius_infl_obst(radius_obst)
{
......
......@@ -57,8 +57,10 @@
#include "shaderPhongTexCust.h"
#define DRAW_REGISTRATION //montre l'enregistrement des obstacles mobiles
//#define AFFICHE_MESH
//#define EXPORTING
#define AFFICHE_MESH
//#define EXPORTING // ne pas activer
#define ONERING
//#define SHADOWSHELL
......
......@@ -15,7 +15,7 @@ VEC3 Agent::xyPlane = VEC3(0,0,1);
unsigned int Agent::maxNeighbors_ = 10 ;
unsigned int Agent::maxMovingObstacles_ = 20;
float Agent::averageMaxSpeed_ = 0.5f ;
float Agent::averageMaxSpeed_ =2.0f ;
// float Agent::averageMaxSpeed_ = 20.0f ;
float Agent::neighborDist_ = 10.0f ;
//float Agent::neighborDist_ = 20.0f ;
......@@ -763,7 +763,7 @@ void Agent::computeNewVelocity()
VEC3 normFace = VEC3 (0,0,1);
#endif
double collision_softening_factor;
float ag_ambient_damping = 1000.0;
float ag_ambient_damping = 10.0;
// double mass_var = 0.95;
// double average_mass = 1.0;
......@@ -795,7 +795,7 @@ void Agent::computeNewVelocity()
//----- force due à l'attraction de l'objectif ----------
float goal_attraction_force = 200.0; // agent-goal interaction stiffness
float goal_attraction_force = 100.0; // agent-goal interaction stiffness
VEC3 p_goal = goals_[curGoal_];
VEC3 u_goal = p_goal - getPosition();
u_goal.normalize();
......
......@@ -4,6 +4,7 @@ ArticulatedObstacle::ArticulatedObstacle(Simulator* sim, int index, int currentI
{
this->index=index;
nbBodyPart = size;
old_Factor=0;
MovingObstacle * mo4= new MovingObstacle(sim,currentIndex+1 ,pos[0],goals,true,true,curGoal, NIL,this,0);
members.push_back(mo4);
for(int i =1; i<nbBodyPart; i++)
......@@ -16,7 +17,11 @@ ArticulatedObstacle::ArticulatedObstacle(Simulator* sim, int index, int currentI
}
}
PFP::VEC3 get_center (ArticulatedObstacle * art, int index)
PFP::VEC3 ArticulatedObstacle::get_center (int index)
{
return art->members[index]->center + (art->members[index]->center -art->members[index]->front);
return this->members[index]->center ;
}
PFP::VEC3 ArticulatedObstacle::get_front (int index)
{
return this->members[index]->front;
}
......@@ -79,24 +79,28 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
{
case 0 :
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateGrid<PFP>(*this) ;
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
CityGenerator::generateCity<PFP>(*this,0,500.0f) ;
break ;
case 1 :
CityGenerator::generateGrid<PFP>(*this) ;
// CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
break ;
case 2 :
CityGenerator::generateGrid<PFP>(*this) ;
// CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
break ;
case 3 :
CityGenerator::generateGrid<PFP>(*this) ;
// CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateCity<PFP>(*this,10,500.0f) ;
break ;
case 4 :
CityGenerator::generateGrid<PFP>(*this) ;
CityGenerator::generateTrianGrid<PFP>(*this,obstacleMark, buildingMark);
// CityGenerator::generateGrid<PFP>(*this) ;
break ;
case 5 :
{
......@@ -201,7 +205,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
break;
case 6:
CityGenerator::generatePlanet<PFP>(*this);
CityGenerator::generateCity<PFP>(*this,200, 1000.0f, 20.0f) ;
CityGenerator::generateCity<PFP>(*this,30, 1000.0f, 20.0f) ;
break;
case 7 :
......
This diff is collapsed.
......@@ -17,10 +17,10 @@ timespec timespec_delta(const timespec& t1, const timespec& t2) {
Simulator::Simulator(unsigned int config, unsigned int minS, unsigned int nbAgent, unsigned int nbObst, bool resolution) :
#ifdef TWO_AND_HALF_DIM
timeStep_(0.4f),
timeStep_(0.1f),
#else
// timeStep_(config > 2 ? 0.01f : 0.25f),
timeStep_(0.25f),
timeStep_(config > 2 ? 0.02f : 0.25f),
// timeStep_(0.1f),
#endif
globalTime_(0.0f),
......@@ -78,10 +78,10 @@ void Simulator::init( float dimension, unsigned int nbAgent, unsigned int nbObst
//// setupCityScenario(-1.0f * (12 * (70.0f / 2.0f) - 10),
//// -1.0f * (12 * (70.0f / 2.0f) - 10), 20, 20);
break ;
case 4 :
setupCrowdedScenario(nbAgent,nbObst,1) ;
case 4 : //scenario foule dense + train
setupCrowdedScenario(nbAgent,8,1) ;
break ;
case 5:
case 5: //strasbourg
envMap_.init(config, 1600.0f, 1200.0f, minSize, 400.0f) ; //svg import
setupScenario(nbAgent, true) ;
// SelectorCellNotMarked<PFP::MAP> scnm(envMap_.pedWayMark);
......@@ -94,7 +94,7 @@ void Simulator::init( float dimension, unsigned int nbAgent, unsigned int nbObst
envMap_.init(config,200.0,200.0, minSize, 400.0f);
addMovingObstacles(nbObst, 1, 500, 1);
addMovingObstacles(nbObst, 1, 500, 3);
setupPlanetScenario(nbAgent,nbObst);
addPathToObstacles(envMap_.buildingMark, true);
addPathsToAgents();
......@@ -440,7 +440,7 @@ void Simulator::setupCircleScenario(unsigned int nbAgents , unsigned int nbObsta
void Simulator::setupCrowdedScenario(unsigned int nbAgents , unsigned int nbObstacles, int snake)
{
if (multires)
envMap_.init(config, 1500.0f, 1500.0f, minSize, 400.0f) ; //grosses cases
envMap_.init(config, 750.0f, 750.0f, minSize, 400.0f) ; //grosses cases
else
{
......@@ -480,7 +480,9 @@ void Simulator::setupCrowdedScenario(unsigned int nbAgents , unsigned int nbObst
for (unsigned int cury = 0 ; cury < nby ; ++cury)
{
VEC3 posagent = posinit + VEC3(ecart * curx, ecart * cury, 0.0f) ;
addAgent(posagent, posagent, dCell) ;
VEC3 goal = posagent;
goal[0]*=-1;
addAgent(posagent, goal, dCell) ;
}
}
......@@ -509,7 +511,8 @@ void Simulator::setupCrowdedScenario(unsigned int nbAgents , unsigned int nbObst
if(snake==1)
{
int snakeSize=10;
CGoGNout<<"IT'S A SNAKE"<<CGoGNendl;
int snakeSize=nbObstacles;
std::vector<PFP::VEC3> positions [snakeSize] ;
positions[0]=vPos;
goal=center;
......@@ -549,9 +552,12 @@ else
goals.push_back(goal);
goals.push_back(start);
curGoal = 0;
mo4= new MovingObstacle(this, 0,vPos,goals, true, true,curGoal);
if (nbObstacles !=0)
{
mo4= new MovingObstacle(this, 0,vPos,goals, true, true,curGoal);
movingObstacles_.push_back(mo4);
movingObstacles_.push_back(mo4);
}
}
......
......@@ -283,7 +283,7 @@ void SocialAgents::initRendering()
#ifdef EXPORTING
#if 1
#if 0
m_Ground_VBO = new Utils::VBO();
m_Ground_VBO->setDataSize(3);
m_Ground_VBO->allocate(4);
......@@ -1160,7 +1160,7 @@ void SocialAgents::animate()
// setCameraDebug();
/*
if(cif_exists)
{
qglviewer::Vec lookfrom, lookat, upvector;
......@@ -1189,7 +1189,7 @@ void SocialAgents::animate()
cam->lookAt(lookat);
cam->setUpVector(upvector,true);
}
*/
if (maxIterations > 0 && nbIterations > maxIterations)
{
// std::cout << "t : " << simulator.globalTime_ << std::endl ;
......@@ -1271,13 +1271,16 @@ void SocialAgents::animate()
exit(0) ;
}
struct timespec begTime ;
int nb_max=2;
// if (nbIterations>9000) nb_max=2;
// else nb_max=10000;
clock_gettime(CLOCK_MONOTONIC, &begTime) ;
for(int n =1; n<2; n++)
simulator.doStep() ;
for(int n =1; n<nb_max; n++)
simulator.doStep() ;
struct timespec endTime ;
clock_gettime(CLOCK_MONOTONIC, &endTime) ;
time_update += timespec_delta(begTime,endTime).tv_nsec;
time_update += timespec_delta(begTime,endTime).tv_nsec/nb_max;
m_positionVBO->updateData(simulator.envMap_.position);
......@@ -1311,13 +1314,12 @@ void SocialAgents::animate()
#ifndef SPATIAL_HASHING
if (render_anim)
{
// if(nbIterations%4==0)
if(nbIterations%2==0)
{
// getQGLWidget()->resize(800,600);
getQGLWidget()->resize(1024,768);
getQGLWidget()->resize(1580,930);
getQGLWidget()->setSnapshotQuality(100);
updateGL() ;
// getQGLWidget()->setSnapshotQuality(100);
std::ostringstream tmpNb ;
unsigned int counter = getQGLWidget()->snapshotCounter();
tmpNb << std::setfill('0') << std::setw(5) << counter ;
......
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