Commit 7904ec91 authored by Jund Thomas's avatar Jund Thomas
Browse files

merge avec david, coord des obst en const ref, correction coord obst

parent c1b82806
......@@ -4,7 +4,7 @@ project(SocialAgents)
#add_definitions(-DSPATIAL_HASHING)
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../CGoGN CACHE STRING "CGoGN root dir")
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
add_subdirectory(${CMAKE_SOURCE_DIR}/Release Release)
......
......@@ -11,16 +11,16 @@ public:
p1(point1), p2(point2), prevP(prevPoint), nextP(nextPoint),
mo(moving1), index(ind)
{
p1[2] = 0 ;
p2[2] = 0 ;
prevP[2] = 0 ;
nextP[2] = 0 ;
// p1[2] = 0 ;
// p2[2] = 0 ;
// prevP[2] = 0 ;
// nextP[2] = 0 ;
}
VEC3 p1 ;
VEC3 p2 ;
VEC3 prevP ;
VEC3 nextP ;
const VEC3& p1 ;
const VEC3& p2 ;
const VEC3& prevP ;
const VEC3& nextP ;
MovingObstacle * mo ;
unsigned int index ;
} ;
......
......@@ -268,10 +268,10 @@ void MovingObstacle::update()
{
// CGoGNout << "avant une etape : Obstacle "<< i << CGoGNendl;
Obstacle* o = obstacles_[i];
o->p1 = parts_[i]->getPosition();
o->p2 = parts_[(i + 1) % nbVertices]->getPosition();
o->prevP = parts_[(i - 1 + nbVertices) % nbVertices]->getPosition();
o->nextP = parts_[(i + 2) % nbVertices]->getPosition();
// o->p1 = parts_[i]->getPosition();
// o->p2 = parts_[(i + 1) % nbVertices]->getPosition();
// o->prevP = parts_[(i - 1 + nbVertices) % nbVertices]->getPosition();
// o->nextP = parts_[(i + 2) % nbVertices]->getPosition();
d = parts_[i]->d;
register_update(o, d, i);
//
......
......@@ -71,7 +71,7 @@ void Simulator::init(unsigned int config, int minSize, float dimension, bool ena
}
#ifndef SPATIAL_HASHING
envMap_.subdivideToProperLevel() ;
// envMap_.subdivideToProperLevel() ;
#endif
// setupMovingObstacle(40);
......@@ -148,7 +148,7 @@ void Simulator::doStep()
nbRefineCandidate += envMap_.refineCandidate.size() ;
nbCoarsenCandidate += envMap_.coarsenCandidate.size() ;
envMap_.updateMap() ;
// envMap_.updateMap() ;
#endif
globalTime_ += timeStep_ ;
......@@ -274,8 +274,8 @@ void Simulator::setupCorridorScenario(unsigned int nbAgents, unsigned int nbObst
yGoalDelta = envMap_.geometry.size(1) / 5 ;
yGoalMin = envMap_.geometry.max()[1] - yBorder - yGoalDelta ;
VEC3 xSide (10.0f,0.0f,0.0f);
VEC3 ySide (05.0f,0.0f,0.0f);
VEC3 xSide (15.0f,0.0f,0.0f);
VEC3 ySide (0.0f,10.0f,0.0f);
std::vector<VEC3> vPos;
MovingObstacle* mo4;
......
......@@ -33,7 +33,7 @@ SocialAgents::SocialAgents(int minSize, int iterations) :
sim(minSize),
render_anim(false),
drawEnvLines(true),
drawEnvFaces(true),
drawEnvFaces(false),
drawEnvTopo(false),
drawObstacles(false),
drawMovingObstacles(true),
......@@ -214,6 +214,7 @@ void SocialAgents::cb_redraw()
{
for (std::vector<MovingObstacle*>::iterator it = sim.movingObstacles_.begin() ; it != sim.movingObstacles_.end() ; ++it)
{
// MovingObstacle* mo = *it ;
// VEC3 pos = (*it)->finalGoal;
......@@ -223,16 +224,15 @@ void SocialAgents::cb_redraw()
// glVertex3f(pos[0] + (cosT[i] * 1.5f), pos[1] + (sinT[i] * 1.5f), pos[2]+0.01f);
// glEnd();
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL) ;
glColor3f(0.0f, 0.0f, 1.0f) ;
glColor3f(1.0f, 1.0f, 1.0f) ;
glLineWidth(1.0f) ;
glBegin(GL_POLYGON) ;
for (unsigned int i = 0 ; i < ((*it)->nbVertices) ; ++i)
{
float * p = (*it)->obstacles_[i]->p1.data() ;
float * p = (float *) (*it)->obstacles_[i]->p1.data() ;
p[2] = 0.01f ;
glVertex3fv(p) ;
}
glEnd() ;
//display collision avoidance circle
......
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