Commit d3f5c92d authored by pitiot's avatar pitiot

u

parent 9734ba27
......@@ -32,7 +32,7 @@ class ArticulatedObstacle;
#include "pfp.h"
#define EXPORTING3
//#define EXPORTING3
#define TWO_AND_HALF_DIM
......
......@@ -104,7 +104,7 @@ std::vector<Dart> pathFindAStar(EnvMap& envMap, const typename PFP::TVEC3& posit
}
else
{
std::cout << "pathFindAStar: no path found !" << std::endl ;
// std::cout << "pathFindAStar: no path found !" << std::endl ;
// exit(1) ;
}
return path ;
......
......@@ -519,11 +519,11 @@ void Agent::update()
#ifdef EXPORTING_OBJ
VEC3 dir = meanDirection_ ;
VEC3 base(0, -1, 0) ;
VEC3 axisRot = base ^ dir ;
int sign = axisRot[2] > 0 ? 1 : -1 ;
// Geom::Plane3D<float> pl = Algo::Surface::Geometry::facePlane<PFP>(sim_->envMap_.map, part_.d, sim_->envMap_.position);
// pl.project(dir);
//57,2957795 : conversion from radian to degree
float myRot =sign * acos(-dir[1]);
const VEC3 displ = getPosition();
// TraversorV<PFP2::MAP> tV(map);
......@@ -533,11 +533,26 @@ void Agent::update()
// position[d] = position[d]+displ;
// position[d] += rotate(position[d], getPosition(), myRot);
// }
VEC3 normale = Algo::Surface::Geometry::faceNormal<PFP>(sim_->envMap_.map, part_.d, sim_->envMap_.position);
m_transfo.identity();
Geom::rotateZ(myRot,m_transfo);
float angle2 = Geom::angle(dir, base ) ;
VEC3 axis2=VEC3(0,0,1);
if(angle2 != 0)
{
// CGoGNout<<"mexicain :" << agentNo << "angle : "<< angle2 <<CGoGNendl;
Geom::rotate(axis2, angle2, m_transfo) ;
}
float angle = Geom::angle(normale, VEC3 (0,0,1) ) ;
VEC3 axis = VEC3(0,0,1) ^ normale ;
if(angle != 0)
{
Geom::rotate(axis, angle, m_transfo) ;
}
Geom::translate(displ[0],displ[1],displ[2],m_transfo);
m_transfo.transpose();
// previousPos = getPosition();
// previousRot = myRot;
......
......@@ -26,7 +26,7 @@ constrainedV(map)
float area = Algo::Surface::Geometry::convexFaceArea<PFP>(envMap.map, d, envMap.position);
scaleValue = std::max(area/1400.0f,2.0f);
std::cout << "scaleVal " << scaleValue << std::endl;
// std::cout << "scaleVal " << scaleValue << std::endl;
// scale(scaleValue/1.8f);
scale(scaleValue);
......@@ -261,7 +261,7 @@ std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight, Dart d)
rot.identity() ;
Geom::scale(1.5f,1.5f,1.0f,rot);
angle = Geom::angle(normale, VEC3 (0,0,1) ) ;
CGoGNout<<"angle : "<<angle<<CGoGNendl;
// CGoGNout<<"angle : "<<angle<<CGoGNendl;
axis = VEC3(0,0,1) ^ normale ;
// Geom::translate(center[0],center[1],center[2],rot);
......@@ -277,8 +277,8 @@ std::vector<VEC3> MovingMesh::computeProjectedPointSet(float maxHeight, Dart d)
// std::cout << "fin " << points[i] << std::endl;
}
std::cout << "nb vertices before simplification -> " << points.size() <<" ||" << points [0]<< std::endl;
std::cout << "nb vertices after simplification -> " << res.size() << " ||" << res [0]<< std::endl;
// std::cout << "nb vertices before simplification -> " << points.size() <<" ||" << points [0]<< std::endl;
// std::cout << "nb vertices after simplification -> " << res.size() << " ||" << res [0]<< std::endl;
return res;
}
......@@ -318,7 +318,7 @@ void MovingMesh::simplifyCurve(std::vector<VEC3>& pointSet, std::vector<bool>& a
std::vector<VEC3> MovingMesh::jarvisConvexHull(const std::vector<VEC3>& pointSet)
{
std::cout << "pointSet " << pointSet.size() << std::endl;
// std::cout << "pointSet " << pointSet.size() << std::endl;
assert(pointSet.size()>2);
// std::vector<unsigned int> convHull;
......
......@@ -912,12 +912,12 @@ void MovingObstacle::updateForces()
float norm = v1.norm();
float rigidity = 50.0f;
float stretch = 4*rigidity*(edgeLength[e]-norm);
float stretch = rigidity*(edgeLength[e]-norm);//4
float angularStretch = 0, angularStretch2 = 0;
float restAngle = vertexAngle[e];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;
float angularRig = 2*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, d,map.phi2(map.phi_1(d)),position);
......@@ -954,7 +954,7 @@ void MovingObstacle::updateForces()
restAngle = vertexAngle[d];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;
float angularRig = 2*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, map.phi_1(d),map.phi2(map.phi1(d)),position);
......@@ -970,7 +970,7 @@ void MovingObstacle::updateForces()
angularStretch = angularRig*(restAngle-curAngle);
}
stretch = 4*rigidity*(edgeLength[d]-norm);
stretch = rigidity*(edgeLength[d]-norm);//4
if(norm>0.0f)
{
VEC3 f = (stretch+angularStretch)*(v1/norm);
......@@ -988,7 +988,7 @@ void MovingObstacle::updateForces()
restAngle = vertexAngle[map.phi_1(d)];
if(restAngle!=0.0f)
{
float angularRig = 2*rigidity;
float angularRig = 2*rigidity;//2
float curAngle = Algo::Surface::Geometry::angle<PFP>(map, e,map.phi2(d),position);
......@@ -1019,12 +1019,13 @@ void MovingObstacle::updateForces()
//-------------------------------------------------------------------------
// ARASH : A présent on calcule les interactions avec les autres obstacles.
VEC3 norm;
double obst_stiffness = 5.0; // agent-obstacle interaction stiffness
double obst_stiffness = 2.0; // agent-obstacle interaction stiffness
int obst_power = 2 ; // the power to which elevate the agent-obstacle distance
double obst_radius_infl;
double obst_radius_infl, obst_radius_infl_buildings;
obst_radius_infl = 10.; // scenario 1 et 3
obst_radius_infl = 20.; // scenario 1 et 3
obst_radius_infl_buildings= 50.0f;
float fixed_obst_factor = 5.0f;
......@@ -1055,7 +1056,7 @@ void MovingObstacle::updateForces()
VEC3 p1=obst->p2 ;
VEC3 p2=obst->p1 ;
forces[dd] += computeForce(p,p1,p2,fixed_obst_factor*obst_radius_infl,fixed_obst_factor*obst_power,fixed_obst_factor*obst_stiffness,normFace);
forces[dd] += computeForce(p,p1,p2,obst_radius_infl_buildings,fixed_obst_factor*obst_power,fixed_obst_factor*obst_stiffness,normFace);
}
d = map.phi<21>(d);
......
......@@ -91,14 +91,14 @@ void Simulator::init( float dimension, unsigned int nbAgent, unsigned int nbObst
case 6:
envMap_.init(config,200.0,200.0, minSize, 400.0f);
addMovingObstacles(nbObst, 1);
addMovingObstacles(nbObst, 1, 500, 1);
setupPlanetScenario(nbAgent,nbObst);
addPathToObstacles(envMap_.buildingMark, true);
addPathsToAgents();
break;
case 7 : envMap_.init(config,200.0,200.0, minSize, 400.0f);
addMovingObstacles(nbObst, 1 , 300 , 3 );
addMovingObstacles(nbObst, 1 , 300 , 1 );
setupPlanetScenario(nbAgent,nbObst, 1 , 1);
addPathToObstacles(envMap_.buildingMark, true);
addPathsToAgents();
......@@ -774,7 +774,7 @@ void Simulator::setupPlanetScenario(unsigned int nbAgents, unsigned int nbObstac
CellMarker<FACE> filled(envMap_.map);
unsigned int bMax = nbx * nby > 0 ? nbAgents / (nbx * nby) : nbAgents ;
unsigned int bMax = nbx * nby > 0 ? (nbx * nby < nbAgents ? nbAgents/ (nbx * nby) : nbAgents) : nbAgents ;
for (unsigned int i = 0; i < bMax && d != envMap_.map.end(); ++i)
{
......@@ -853,6 +853,7 @@ void Simulator::addMovingObstacles(unsigned int nb, unsigned int type, float are
// CGoGNout<<" dCell initiale :"<< d <<CGoGNendl;
}
}
std::cout << "nb obstacles : " << movingObstacles_.size() << std::endl;
}
void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
......@@ -903,7 +904,7 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
movingMeshes_.push_back(mm);
vPos = mm->computeProjectedPointSet(maxHeight, d);
std::reverse(vPos.begin(),vPos.end());
std::cout << "créé limace" << std::endl;
// std::cout << "créé limace" << std::endl;
}
break;
......@@ -946,7 +947,7 @@ void Simulator::addMovingObstacle(Dart d, unsigned int obstType)
MovingObstacle * mo = new MovingObstacle(this, movingObstacles_.size(),vPos,goals, (obstType==0), (obstType==0), 0 , d);
std::cout << "créé obstacle : "<<vPos[0] << std::endl;
// std::cout << "créé obstacle : "<<vPos[0] << std::endl;
movingObstacles_.push_back(mo);
......
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