Création d'un compte pour un collaborateur extérieur au laboratoire depuis l'intranet ICube : https://intranet.icube.unistra.fr/fr/labs/member/profile

Commit 5da65bb7 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

update CMakeLists..

parent 7c353711
......@@ -2,10 +2,10 @@ cmake_minimum_required(VERSION 2.8)
project(SocialAgents)
#set( CMAKE_VERBOSE_MAKEFILE 1 )
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN CACHE STRING "CGoGN root dir")
include(${CGoGN_ROOT_DIR}/apps_cmake.txt)
SET(CGoGN_ROOT_DIR ${CMAKE_SOURCE_DIR}/../../CGoGN)
include(${CGoGN_ROOT_DIR}/build/apps_cmake.txt)
add_subdirectory(Release)
add_subdirectory(Debug)
add_subdirectory(${CMAKE_SOURCE_DIR}/Release Release)
IF (NOT WIN32)
add_subdirectory(${CMAKE_SOURCE_DIR}/Debug Debug)
ENDIF (NOT WIN32)
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_BUILD_TYPE Debug)
# FOR Qt4
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Debug ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pg")
link_directories(
${CGoGN_ROOT_DIR}/lib/Debug/
${CGoGN_ROOT_DIR}/lib/Release/
)
# define includes path
include_directories(
../include
/usr/include/libxml2/
${CGoGN_ROOT_DIR}/include
${CGoGN_ROOT_DIR}/ThirdParty/Numerical
${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig
${CGoGN_ROOT_DIR}/ThirdParty/gzstream
${CGoGN_ROOT_DIR}/ThirdParty/Zinri
${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM
${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
${CGoGN_ROOT_DIR}/ThirdParty/glm
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
#define exec to compile
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -p")
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
QT4_WRAP_CPP( socialAgents_moc ../include/viewer.h )
add_executable( socialAgentsD
......@@ -45,6 +31,4 @@ add_executable( socialAgentsD
${socialAgents_ui}
)
target_link_libraries( socialAgentsD
${CGoGN_LIBS_D} ${COMMON_LIBS} ${QT_LIBRARIES} boost_thread-mt)
target_link_libraries( socialAgentsD ${CGoGN_LIBS_D} ${COMMON_LIBS} )
cmake_minimum_required(VERSION 2.6)
cmake_minimum_required(VERSION 2.8)
SET(CMAKE_BUILD_TYPE Release)
# FOR Qt4
FIND_PACKAGE(Qt4 REQUIRED)
SET(QT_USE_QTOPENGL TRUE)
INCLUDE(${QT_USE_FILE})
ADD_DEFINITIONS(${QT_DEFINITIONS})
IF(WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ELSE (WIN32)
link_directories( ${CGoGN_ROOT_DIR}/lib/Release )
ENDIF (WIN32)
link_directories(
${CGoGN_ROOT_DIR}/lib/Release/
)
# define includes path
include_directories(
../include
/usr/include/libxml2/
${CGoGN_ROOT_DIR}/include
${CGoGN_ROOT_DIR}/ThirdParty/Numerical
${CGoGN_ROOT_DIR}/ThirdParty/Numerical/UFconfig
${CGoGN_ROOT_DIR}/ThirdParty/gzstream
${CGoGN_ROOT_DIR}/ThirdParty/Zinri
${CGoGN_ROOT_DIR}/ThirdParty/OpenCTM
${CGoGN_ROOT_DIR}/ThirdParty/Assimp/include
${CGoGN_ROOT_DIR}/ThirdParty/glm
${COMMON_INCLUDES}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
#define exec to compile
QT4_WRAP_UI( socialAgents_ui ../include/socialAgents.ui )
QT4_WRAP_CPP( socialAgents_moc ../include/viewer.h )
add_executable( socialAgents
......@@ -41,6 +29,4 @@ add_executable( socialAgents
${socialAgents_ui}
)
target_link_libraries( socialAgents
${CGoGN_LIBS_R} ${COMMON_LIBS} ${QT_LIBRARIES} boost_thread-mt)
target_link_libraries( socialAgents ${CGoGN_LIBS_R} ${COMMON_LIBS} )
#include "Algo/Modelisation/subdivision.h"
#include "Geometry/inclusion.h"
#include "Topology/generic/traversorCell.h"
namespace CGoGN
{
......@@ -7,6 +8,20 @@ namespace CGoGN
namespace CityGenerator
{
template <typename PFP>
bool notAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildingMark)
{
Dart dd = d;
do
{
if(buildingMark.isMarked(dd))
return false;
dd = map.phi1(dd);
} while(dd != d);
return true;
}
template <typename PFP>
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildingMark)
{
......@@ -30,14 +45,13 @@ Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, typenam
Dart boundary;
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(map.phi2(d) == d)
if(map.isBoundaryMarked(map.phi2(d)))
{
obstacleMark.mark(d);
boundary = d;
boundary = map.phi2(d);
}
}
map.closeHole(boundary);
buildingMark.mark(map.phi2(boundary));
buildingMark.mark(boundary);
prim.embedGrid(sideLength * cX, sideLength * cY);
......@@ -167,43 +181,55 @@ bool animateCity(EnvMap* envMap)
CellMarker& buildingMark = envMap->buildingMark;
std::vector<Dart>& newBuildings = envMap->newBuildings;
unsigned int state=rand()%10;
if(state<2)
unsigned int state = rand() % 10;
if(state < 2)
{
map.setCurrentLevel(0) ;
//generate new building
bool found=false;
Dart d(rand()%map.getNbDarts());
Dart d(rand() % map.getNbDarts());
if(!map.isDartValid(d))
map.next(d);
while(d != map.end() && map.getDartLevel(d) > 0)
map.next(d);
if(!buildingMark.isMarked(d) && agents[d].size() == 0 && agentNeighbors[d].size() == 0 && notDiagonalAdjacentToAnObstacle<PFP>(map,d,obstacleMark))
found=true;
if(found)
if(d != map.end())
{
d = generateBuilding<PFP>(envMap, d, 2.0f, 0);
newBuildings.push_back(d);
return true;
if(
!buildingMark.isMarked(d) &&
agents[d].size() == 0 &&
agentNeighbors[d].size() == 0 &&
!map.faceIsSubdivided(d) &&
notAdjacentToAnObstacle<PFP>(map,d,obstacleMark) &&
notDiagonalAdjacentToAnObstacle<PFP>(map,d,obstacleMark)
)
{
map.setCurrentLevel(map.getMaxLevel()) ;
d = generateBuilding<PFP>(envMap, d, 2.0f, 0);
newBuildings.push_back(d);
return true;
}
}
map.setCurrentLevel(map.getMaxLevel()) ;
}
else if(newBuildings.size()>0)
else if(state < 6 && newBuildings.size() > 0)
{
//take a newBuilding and make it higher
state = rand()%newBuildings.size();
Dart d = newBuildings[state];
//decide if we create a new floor, or just make it higher
unsigned int typeOfUpdate = rand()%10;
if(typeOfUpdate<9)
if(typeOfUpdate < 9)
{
Dart dd=d;
Dart dd = d;
do
{
position[dd][2] += 2.0f;
dd = map.phi1(dd);
} while(dd!=d);
} while(dd != d);
if(position[dd][2]>((10+rand()%10)*10.0f))
if(position[dd][2] > ((10+rand()%10)*10.0f))
newBuildings.erase(newBuildings.begin()+state);
}
else
......@@ -215,14 +241,13 @@ bool animateCity(EnvMap* envMap)
{
position[dd] = position[dd] + (c-position[dd])/3.0f;
dd = map.phi1(dd);
} while (dd!=dRoofSmall);
} while (dd != dRoofSmall);
// Dart dRoof = Algo::Modelisation::extrudeFace<PFP>(map,position,dRoofSmall,2.0f);
Dart dRoof = extrudeFaceAndMark<PFP>(map,position,dRoofSmall,buildingMark,2.0f);
Dart dRoof = extrudeFaceAndMark<PFP>(map, position, dRoofSmall, buildingMark, 2.0f);
newBuildings.erase(newBuildings.begin()+state);
newBuildings.push_back(dRoof);
}
}
return false;
......
......@@ -24,9 +24,9 @@
#include <iostream>
#include "Utils/qtSimple.h"
#include "Utils/Qt/qtSimple.h"
#include "ui_socialAgents.h"
#include "Utils/qtui.h"
#include "Utils/Qt/qtui.h"
#include "simulator.h"
#include "env_render.h"
......
......@@ -264,11 +264,10 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init()
{
float sideSize = 70.0f;
unsigned int nbSquares = 24;
unsigned int nbSquares = 20;
CityGenerator::generateGrid<PFP>(map, position, nbSquares, nbSquares, sideSize, obstacleMark, buildingMark);
// CityGenerator::generateCorridor<PFP>(map, position, obstacleMark, buildingMark, 50, nbSquares);
// CityGenerator::generateCity<PFP>(map, position, obstacleMark, buildingMark, sideSize, nbSquares);
// CityGenerator::generateCity<PFP>(this, sideSize, nbSquares);
// CityGenerator::generateTrianGrid<PFP>(map, position, nbSquares, nbSquares, sideSize, obstacleMark, buildingMark);
// CityGenerator::generateMall<PFP>(map, position, obstacleMark, buildingMark, sideSize);
......@@ -391,18 +390,18 @@ void EnvMap::pushObstacleInCells(Obstacle* o, Dart d)
// obstvect[map.phi<12>(d)].push_back(o);
// obstvect[map.phi2(map.phi_1(d))].push_back(o);
Dart dd = d;
do
{
Dart ddd = map.alpha1(map.alpha1(dd));
while(ddd != dd)
{
obstvect[ddd].push_back(o);
ddd = map.alpha1(ddd);
}
dd = map.phi1(dd);
} while(dd != d);
// Dart dd = d;
// do
// {
// Dart ddd = map.alpha1(map.alpha1(dd));
// while(ddd != dd)
// {
// obstvect[ddd].push_back(o);
// ddd = map.alpha1(ddd);
// }
//
// dd = map.phi1(dd);
// } while(dd != d);
}
void EnvMap::popObstacleInCells(Obstacle* o, Dart d)
......@@ -415,17 +414,17 @@ void EnvMap::popObstacleInCells(Obstacle* o, Dart d)
// removeElementFromVector<Obstacle* >(obstvect[map.phi<12>(d)],o);
// removeElementFromVector<Obstacle* >(obstvect[map.phi2(map.phi_1(d))],o);
Dart dd = d;
do
{
Dart ddd = map.alpha1(map.alpha1(dd));
while(ddd != dd)
{
removeElementFromVector<Obstacle* >(obstvect[ddd], o);
ddd = map.alpha1(ddd);
}
dd = map.phi1(dd);
} while(dd != d);
// Dart dd = d;
// do
// {
// Dart ddd = map.alpha1(map.alpha1(dd));
// while(ddd != dd)
// {
// removeElementFromVector<Obstacle* >(obstvect[ddd], o);
// ddd = map.alpha1(ddd);
// }
// dd = map.phi1(dd);
// } while(dd != d);
}
//void EnvMap::agentChangeFaceThroughEdge(Agent* agent)
......
......@@ -9,7 +9,7 @@ Simulator::Simulator() : timeStep_(0.2f), globalTime_(0.0f), nbSteps_(0)
std::cout << "setup scenario" << std::endl;
// importAgents("myAgents.pos");
setupScenario(5000);
setupScenario(1000);
// setupCircleScenario(1000);
// setupCityScenario(
// -1.0f * (24 * (70.0f / 2.0f) - 10),
......@@ -20,7 +20,7 @@ Simulator::Simulator() : timeStep_(0.2f), globalTime_(0.0f), nbSteps_(0)
// addPathsToAgents();
setupMovingObstacle(1);
// setupMovingObstacle(1);
unsigned nbAgents = agents_.size();
......@@ -52,14 +52,14 @@ void Simulator::doStep()
envMap_.map.setCurrentLevel(0);
for (unsigned int i = 0; i < movingObstacles_.size(); ++i)
{
movingObstacles_[i]->updateAgentNeighbors();
movingObstacles_[i]->computePrefVelocity();
movingObstacles_[i]->computeNewVelocity();
movingObstacles_[i]->update();
}
// for (unsigned int i = 0; i < movingObstacles_.size(); ++i)
// {
// movingObstacles_[i]->updateAgentNeighbors();
// movingObstacles_[i]->computePrefVelocity();
// movingObstacles_[i]->computeNewVelocity();
//
// movingObstacles_[i]->update();
// }
for (unsigned int i = 0; i < agents_.size(); ++i)
{
......@@ -105,7 +105,7 @@ void Simulator::doStep()
}
// envMap_.updateMap();
envMap_.updateMap();
globalTime_ += timeStep_;
++nbSteps_;
......@@ -206,13 +206,8 @@ void Simulator::setupScenario(unsigned int nbMaxAgent)
Dart d = envMap_.map.begin();
CellMarker filled(envMap_.map,FACE);
<<<<<<< HEAD
unsigned int nbx = 3;
unsigned int nby = 3;
=======
unsigned int nbx = 1;
unsigned int nby = 1;
>>>>>>> c43650427b5b9aecc74fad3c6e3ebb2218f6b7a6
unsigned int nbx = 5;
unsigned int nby = 5;
unsigned int bMax = nbx*nby>0 ? nbMaxAgent / (nbx*nby) : nbMaxAgent;
......@@ -262,7 +257,6 @@ void Simulator::setupScenario(unsigned int nbMaxAgent)
void Simulator::addPathToCorner()
{
for(unsigned int i = 0; i < agents_.size(); ++i)
{
agents_[i]->goals_.clear();
......
......@@ -351,23 +351,25 @@ void SocialAgents::animate()
// if(sim.nbSteps_ % sim.nbStepsPerUnit_ == 0 && (sim.nbSteps_ / sim.nbStepsPerUnit_) % 10 == 0)
// std::cout << round(sim.globalTime_) << " " << sim.envMap_.mapMemoryCost() << std::endl;
// CityGenerator::animateCity<PFP>(&sim.envMap_) ;
// if(CityGenerator::animateCity<PFP>(&sim.envMap_))
// sim.addPathToCorner();
// sim.addPathsToAgents();
std::cout << "t : " << sim.globalTime_ << std::endl;
// std::cout << "t : " << sim.globalTime_ << std::endl;
timeval startTime;
gettimeofday(&startTime, NULL);
timeval endTime;
long seconds, nseconds;
// timeval startTime;
// gettimeofday(&startTime, NULL);
// timeval endTime;
// long seconds, nseconds;
sim.doStep();
gettimeofday(&endTime, NULL);
seconds = endTime.tv_sec - startTime.tv_sec;
nseconds = endTime.tv_usec - startTime.tv_usec;
elapsedTime += (seconds + nseconds/1000000.0) ;
// gettimeofday(&endTime, NULL);
// seconds = endTime.tv_sec - startTime.tv_sec;
// nseconds = endTime.tv_usec - startTime.tv_usec;
//
// elapsedTime += (seconds + nseconds/1000000.0) ;
// if(sim.globalTime_ - int(sim.globalTime_) == 0.0f && int(sim.globalTime_) % 1500 == 0)
// {
......
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