Commit cc81e0bc authored by pitiot's avatar pitiot

plop

parent a81a5d60
......@@ -56,6 +56,8 @@
#include "shaderCustom.h"
#include "shaderPhongTexCust.h"
//#define AFFICHE_MESH
//#define EXPORTING
//#define ONERING
//#define SHADOWSHELL
......
......@@ -220,7 +220,7 @@ void EnvMap::init(unsigned int config, REAL width, REAL height, REAL minSize, RE
CityGenerator::importObj<PFP>(*this, "./meshRessources/knot3CenteredSubSmooth.obj");
scale(150.0f);
CityGenerator::generateCity<PFP>(*this,1000, 150.0f,5.0f) ;
// CityGenerator::generateCity<PFP>(*this,1000, 150.0f,5.0f) ;
break;
case 9 :
CityGenerator::importObj<PFP>(*this, "./meshRessources/simpleSlugSmoothTest.obj");
......
......@@ -897,6 +897,9 @@ void MovingObstacle::updateForces()
Dart centerDart =map.phi<11>(groundFace);
Dart d = centerDart;
forces[d] += -0.9f*velocity[d];
float rigidity = 10.0f;
float bend_factor=1.0f;// limace 1 ||
float angular_factor=2.0f;// limace 2 ||
do
{
Dart e = map.phi1(d);
......@@ -909,14 +912,14 @@ void MovingObstacle::updateForces()
//stretch spring : /!\ max rigidity relative to the timestep used (unstable otherwise)
float norm = v1.norm();
float rigidity = 10.0f;
float stretch = rigidity*(edgeLength[e]-norm);//4
float stretch = bend_factor*rigidity*(edgeLength[e]-norm);//4
float angularStretch = 0, angularStretch2 = 0;
float restAngle = vertexAngle[e];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;//2
float angularRig = angular_factor*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, d,map.phi2(map.phi_1(d)),position);
......@@ -953,7 +956,7 @@ void MovingObstacle::updateForces()
restAngle = vertexAngle[d];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;//2
float angularRig = angular_factor*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, map.phi_1(d),map.phi2(map.phi1(d)),position);
......@@ -969,7 +972,7 @@ void MovingObstacle::updateForces()
angularStretch = angularRig*(restAngle-curAngle);
}
stretch = rigidity*(edgeLength[d]-norm);//4
stretch = bend_factor*rigidity*(edgeLength[d]-norm);//4
if(norm>0.0f)
{
VEC3 f = (stretch+angularStretch)*(v1/norm);
......@@ -987,7 +990,7 @@ void MovingObstacle::updateForces()
restAngle = vertexAngle[map.phi_1(d)];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;//2
float angularRig = angular_factor*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, e,map.phi2(d),position);
......
......@@ -106,7 +106,7 @@ void Simulator::init( float dimension, unsigned int nbAgent, unsigned int nbObst
addPathsToAgents();
break;
case 8 : envMap_.init(config,200.0,200.0, minSize, 400.0f);
addMovingObstacles(nbObst, 1 , 300 , 5);
addMovingObstacles(nbObst, 1 , 300 , 15);
setupPlanetScenario(nbAgent,nbObst,1,1);
addPathToObstacles(envMap_.buildingMark, true);
addPathsToAgents();
......
......@@ -41,8 +41,8 @@ SocialAgents::SocialAgents(unsigned int config, unsigned int minSize, unsigned i
nextUpdate(0),
simulator(config, minSize, nbAgent, nbObst, resolution),
render_anim(false),
drawEnvLines(true),
drawEnvFaces(true),
drawEnvLines(false),
drawEnvFaces(false),
drawEnvTopo(false),
drawObstacles(false),
drawMovingObstacles(true),
......@@ -801,8 +801,10 @@ void SocialAgents::cb_redraw()
}
// Commente par Arash
// for (std::vector<MovingMesh*>::iterator it = simulator.movingMeshes_.begin() ; it != simulator.movingMeshes_.end() ; ++it)
// (*it)->draw();
#ifdef AFFICHE_MESH
for (std::vector<MovingMesh*>::iterator it = simulator.movingMeshes_.begin() ; it != simulator.movingMeshes_.end() ; ++it)
(*it)->draw();
#endif
}
......@@ -1163,7 +1165,7 @@ void SocialAgents::animate()
}
struct timespec begTime ;
clock_gettime(CLOCK_MONOTONIC, &begTime) ;
// for(int n =1; n<4; n++)
simulator.doStep() ;
struct timespec endTime ;
clock_gettime(CLOCK_MONOTONIC, &endTime) ;
......@@ -2139,8 +2141,8 @@ int main(int argc, char** argv)
// S'il y a un cam input file, alors lire le premier
// entier N et faire marcher la simulation N fois.
// sa.readCameraInputFile("src/cam.scn3.spline");
// sa.cam_output_file.open("src/cam.out",std::ofstream::out);
// sa.readCameraInputFile("cams/cam.scn9.spline");
// sa.cam_output_file.open("cams/cam.out",std::ofstream::out);
//
//
// unsigned int i;
......
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