Commit 59714b06 authored by Pierre Kraemer's avatar Pierre Kraemer

Merge branch 'master' of cgogn:~jund/CGoGN_Apps/SocialAgents2

Conflicts:
	Debug/CMakeLists.txt
	Release/CMakeLists.txt
	include/env_render.h
	include/viewer.h
	src/simulator.cpp
	src/viewer.cpp
parents ff354286 ac9025fd
......@@ -2,6 +2,13 @@ cmake_minimum_required(VERSION 2.6)
SET(CMAKE_BUILD_TYPE Debug)
# FOR Qt4
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
link_directories(
......@@ -32,6 +39,7 @@ add_executable( socialAgentsD
../src/env_map.cpp
../src/agent.cpp
../src/simulator.cpp
../src/gl2ps.c
${socialAgents_moc}
${socialAgents_ui}
)
......
......@@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 2.6)
SET(CMAKE_BUILD_TYPE Release)
# FOR Qt4
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
link_directories(
${CGoGN_ROOT_DIR}/lib/Release/
)
......@@ -29,10 +35,12 @@ add_executable( socialAgents
../src/env_map.cpp
../src/agent.cpp
../src/simulator.cpp
../src/gl2ps.c
${socialAgents_moc}
${socialAgents_ui}
)
target_link_libraries( socialAgents
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} boost_thread-mt)
)
......@@ -14,6 +14,8 @@ class Agent
public:
Agent(Simulator* sim, const VEC3& position, Dart d);
VEC3 getPosition();
void updateAgentNeighbors();
void updateObstacleNeighbors();
......@@ -59,6 +61,9 @@ public:
VEC3 newVelocity_;
VEC3 prefVelocity_;
VEC3 meanSpeed_;
VEC3 meanPos_;
Simulator* sim_;
};
......
......@@ -25,6 +25,11 @@ template <typename PFP>
void generateCity(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize, unsigned int nbSquares);
template <typename PFP>
void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize);
template <typename PFP>
void generatePathToUpperStair(typename PFP::MAP& map,typename PFP::TVEC3& position, Dart dLower,Dart dUpper);
template <typename PFP>
......@@ -39,6 +44,9 @@ bool canRemoveEdgeConvex(typename PFP::MAP& map, typename PFP::TVEC3& position,
template <typename PFP>
void convexifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark);
template <typename PFP>
void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float height);
}
}
......
......@@ -110,7 +110,7 @@ void generateBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dar
dd = map.phi1(dd);
} while (dd != dRoofSmall);
dRoof = extrudeFaceAndMark<PFP>(map, position, dRoofSmall, buildingMark, height / 2.0f);
}/*
}
bool spike= rand() % 2;
if(spike)
{
......@@ -118,7 +118,7 @@ void generateBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dar
c[2] += height / 1.5f;
dRoof = Algo::Modelisation::trianguleFace<PFP>(map, dRoof);
position[dRoof] = c;
}*/
}
break;
}
}
......@@ -143,6 +143,119 @@ void generateCity(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMar
}
}
template <typename PFP>
void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize)
{
unsigned int side = 5;
std::vector<Algo::Modelisation::Polyhedron<PFP> > floors;
Algo::Modelisation::Polyhedron<PFP> * floor2 = new Algo::Modelisation::Polyhedron<PFP>(map,position);
floor2->grid_topo(side,side);
floor2->embedGrid(sideSize*side,sideSize*side);
for(unsigned int i=0;i<5;++i)
{
float floorHeight = 100;
typename PFP::VEC3 transl(0,0,floorHeight);
CellMarker m(map, VERTEX_CELL) ;
for(Dart d=map.begin();d!=map.end();map.next(d))
{
if(!m.isMarked(d))
{
m.mark(d);
position[d] += transl;
}
}
Algo::Modelisation::Polyhedron<PFP> * floor1 = new Algo::Modelisation::Polyhedron<PFP>(map,position);
floor1->grid_topo(side,side);
floor1->embedGrid(sideSize*side,sideSize*side);
Dart d1 = map.template phi<121>(floor1->getDart());
Dart d2 = map.template phi<121121121>(floor2->getDart());
generatePathToUpperStair<PFP>(map,position,d1,d2);
floor2=floor1;
}
Dart boundary;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(map.phi2(d) == d)
{
obstacleMark.mark(d);
boundary = d;
}
}
map.closeHole(boundary);
buildingMark.mark(map.phi2(boundary));
installGuardRail<PFP>(map,position,obstacleMark,buildingMark,sideSize/5.0f);
}
template <typename PFP>
void generatePathToUpperStair(typename PFP::MAP& map,typename PFP::TVEC3& position, Dart dLower,Dart dUpper)
{
if(dLower!= map.phi2(dLower) || dUpper!=map.phi2(dUpper)) {
std::cout << "generatePathToUpperStair : lower and upper stair darts must be fixpoint in phi2" << std::endl;
return;
}
//create the path
Dart dPathUp = map.newOrientedFace(4);
Dart dInBetweenUp = map.newOrientedFace(4);
Dart dInBetweenDown = map.newOrientedFace(4);
Dart dInBetweenMid = map.newOrientedFace(4);
Dart dPathDown = map.newOrientedFace(4);
//sew the path
map.sewFaces(dUpper,map.phi1(map.phi1(dPathUp)));
map.sewFaces(dPathUp,map.phi1(map.phi1(dInBetweenUp)));
map.sewFaces(dLower,map.phi1(map.phi1(dPathDown)));
map.sewFaces(dPathDown,map.phi1(map.phi1(dInBetweenDown)));
map.sewFaces(map.phi1(dInBetweenDown),map.phi_1(dInBetweenMid));
map.sewFaces(map.phi_1(dInBetweenUp),map.phi1(dInBetweenMid));
//embed the inBetween floor
float z = (position[dLower][2]+position[dUpper][2])/2.0f;
//from lower path
typename PFP::VEC3 vDown = position[map.phi1(dLower)]-position[map.phi1(map.phi1(dLower))];
position[map.phi1(map.phi1(dInBetweenDown))] = position[map.phi1(dLower)] + vDown;
position[map.phi_1(dInBetweenDown)] = position[dLower] + vDown;
position[dInBetweenDown] = position[map.phi_1(dInBetweenDown)]+vDown;
position[map.phi1(dInBetweenDown)] = position[map.phi1(map.phi1(dInBetweenDown))]+vDown;
//from upper path
position[map.phi1(map.phi1(dInBetweenUp))] = position[map.phi1(dUpper)] + vDown;
position[map.phi_1(dInBetweenUp)] = position[dUpper] + vDown;
position[dInBetweenUp] = position[map.phi_1(dInBetweenUp)]+vDown;
position[map.phi1(dInBetweenUp)] = position[map.phi1(map.phi1(dInBetweenUp))]+vDown;
Dart dd = dInBetweenUp;
do
{
position[dd][2] = z;
dd = map.phi1(dd);
} while(dd!=dInBetweenUp);
dd = dInBetweenDown;
do
{
position[dd][2] = z;
dd = map.phi1(dd);
} while(dd!=dInBetweenDown);
}
template <typename PFP>
void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark)
{
......@@ -423,6 +536,67 @@ void convexifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, C
map.mergeFaces(d);
}
template <typename PFP>
void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float height)
{
CellMarker cm(map,EDGE_CELL);
CellMarkerNoUnmark railVert(map,EDGE_CELL);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!cm.isMarked(d))
{
cm.mark(d);
if(obstacleMark.isMarked(d))
{
Dart dExt = map.newFace(4);
Dart dIn = map.newFace(4);
//mark new faces as obstacles, building and treated darts
obstacleMark.mark(dIn);
buildingMark.mark(dIn);
buildingMark.mark(dExt);
railVert.mark(map.phi_1(dIn));
railVert.mark(map.phi1(dExt));
// obstacleMark.mark(map.phi_1(dIn));
// obstacleMark.mark(map.phi1(dExt));
Dart ddExt = dExt;
Dart ddIn = dIn;
do
{
cm.mark(ddExt);
cm.mark(ddIn);
ddExt = map.phi1(ddExt);
ddIn = map.phi1(ddIn);
} while(ddExt!=dExt);
//sew the upper part of the guard rail
map.sewFaces(map.phi1(map.phi1(dExt)),dIn);
//sew the guard rail to the floor
Dart d2 = map.phi2(d);
map.unsewFaces(d);
map.sewFaces(d,dExt);
map.sewFaces(d2,map.phi1(map.phi1(dIn)));
//set the position of the guard rail
position[dIn] = position[d2];
position[dIn][2] += height;
position[map.phi2(dIn)] = position[d];
position[map.phi2(dIn)][2] += height;
}
}
}
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(railVert.isMarked(d))
{
railVert.unmark(d);
map.sewFaces(d,map.phi_1(map.alpha_1(d)));
}
}
}
}
}
......
......@@ -61,7 +61,7 @@ public :
void setAgentNeighborsAndObstacles(Agent* agent);
void agentChangeFaceThroughEdge(Agent* agent);
// void agentChangeFaceThroughEdge(Agent* agent);
void agentChangeFace(Agent* agent, Dart oldFace);
void pushAgentInCells(Agent* agent, Dart d);
......@@ -88,7 +88,7 @@ public :
CellMarker obstacleMark;
CellMarker buildingMark;
static const unsigned int nbAgentsToSubdivide = 12;
static const unsigned int nbAgentsToSubdivide = 3;
static const unsigned int nbAgentsToSimplify = 7;
std::map<unsigned int, Dart> refineCandidate;
......
......@@ -26,6 +26,10 @@ inline void renderFace(EnvMap& m, Dart& d)
inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
{
Geom::Plane3D<float> pl = Algo::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;
......@@ -39,26 +43,51 @@ inline void renderPredictionTriangle(EnvMap& m, Dart d, PFP::VEC3 p)
static const float cosT[5] = { 1, 0.309017, -0.809017, -0.809017, 0.309017 };
static const float sinT[5] = { 0, 0.951057, 0.587785, -0.587785, -0.951057 };
inline void renderAgent(Agent* agent, bool showNeighborDist = false, bool showObstacleDist = false)
inline void renderAgent(EnvMap& m, Agent* agent, bool showNeighborDist = false, bool showObstacleDist = false)
{
VEC3& pos = agent->part_.m_position;
VEC3 pos = agent->part_.m_position;
float radius = agent->radius_;
Geom::Plane3D<float> pl = Algo::Geometry::facePlane<PFP>(m.map,agent->part_.d,m.position);
pos[2] -= 1000;
Geom::intersectionPlaneRay(pl,pos,VEC3(0,0,-1),pos);
glLineWidth(1.0f);
glColor3f(1.0f,0.0f,0.0f);
glBegin(GL_POLYGON);
for(unsigned int i = 0; i < 5; ++i)
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), 0.01f);
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), pos[2]+0.01f);
glEnd();
VEC3 dir = agent->velocity_;
dir.normalize();
//draw the speed vector
// VEC3 base(0,0,1);
// VEC3 myAxisRot = base^dir;
// myAxisRot.normalize();
// float myRot = acos(base*dir);
//
// glPushMatrix();
// glTranslatef(pos[0],pos[1],pos[2]);
// glRotatef(myRot,myAxisRot[0],myAxisRot[1],myAxisRot[2]);
//
// glColor3f(0.0,0.0,0.0);
// glLineWidth(5.0f);
// glBegin(GL_LINES);
// glVertex3f(0.,0.,0.0);
// glVertex3f(0.,0.,agent->radius_*2.0f);
// glEnd();
// glPopMatrix();
if(showNeighborDist)
{
radius = sqrt(agent->neighborDistSq_);
glColor3f(0.0f,1.0f,0.0f);
glBegin(GL_LINE_LOOP);
for(unsigned int i = 0; i < 5; ++i)
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), 0.01f);
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), pos[2]+0.01f);
glEnd();
}
......@@ -68,7 +97,7 @@ inline void renderAgent(Agent* agent, bool showNeighborDist = false, bool showOb
glColor3f(0.0f,0.0f,1.0f);
glBegin(GL_LINE_LOOP);
for(unsigned int i = 0; i < 5; ++i)
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), 0.01f);
glVertex3f(pos[0] + (cosT[i] * radius), pos[1] + (sinT[i] * radius), pos[2]+0.01f);
glEnd();
}
}
......
/*
* GL2PS, an OpenGL to PostScript Printing Library
* Copyright (C) 1999-2009 C. Geuzaine
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of either:
*
* a) the GNU Library General Public License as published by the Free
* Software Foundation, either version 2 of the License, or (at your
* option) any later version; or
*
* b) the GL2PS License as published by Christophe Geuzaine, either
* version 2 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See either
* the GNU Library General Public License or the GL2PS License for
* more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library in the file named "COPYING.LGPL";
* if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
* Cambridge, MA 02139, USA.
*
* You should have received a copy of the GL2PS License with this
* library in the file named "COPYING.GL2PS"; if not, I will be glad
* to provide one.
*
* For the latest info about gl2ps and a full list of contributors,
* see http://www.geuz.org/gl2ps/.
*
* Please report all bugs and problems to <gl2ps@geuz.org>.
*/
#ifndef __GL2PS_H__
#define __GL2PS_H__
#include <stdio.h>
#include <stdlib.h>
/* Define GL2PSDLL at compile time to build a Windows DLL */
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
# if defined(_MSC_VER)
# pragma warning(disable:4115)
# pragma warning(disable:4996)
# endif
# include <windows.h>
# if defined(GL2PSDLL)
# if defined(GL2PSDLL_EXPORTS)
# define GL2PSDLL_API __declspec(dllexport)
# else
# define GL2PSDLL_API __declspec(dllimport)
# endif
# else
# define GL2PSDLL_API
# endif
#else
# define GL2PSDLL_API
#endif
#if defined(__APPLE__) || defined(HAVE_OPENGL_GL_H)
# include <OpenGL/gl.h>
#else
# include <GL/gl.h>
#endif
/* Support for compressed PostScript/PDF/SVG and for embedded PNG
images in SVG */
#if defined(HAVE_ZLIB) || defined(HAVE_LIBZ)
# define GL2PS_HAVE_ZLIB
# if defined(HAVE_LIBPNG) || defined(HAVE_PNG)
# define GL2PS_HAVE_LIBPNG
# endif
#endif
/* Version number */
#define GL2PS_MAJOR_VERSION 1
#define GL2PS_MINOR_VERSION 3
#define GL2PS_PATCH_VERSION 5
#define GL2PS_EXTRA_VERSION ""
#define GL2PS_VERSION (GL2PS_MAJOR_VERSION + \
0.01 * GL2PS_MINOR_VERSION + \
0.0001 * GL2PS_PATCH_VERSION)
#define GL2PS_COPYRIGHT "(C) 1999-2009 C. Geuzaine"
/* Output file formats (the values and the ordering are important!) */
#define GL2PS_PS 0
#define GL2PS_EPS 1
#define GL2PS_TEX 2
#define GL2PS_PDF 3
#define GL2PS_SVG 4
#define GL2PS_PGF 5
/* Sorting algorithms */
#define GL2PS_NO_SORT 1
#define GL2PS_SIMPLE_SORT 2
#define GL2PS_BSP_SORT 3
/* Message levels and error codes */
#define GL2PS_SUCCESS 0
#define GL2PS_INFO 1
#define GL2PS_WARNING 2
#define GL2PS_ERROR 3
#define GL2PS_NO_FEEDBACK 4
#define GL2PS_OVERFLOW 5
#define GL2PS_UNINITIALIZED 6
/* Options for gl2psBeginPage */
#define GL2PS_NONE 0
#define GL2PS_DRAW_BACKGROUND (1<<0)
#define GL2PS_SIMPLE_LINE_OFFSET (1<<1)
#define GL2PS_SILENT (1<<2)
#define GL2PS_BEST_ROOT (1<<3)
#define GL2PS_OCCLUSION_CULL (1<<4)
#define GL2PS_NO_TEXT (1<<5)
#define GL2PS_LANDSCAPE (1<<6)
#define GL2PS_NO_PS3_SHADING (1<<7)
#define GL2PS_NO_PIXMAP (1<<8)
#define GL2PS_USE_CURRENT_VIEWPORT (1<<9)
#define GL2PS_COMPRESS (1<<10)
#define GL2PS_NO_BLENDING (1<<11)
#define GL2PS_TIGHT_BOUNDING_BOX (1<<12)
/* Arguments for gl2psEnable/gl2psDisable */
#define GL2PS_POLYGON_OFFSET_FILL 1
#define GL2PS_POLYGON_BOUNDARY 2
#define GL2PS_LINE_STIPPLE 3
#define GL2PS_BLEND 4
/* Text alignment (o=raster position; default mode is BL):
+---+ +---+ +---+ +---+ +---+ +---+ +-o-+ o---+ +---o
| o | o | | o | | | | | | | | | | | |
+---+ +---+ +---+ +-o-+ o---+ +---o +---+ +---+ +---+
C CL CR B BL BR T TL TR */
#define GL2PS_TEXT_C 1
#define GL2PS_TEXT_CL 2
#define GL2PS_TEXT_CR 3
#define GL2PS_TEXT_B 4
#define GL2PS_TEXT_BL 5
#define GL2PS_TEXT_BR 6
#define GL2PS_TEXT_T 7
#define GL2PS_TEXT_TL 8
#define GL2PS_TEXT_TR 9
typedef GLfloat GL2PSrgba[4];
#if defined(__cplusplus)
extern "C" {
#endif
GL2PSDLL_API GLint gl2psBeginPage(const char *title, const char *producer,
GLint viewport[4], GLint format, GLint sort,
GLint options, GLint colormode,
GLint colorsize, GL2PSrgba *colormap,
GLint nr, GLint ng, GLint nb, GLint buffersize,
FILE *stream, const char *filename);
GL2PSDLL_API GLint gl2psEndPage(void);
GL2PSDLL_API GLint gl2psSetOptions(GLint options);
GL2PSDLL_API GLint gl2psGetOptions(GLint *options);
GL2PSDLL_API GLint gl2psBeginViewport(GLint viewport[4]);
GL2PSDLL_API GLint gl2psEndViewport(void);
GL2PSDLL_API GLint gl2psText(const char *str, const char *fontname,
GLshort fontsize);
GL2PSDLL_API GLint gl2psTextOpt(const char *str, const char *fontname,
GLshort fontsize, GLint align, GLfloat angle);
GL2PSDLL_API GLint gl2psSpecial(GLint format, const char *str);
GL2PSDLL_API GLint gl2psDrawPixels(GLsizei width, GLsizei height,
GLint xorig, GLint yorig,
GLenum format, GLenum type, const void *pixels);
GL2PSDLL_API GLint gl2psEnable(GLint mode);
GL2PSDLL_API GLint gl2psDisable(GLint mode);
GL2PSDLL_API GLint gl2psPointSize(GLfloat value);
GL2PSDLL_API GLint gl2psLineWidth(GLfloat value);
GL2PSDLL_API GLint gl2psBlendFunc(GLenum sfactor, GLenum dfactor);
/* undocumented */
GL2PSDLL_API GLint gl2psDrawImageMap(GLsizei width, GLsizei height,
const GLfloat position[3],
const unsigned char *imagemap);
GL2PSDLL_API const char *gl2psGetFileExtension(GLint format);
GL2PSDLL_API const char *gl2psGetFormatDescription(GLint format);
#if defined(__cplusplus)
}
#endif
#endif /* __GL2PS_H__ */
......@@ -11,7 +11,7 @@ namespace PathFinder
float pathCostSqr(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart startPos, Dart stopPos);
template <typename PFP>
std::vector<Dart> pathFindAStar(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, FunctorType& bad = FunctorType());
std::vector<Dart> pathFindAStar(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, CellMarker& bad);
}
......
......@@ -16,7 +16,7 @@ float pathCostSqr(typename PFP::MAP& map,const typename PFP::TVEC3& position, Da
}
template <typename PFP>
std::vector<Dart> pathFindAStar(typename PFP::MAP& map,const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, FunctorType& bad)
std::vector<Dart> pathFindAStar(typename PFP::MAP& map,const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, CellMarker& bad)
{
std::vector<Dart> path;
......@@ -35,7 +35,7 @@ std::vector<Dart> pathFindAStar(typename PFP::MAP& map,const typename PFP::TVEC3
do {
ddd = map.alpha1(ddd);
if(ddd!=dd) {
if(!map.foreach_dart_of_face(ddd,bad) && tablePred[ddd]==EMBNULL) {
if(!bad.isMarked(ddd) && tablePred[ddd]==EMBNULL) {
//evaluate their cost and push them in the vector to dev
if(tablePred[ddd]==EMBNULL)
tablePred[ddd]=toDev;
......@@ -60,9 +60,7 @@ std::vector<Dart> pathFindAStar(typename PFP::MAP& map,const typename PFP::TVEC3
//if path found : from start to stop -> push all predecessors
if(map.sameOrientedFace(startPos,toDev))
{
std::cout << "found" << std::endl;
Dart toPush=startPos;
std::cout << tablePred[startPos] << std::endl;
do {
path.push_back(toPush);
toPush = tablePred[toPush];
......
......@@ -28,7 +28,7 @@ public:
void doStep();
void setupScenario();
// void addPathsToAgents();
void addPathsToAgents();
bool importAgents(std::string filename);
bool exportAgents(std::string filename);
......
......@@ -21,8 +21,11 @@ inline float det2D(const VEC3& vector1, const VEC3& vector2)
return vector1[0] * vector2[1] - vector1[1] * vector2[0];
}
inline float distSqPointLineSegment(const VEC3& a1, const VEC3& b1, const VEC3& c1)
inline float distSqPointLineSegment( VEC3 a1, VEC3 b1, const VEC3& c1)
{
a1[2] = 0;
b1[2] = 0;
VEC3 a1b1 = b1 - a1;
VEC3 a1c1 = c1 - a1;
const float r = (a1c1 * a1b1) / a1b1.norm2();
......@@ -43,16 +46,6 @@ inline float distSqPointLineSegment(const VEC3& a1, const VEC3& b1, const VEC3&
}
}
inline void projectPointOnLine(const VEC3& p, const VEC3& p1, const VEC3& p2, VEC3& proj)
{
VEC3 v = p - p1;
VEC3 seg = p2 - p1;
seg.normalize();
proj = p1 + seg * (v * seg);
}
inline float leftOf(const VEC3& a, const VEC3& b, const VEC3& c)
{
return det2D(a - c, b - a);
......
......@@ -30,8 +30,10 @@
#include "simulator.h"
#include "env_render.h"
#include "gl2ps.h"
#include "Algo/Geometry/boundingbox.h"
#include "Algo/Export/exportPov.h"
#include "Utils/GLSLShader.h"
#include "Algo/Render/GL1/map_glRender.h"
......@@ -53,7 +55,7 @@ public:
void cb_initGL() ;
void cb_redraw() ;
// bool exportScenePov(PFP::MAP& map, PFP::TVEC3& position, const std::string& filename, PFP::VEC3 cameraPos, PFP::VEC3 cameraLook, PFP::VEC3 translate, float angle_X, float angle_Y, float angle_Z,const FunctorSelect& good = SelectorTrue());
bool exportScenePo