Commit eee58981 authored by Arash HABIBI's avatar Arash HABIBI
Browse files

slug_conflict

parents 542cf331 0bf72574
......@@ -7,7 +7,7 @@
#include "env_map.h"
#include "spatialHashing.h"
#define SECURED
//#define SECURED
#ifdef SECURED
#include "Algo/MovingObjects/particle_cell_2D_secured.h"
......@@ -54,9 +54,9 @@ public:
VEC3 pos ;
#else
#ifdef SECURED
CGoGN::Algo::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
CGoGN::Algo::Surface::MovingObjects::ParticleCell2DSecured<PFP> part_ ;
#else
CGoGN::Algo::MovingObjects::ParticleCell2D<PFP> part_ ;
CGoGN::Algo::Surface::MovingObjects::ParticleCell2D<PFP> part_ ;
#endif
#endif
......@@ -84,6 +84,8 @@ public:
static unsigned int cptAgent ;
VEC3 forces;
float color1;
float color2;
float color3;
......
......@@ -13,15 +13,13 @@ namespace CityGenerator
template <typename PFP>
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<FACE>& buildingMark) ;
template <typename PFP> Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap) ;
template <typename PFP> Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap) ;
template <typename PFP> void generateCity(EnvMap& envMap, unsigned int nbBuildings) ;
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
typename PFP::TVEC3& position,
unsigned int cX, unsigned int cY,
float sideLength, CellMarker<EDGE>& obstacleMark,
Algo::Surface::Modelisation::Polyhedron<PFP> generateTrianGrid(EnvMap& envMap,
CellMarker<EDGE>& obstacleMark,
CellMarker<FACE>& buildingMark) ;
template <typename PFP>
......
......@@ -36,7 +36,7 @@ bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<
}
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
Algo::Surface::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
{
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
......@@ -45,7 +45,7 @@ Algo::Modelisation::Polyhedron<PFP> generateGrid(EnvMap& envMap)
std::cout << " - Generate Grid : " << nx << " x " << ny << std::endl ;
Algo::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
Dart d = prim.grid_topo(nx, ny) ;
prim.embedGrid(envMap.geometry.size(0), envMap.geometry.size(1), 0.0f) ;
......@@ -83,57 +83,59 @@ void generateCity(EnvMap& envMap, unsigned int nbBuildings)
}
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
typename PFP::TVEC3& position,
unsigned int cX, unsigned int cY,
float sideLength, CellMarker<EDGE>& obstacleMark,
Algo::Surface::Modelisation::Polyhedron<PFP> generateTrianGrid(EnvMap& envMap,
CellMarker<EDGE>& obstacleMark,
CellMarker<FACE>& buildingMark)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position) ;
prim.grid_topo(cX, cY) ;
unsigned int nx = envMap.geometry.size(0) / envMap.maxCellSize ;
unsigned int ny = envMap.geometry.size(1) / envMap.maxCellSize ;
if (nx < 1) nx = 1 ;
if (ny < 1) ny = 1 ;
prim.embedGrid(sideLength * cX, sqrt(sideLength * sideLength * 3.0f / 4.0f) * cY) ;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
prim.grid_topo(nx, ny) ;
prim.embedGrid(envMap.geometry.size(0), envMap.geometry.size(1), 0.0f) ;
Dart dY = prim.getDart() ; //remind the first quad of the line
Dart dX = prim.getDart() ; //goes through the line
bool odd = true ; //odd line or not
for (unsigned int i = 0; i < cX * cY;)
for (unsigned int i = 0; i < nx * ny;)
{
Dart dNext = map.phi1(map.phi2(map.phi1(dX))) ;
Dart dNext = envMap.map.phi1(envMap.map.phi2(envMap.map.phi1(dX))) ;
Dart toCut = dX ;
if (odd)
{
toCut = map.phi1(toCut) ; //change the side of the split face
position[toCut][0] -= sideLength / 2.0f ; //move vertices for equilateral triangles
toCut = envMap.map.phi1(toCut) ; //change the side of the split face
envMap.position[toCut][0] -= envMap.maxCellSize / 2.0f ; //move vertices for equilateral triangles
}
map.splitFace(toCut, map.phi1(map.phi1(toCut))) ;
envMap.map.splitFace(toCut, envMap.map.phi1(envMap.map.phi1(toCut))) ;
++i ;
if (i % cX == 0 && i > 0) //goes up and change side of split
if (i % nx == 0 && i > 0) //goes up and change side of split
{
Dart endSquare = map.newOrientedFace(3) ; //add triangle add end of lines to make a square
Dart endSquare = envMap.map.newFace(3) ; //add triangle add end of lines to make a square
Dart dN ;
if (odd)
{
dN = map.phi1(map.phi2(map.phi1(dX))) ;
map.sewFaces(dN, endSquare) ;
position[map.phi_1(endSquare)] = position[map.phi1(endSquare)] ;
position[map.phi_1(endSquare)][0] += sideLength / 2.0f ;
dN = envMap.map.phi1(envMap.map.phi2(envMap.map.phi1(dX))) ;
envMap.map.sewFaces(dN, endSquare) ;
envMap.position[envMap.map.phi_1(endSquare)] = envMap.position[envMap.map.phi1(endSquare)] ;
envMap.position[envMap.map.phi_1(endSquare)][0] += envMap.maxCellSize / 2.0f ;
}
else
{
dN = map.phi1(dX) ;
map.sewFaces(dN, endSquare) ;
position[map.phi_1(endSquare)] = position[endSquare] ;
dN = envMap.map.phi1(dX) ;
envMap.map.sewFaces(dN, endSquare) ;
envMap.position[envMap.map.phi_1(endSquare)] = envMap.position[endSquare] ;
}
if (odd)
dY = map.phi2(map.phi_1(map.phi2(map.phi1(dY)))) ;
dY = envMap.map.phi2(envMap.map.phi_1(envMap.map.phi2(envMap.map.phi1(dY)))) ;
else
dY = map.phi2(map.phi1(map.phi2(map.phi_1(dY)))) ;
dY = envMap.map.phi2(envMap.map.phi1(envMap.map.phi2(envMap.map.phi_1(dY)))) ;
dX = dY ;
odd = !odd ;
......@@ -142,44 +144,44 @@ Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map,
dX = dNext ;
}
Dart boundary ;
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
if (map.phi2(d) == d)
{
Dart dA = map.alpha1(map.phi1(d)) ;
if (map.phi2(dA) == dA && position[dA] == position[map.phi1(d)]
&& position[map.phi1(dA)] == position[d])
map.sewFaces(dA, d) ;
else
{
obstacleMark.mark(d) ;
boundary = d ;
}
}
}
map.closeHole(boundary) ;
buildingMark.mark(map.phi2(boundary)) ;
// Dart boundary ;
// for (Dart d = envMap.map.begin(); d != envMap.map.end(); envMap.map.next(d))
// {
// if (envMap.map.phi2(d) == d)
// {
// Dart dA = envMap.map.alpha1(envMap.map.phi1(d)) ;
// if (envMap.map.phi2(dA) == dA && envMap.position[dA] == envMap.position[envMap.map.phi1(d)]
// && envMap.position[envMap.map.phi1(dA)] == envMap.position[d])
// envMap.map.sewFaces(dA, d) ;
// else
// {
// obstacleMark.mark(d) ;
// boundary = d ;
// }
// }
// }
//
// envMap.map.closeHole(boundary) ;
// buildingMark.mark(envMap.map.phi2(boundary)) ;
//
// if (odd) //last top line if odd
// {
// for (unsigned int i = 0; i < nx; ++i)
// {
// dX = envMap.map.phi1(dX) ;
// envMap.position[dX][0] -= envMap.maxCellSize / 2.0f ;
// }
// }
if (odd) //last top line if odd
//add hexagons
for(Dart d = envMap.map.begin(); d != envMap.map.end(); envMap.map.next(d))
{
for (unsigned int i = 0; i < cX; ++i)
if(envMap.map.vertexDegree(d)==6)
{
dX = map.phi1(dX) ;
position[dX][0] -= sideLength / 2.0f ;
envMap.map.deleteVertex(d);
}
}
//add hexagons
// for(Dart d = map.begin(); d != map.end(); map.next(d))
// {
// if(map.vertexDegree(d)==6)
// {
// map.deleteVertex(d);
// }
// }
return prim ;
}
......@@ -187,7 +189,7 @@ template <typename PFP>
Dart extrudeFaceAndMark(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d,
CellMarker<FACE>& buildingMark, float height)
{
Dart dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
Dart dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
buildingMark.mark(dRoof) ;
Dart dd = dRoof ;
do
......@@ -207,7 +209,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
VEC3 v2(position[map.template phi<11>(d)]-position[d]);
VEC3 sky = (v1^v2);
sky.normalize();
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, height) ;
switch (buildingType)
{
......@@ -217,7 +219,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
}
case 1 : //with roof 1 slope
{
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
Dart dNext = map.phi1(dRoof) ;
Dart dPrev = map.phi2(map.phi_1(dRoof)) ;
map.collapseEdge(dNext) ;
......@@ -226,7 +228,7 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
}
case 2 : //with roof 2 slopes
{
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoof, height/3.0f) ;
Dart dNext = map.phi1(dRoof) ;
Dart dPrev = map.phi2(map.phi_1(dRoof)) ;
typename PFP::VEC3 mid1 = (position[dNext] + position[map.phi1(dNext)]) / 2.0f ;
......@@ -242,22 +244,22 @@ Dart extrudeBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart
unsigned int nbStairs = rand() % 5 ;
for (unsigned int i = 0; i < nbStairs; ++i)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoof, 0.0f) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoof, 0.0f) ;
Dart dd = dRoofSmall ;
do
{
position[dd] = position[dd] + (c - position[dd]) / 3.0f ;
dd = map.phi1(dd) ;
} while (dd != dRoofSmall) ;
dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, height/2.0f) ;
dRoof = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, dRoofSmall, height/2.0f) ;
}
bool spike = rand() % 2 ;
if (spike)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
c[2] += height / 1.5f ;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof) ;
dRoof = Algo::Surface::Modelisation::trianguleFace<PFP>(map, dRoof) ;
position[dRoof] = c ;
}
break ;
......@@ -327,8 +329,8 @@ bool animateCity(EnvMap* envMap)
}
else
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, d, position) ;
Dart dRoofSmall = Algo::Modelisation::extrudeFace<PFP>(map, position, d, 0.0f) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, d, position) ;
Dart dRoofSmall = Algo::Surface::Modelisation::extrudeFace<PFP>(map, position, d, 0.0f) ;
Dart dd = dRoofSmall ;
do
{
......@@ -403,13 +405,13 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
// Thomas's team
Dart x =map.phi2(dd);
if(!map.isBoundaryMarked(x))
if(!map.isBoundaryMarked2(x))
{
addElementToVector<Obstacle*>(envMap.obstvect[x],o);
if(!map.isBoundaryMarked(map.phi2(map.phi1(x))))
if(!map.isBoundaryMarked2(map.phi2(map.phi1(x))))
addElementToVector<Obstacle*>(envMap.obstvect[map.phi2(map.phi1(x))],o);
if(!map.isBoundaryMarked(map.phi2(map.phi_1(x))))
if(!map.isBoundaryMarked2(map.phi2(map.phi_1(x))))
addElementToVector<Obstacle*>(envMap.obstvect[map.phi2(map.phi_1(x))],o);
}
......@@ -454,7 +456,7 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
unsigned int nbStairs = rand() % 5 ;
for (unsigned int i = 0; i < nbStairs; ++i)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
Dart dRoofSmall = extrudeFaceAndMark<PFP>(map, position, dRoof, buildingMark, 0.0f) ;
Dart dd = dRoofSmall ;
do
......@@ -468,9 +470,9 @@ Dart generateBuilding(EnvMap& envMap, Dart d, float height, unsigned int buildin
bool spike = rand() % 2 ;
if (spike)
{
typename PFP::VEC3 c = Algo::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
typename PFP::VEC3 c = Algo::Surface::Geometry::faceCentroid<PFP>(map, dRoof, position) ;
c[2] += height / 1.5f ;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof) ;
dRoof = Algo::Surface::Modelisation::trianguleFace<PFP>(map, dRoof) ;
position[dRoof] = c ;
}
break ;
......@@ -485,9 +487,9 @@ void generateMall(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
CellMarker<FACE>& buildingMark, float sideSize)
{
unsigned int side = 5 ;
std::vector<Algo::Modelisation::Polyhedron<PFP> > floors ;
std::vector<Algo::Surface::Modelisation::Polyhedron<PFP> > floors ;
Algo::Modelisation::Polyhedron<PFP> * floor2 = new Algo::Modelisation::Polyhedron<PFP>(
Algo::Surface::Modelisation::Polyhedron<PFP> * floor2 = new Algo::Surface::Modelisation::Polyhedron<PFP>(
map, position) ;
floor2->grid_topo(side, side) ;
......@@ -508,7 +510,7 @@ void generateMall(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
}
}
Algo::Modelisation::Polyhedron<PFP> * floor1 = new Algo::Modelisation::Polyhedron<PFP>(
Algo::Surface::Modelisation::Polyhedron<PFP> * floor1 = new Algo::Surface::Modelisation::Polyhedron<PFP>(
map, position) ;
floor1->grid_topo(side, side) ;
floor1->embedGrid(sideSize * side, sideSize * side) ;
......@@ -607,7 +609,7 @@ void generatePlanet(EnvMap& envMap)
if (nx < 1) nx = 1 ;
if (ny < 1) ny = 1 ;
Algo::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
Algo::Surface::Modelisation::Polyhedron<PFP> prim(envMap.map, envMap.position) ;
prim.cylinder_topo(nx, ny, true, true) ;
double pi = 3.14159265358979323846f ;
......@@ -668,7 +670,7 @@ void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position,
VEC_D_A orderedD ;
// compute all heuristic and construct multimap
Algo::Geometry::computeAreaFaces<PFP>(map, position, tableArea) ;
Algo::Surface::Geometry::computeAreaFaces<PFP>(map, position, tableArea) ;
CellMarker<EDGE> eM(map) ;
for (Dart d = map.begin(); d != map.end(); map.next(d))
{
......
......@@ -5,59 +5,68 @@
#include "agent.h"
#include "Utils/colorMaps.h"
#include "Algo/Render/GL1/map_glRender.h"
inline void renderDart(EnvMap& m, Dart d)
{
PFP::VEC3 p1 = m.position[d] ;
PFP::VEC3 p2 = m.position[m.map.phi1(d)] ;
glBegin(GL_LINES) ;
glVertex3f(p1[0], p1[1], p1[2]) ;
glVertex3f(p2[0], p2[1], p2[2]) ;
glEnd() ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
// glBegin(GL_LINES) ;
// glVertex3f(p1[0], p1[1], p1[2]) ;
// glVertex3f(p2[0], p2[1], p2[2]) ;
// glEnd() ;
}
inline void renderFace(EnvMap& m, Dart d)
{
Dart dd = d ;
do
{
renderDart(m, dd) ;
dd = m.map.phi1(dd) ;
} while (dd != d) ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
// Dart dd = d ;
// do
// {
// renderDart(m, dd) ;
// dd = m.map.phi1(dd) ;
// } while (dd != d) ;
}
inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
{
Geom::Plane3D<float> pl = Algo::Geometry::facePlane<PFP>(m.map, d, m.position) ;
Geom::Plane3D<float> pl = Algo::Surface::Geometry::facePlane<PFP>(m.map, d, m.position) ;
p[2] -= 1000 ;
Geom::intersectionPlaneRay(pl, p, VEC3(0, 0, -1), p) ;
VEC3 pos1(m.position[d]) ;
VEC3 pos2(m.position[m.map.phi1(d)]) ;
pos2[2] += 2 ;
glBegin(GL_LINE_LOOP) ;
glVertex3fv(&p[0]) ;
glVertex3fv(&pos1[0]) ;
glVertex3fv(&pos2[0]) ;
glEnd() ;
// glBegin(GL_LINE_LOOP) ;
// glVertex3fv(&p[0]) ;
// glVertex3fv(&pos1[0]) ;
// glVertex3fv(&pos2[0]) ;
// glEnd() ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
}
inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=false, bool renderPath = false, bool showVertices=false)
{
glBegin(GL_POLYGON) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
// glPolygonMode(GL_FRONT_AND_BACK, GL_LINE) ;
// glColor3f(1.0,1.0,1.0);
// glBegin(GL_POLYGON) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getPosition(i) ;
// glVertex3fv(p.data()) ;
// }
// glEnd() ;
// glColor3f(0,1,0);
// Algo::Render::GL1::renderTriQuadPoly<PFP>(obst->map, Algo::Render::GL1::LINE,
// 1.0, obst->position,
......@@ -65,26 +74,26 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
if(showVertices)
{
glPointSize(3.0f) ;
glColor3f(0.0,0.0,1.0);
glBegin(GL_POINTS) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
glPointSize(1.0f) ;
// glPointSize(3.0f) ;
// glColor3f(0.0,0.0,1.0);
// glBegin(GL_POINTS) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getPosition(i) ;
// glVertex3fv(p.data()) ;
// }
// glEnd() ;
// glPointSize(1.0f) ;
}
glColor3f(1.0,0.0,1.0);
glBegin(GL_LINE_LOOP) ;
for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
{
const VEC3& p = obst->getDilatedPosition(i) ;
glVertex3fv(p.data()) ;
}
glEnd() ;
// glColor3f(1.0,0.0,1.0);
// glBegin(GL_LINE_LOOP) ;
// for (unsigned int i = 0 ; i < (obst->nbVertices) ; ++i)
// {
// const VEC3& p = obst->getDilatedPosition(i) ;
// glVertex3fv(p.data()) ;
// }
// glEnd() ;
// glColor3f(0.0,1.0,1.0);
// glBegin(GL_LINES) ;
......@@ -97,35 +106,35 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
// }
// glEnd() ;
glLineWidth(5.0f) ;
glColor3f(1.0,1.0,0.0);
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p += 20.0f*obst->velocity_;
glVertex3fv(p.data()) ;
glEnd() ;
// glLineWidth(5.0f) ;
// glColor3f(1.0,1.0,0.0);
// glBegin(GL_LINES) ;
// VEC3 p = obst->getPosition(0) ;
// glVertex3fv(p.data()) ;
// p += 20.0f*obst->velocity_;
// glVertex3fv(p.data()) ;
// glEnd() ;
if (renderPath)
{
glLineWidth(3.0f) ;
glBegin(GL_LINE_STRIP) ;
for (std::vector<VEC3>::iterator it = ++(obst->goals_.begin()) ; it != obst->goals_.end() ;
++it)
{
// glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
glVertex3f((*it)[0], (*it)[1], obst->index) ;
}
glEnd() ;
glLineWidth(1.0f) ;
glBegin(GL_LINES) ;
VEC3 p = obst->getPosition(0) ;
glVertex3fv(p.data()) ;
p = obst->goals_[obst->curGoal_];
glVertex3fv(p.data()) ;
glEnd() ;
// glLineWidth(3.0f) ;
// glBegin(GL_LINE_STRIP) ;
// for (std::vector<VEC3>::iterator it = ++(obst->goals_.begin()) ; it != obst->goals_.end() ;
// ++it)
// {
//// glVertex3f((*it)[0], (*it)[1], (*it)[2]) ;
// glVertex3f((*it)[0], (*it)[1], obst->index) ;
//
// }
// glEnd() ;
// glLineWidth(1.0f) ;
//
// glBegin(GL_LINES) ;
// VEC3 p = obst->getPosition(0) ;
// glVertex3fv(p.data()) ;
// p = obst->goals_[obst->curGoal_];
// glVertex3fv(p.data()) ;
// glEnd() ;
}
}
......@@ -135,6 +144,9 @@ static const float sinT[5] = { 0, 0.951057, 0.587785, -0.587785, -0.951057 } ;
inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false,
bool showObstacleDist = false, bool renderPath = false, float c1=1.0f,float c2=0, float c3=0 )
{
std::cout << __FILE__ << " " << __LINE__ << " to update" << std::endl;
#ifdef SPATIAL_HASHING
const VEC3& pos = agent->pos ;
#else
......@@ -146,23 +158,49 @@ inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false,
// pos[2] -= 1000;
// Geom::intersectionPlaneRay(pl,pos,VEC3(0,0,-1),pos);
glLineWidth(1.0f) ;
VEC3 col = Utils::color_map_BCGYR(float(agent->agentNo)/float(agent->sim_->agents_.size()));
glColor3fv(col.data());
// glColor3f(c1,c2,c3) ;
glBegin(GL_POLYGON) ;
for(u