Commit 0f0720c7 authored by Pierre Kraemer's avatar Pierre Kraemer
Browse files

modernizr

parent 65097e59
......@@ -11,16 +11,16 @@ namespace CityGenerator
{
template <typename PFP>
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildingMark);
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<FACE>& buildingMark);
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, typename PFP::TVEC3& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker& obstacleMark, CellMarker& buildingMark);
Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark);
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& obstacleMark, CellMarker& buildingMark);
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark);
template <typename PFP>
Dart extrudeFaceAndMark(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d, CellMarker& buildingMark, float height);
Dart extrudeFaceAndMark(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart d, CellMarker<FACE>& buildingMark, float height);
#ifndef SPATIAL_HASHING
template <typename PFP>
......@@ -34,33 +34,33 @@ template <typename PFP>
void generateCity(EnvMap* envMap, float sideSize, unsigned int nbSquares);
template <typename PFP>
void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize);
void generateMall(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float sideSize);
template <typename PFP>
void generatePathToUpperStair(typename PFP::MAP& map,typename PFP::TVEC3& position, Dart dLower,Dart dUpper);
void generatePathToUpperStair(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& position, Dart dLower,Dart dUpper);
/*******************************************************************************/
template <typename PFP>
void generatePlanet(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float radius, unsigned int nbSquares);
void generatePlanet(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float radius, unsigned int nbSquares);
/*******************************************************************************/
template <typename PFP>
void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position);
void simplifyFreeSpace(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position);
template <typename PFP>
bool isAnEar(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart dd, float& area);
bool isAnEar(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart dd, float& area);
template <typename PFP>
bool canRemoveEdgeConvex(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d, CellMarker& obstacleMark);
bool canRemoveEdgeConvex(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart d, CellMarker<EDGE>& obstacleMark);
template <typename PFP>
void convexifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark);
void convexifyFreeSpace(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark);
template <typename PFP>
void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float height);
void installGuardRail(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float height);
}
......@@ -68,4 +68,3 @@ void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, Cell
#include "env_generator.hpp"
#endif
......@@ -10,7 +10,7 @@ namespace CityGenerator
{
template <typename PFP>
bool notAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildingMark)
bool notAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<FACE>& buildingMark)
{
Dart dd = d;
do
......@@ -24,7 +24,7 @@ bool notAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildin
}
template <typename PFP>
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker& buildingMark)
bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker<FACE>& buildingMark)
{
Dart dd = d;
do
......@@ -38,7 +38,7 @@ bool notDiagonalAdjacentToAnObstacle(typename PFP::MAP& map, Dart d, CellMarker&
}
template <typename PFP>
Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, typename PFP::TVEC3& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker& obstacleMark, CellMarker& buildingMark)
Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position);
prim.grid_topo(cX, cY);
......@@ -60,7 +60,7 @@ Algo::Modelisation::Polyhedron<PFP> generateGrid(typename PFP::MAP& map, typenam
}
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& obstacleMark, CellMarker& buildingMark)
Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, unsigned int cX, unsigned int cY, float sideLength, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position);
prim.grid_topo(cX, cY);
......@@ -158,7 +158,7 @@ Algo::Modelisation::Polyhedron<PFP> generateTrianGrid(typename PFP::MAP& map, ty
}
template <typename PFP>
Dart extrudeFaceAndMark(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d, CellMarker& buildingMark, float height)
Dart extrudeFaceAndMark(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart d, CellMarker<FACE>& buildingMark, float height)
{
Dart dRoof = Algo::Modelisation::extrudeFace<PFP>(map, position, d, height);
buildingMark.mark(dRoof);
......@@ -176,11 +176,11 @@ template <typename PFP>
bool animateCity(EnvMap* envMap)
{
typename PFP::MAP& map = envMap->map;
typename PFP::TVEC3& position = envMap->position;
VertexAttribute<typename PFP::VEC3>& position = envMap->position;
typename PFP::TAB_AGENTVECT& agents = envMap->agentvect;
typename PFP::TAB_AGENTVECT& agentNeighbors = envMap->neighborAgentvect;
CellMarker& obstacleMark = envMap->obstacleMark;
CellMarker& buildingMark = envMap->buildingMark;
CellMarker<EDGE>& obstacleMark = envMap->obstacleMark;
CellMarker<FACE>& buildingMark = envMap->buildingMark;
std::vector<Dart>& newBuildings = envMap->newBuildings;
unsigned int state = rand() % 10;
......@@ -257,19 +257,19 @@ bool animateCity(EnvMap* envMap)
#endif
//template <typename PFP>
//Dart generateBuilding(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d, float height, unsigned int buildingType, CellMarker& obstacleMark, CellMarker& buildingMark)
//Dart generateBuilding(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart d, float height, unsigned int buildingType, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
//template <typename PFP>
//void generateCity(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize, unsigned int nbSquares)
//void generateCity(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float sideSize, unsigned int nbSquares)
template <typename PFP>
Dart generateBuilding(EnvMap* envMap, Dart d, float height, unsigned int buildingType)
{
typename PFP::MAP& map = envMap->map;
typename PFP::TVEC3& position = envMap->position;
CellMarker& obstacleMark = envMap->obstacleMark;
CellMarker& buildingMark = envMap->buildingMark;
VertexAttribute<typename PFP::VEC3>& position = envMap->position;
CellMarker<EDGE>& obstacleMark = envMap->obstacleMark;
CellMarker<FACE>& buildingMark = envMap->buildingMark;
// mark the face as obstacle before extrusion
Dart dd = d;
......@@ -378,9 +378,9 @@ template <typename PFP>
void generateCity(EnvMap* envMap, float sideSize, unsigned int nbSquares)
{
typename PFP::MAP& map = envMap->map;
typename PFP::TVEC3& position = envMap->position;
CellMarker& obstacleMark = envMap->obstacleMark;
CellMarker& buildingMark = envMap->buildingMark;
VertexAttribute<typename PFP::VEC3>& position = envMap->position;
CellMarker<EDGE>& obstacleMark = envMap->obstacleMark;
CellMarker<FACE>& buildingMark = envMap->buildingMark;
unsigned int nbBuilding = 1000;
float height = sideSize / 2.0f;
......@@ -410,7 +410,7 @@ void generateCity(EnvMap* envMap, float sideSize, unsigned int nbSquares)
}
template <typename PFP>
void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float sideSize)
void generateMall(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float sideSize)
{
unsigned int side = 5;
std::vector<Algo::Modelisation::Polyhedron<PFP> > floors;
......@@ -424,7 +424,7 @@ void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMark
{
float floorHeight = 100;
typename PFP::VEC3 transl(0,0,floorHeight);
CellMarker m(map, VERTEX) ;
CellMarker<VERTEX> m(map) ;
for(Dart d=map.begin();d!=map.end();map.next(d))
{
......@@ -464,7 +464,7 @@ void generateMall(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMark
}
template <typename PFP>
void generatePathToUpperStair(typename PFP::MAP& map,typename PFP::TVEC3& position, Dart dLower,Dart dUpper)
void generatePathToUpperStair(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& 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;
......@@ -523,7 +523,7 @@ void generatePathToUpperStair(typename PFP::MAP& map,typename PFP::TVEC3& positi
}
template <typename PFP>
void generatePlanet(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float radius, unsigned int nbSquares)
void generatePlanet(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float radius, unsigned int nbSquares)
{
Algo::Modelisation::Polyhedron<PFP> prim(map, position);
prim.cylinder_topo(nbSquares, nbSquares, true, true);
......@@ -532,19 +532,19 @@ void generatePlanet(typename PFP::MAP& map, typename PFP::TVEC3& position, CellM
}
template <typename PFP>
void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark)
void simplifyFreeSpace(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
{
typedef typename PFP::VEC3 VEC3;
typedef std::multimap<float, Dart> VEC_D_A;
AutoAttributeHandler<float> tableArea(map, FACE);
AutoAttributeHandler<CGoGN::NoMathIONameAttribute<VEC_D_A::iterator> > tableIt(map, EDGE);
FaceAutoAttribute<float> tableArea(map);
EdgeAutoAttribute<CGoGN::NoMathIONameAttribute<VEC_D_A::iterator> > tableIt(map);
VEC_D_A orderedD;
// compute all heuristic and construct multimap
Algo::Geometry::computeAreaFaces<PFP>(map, position, tableArea);
CellMarker eM(map, EDGE);
CellMarker<EDGE> eM(map);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!eM.isMarked(d) && !obstacleMark.isMarked(d) && !buildingMark.isMarked(d))
......@@ -704,7 +704,7 @@ void simplifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, Ce
}
template <typename PFP>
bool isAnEar(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart dd, float& area)
bool isAnEar(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart dd, float& area)
{
typedef typename PFP::VEC3 VEC3;
......@@ -738,7 +738,7 @@ bool isAnEar(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart dd, flo
}
template <typename PFP>
bool canRemoveEdgeConvex(typename PFP::MAP& map, typename PFP::TVEC3& position, Dart d, CellMarker& obstacleMark)
bool canRemoveEdgeConvex(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, Dart d, CellMarker<EDGE>& obstacleMark)
{
typedef typename PFP::VEC3 VEC3;
......@@ -765,12 +765,12 @@ 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)
void convexifyFreeSpace(typename PFP::MAP& map, VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark)
{
typedef typename PFP::VEC3 VEC3;
float area;
CellMarker m(map, FACE);
CellMarker<FACE> m(map);
for(Dart d = map.begin();d != map.end(); map.next(d))
{
......@@ -834,10 +834,10 @@ void convexifyFreeSpace(typename PFP::MAP& map, typename PFP::TVEC3& position, C
}
template <typename PFP>
void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, float height)
void installGuardRail(typename PFP::MAP& map,VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, float height)
{
CellMarker cm(map,EDGE);
CellMarkerNoUnmark railVert(map,EDGE);
CellMarker<EDGE> cm(map);
CellMarkerNoUnmark<EDGE> railVert(map);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!cm.isMarked(d))
......@@ -898,4 +898,3 @@ void installGuardRail(typename PFP::MAP& map,typename PFP::TVEC3& position, Cell
}
}
......@@ -39,8 +39,8 @@ struct PFP: public PFP_STANDARD
typedef std::vector<Obstacle*> OBSTACLES;
typedef NoMathIONameAttribute<AGENTS> AGENTVECT;
typedef NoMathIONameAttribute<OBSTACLES> OBSTACLEVECT;
typedef AttributeHandler<AGENTVECT> TAB_AGENTVECT;
typedef AttributeHandler<OBSTACLEVECT> TAB_OBSTACLEVECT;
typedef AttributeHandler<AGENTVECT, FACE> TAB_AGENTVECT;
typedef AttributeHandler<OBSTACLEVECT, FACE> TAB_OBSTACLEVECT;
typedef NoMathIONameAttribute<std::pair<bool,bool> > BOOLATTRIB;
};
......@@ -91,35 +91,35 @@ public :
PFP::MAP map;
PFP::TVEC3 position;
PFP::TVEC3 normal;
VertexAttribute<VEC3> position;
VertexAttribute<VEC3> normal;
PFP::MAP mapScenary;
PFP::TVEC3 positionScenary;
PFP::TVEC3 normalScenary;
CellMarker obstacleMarkS;
CellMarker buildingMarkS;
VertexAttribute<VEC3> positionScenary;
VertexAttribute<VEC3> normalScenary;
CellMarker<EDGE> obstacleMarkS;
CellMarker<FACE> buildingMarkS;
std::vector<Dart> newBuildings;
#ifndef SPATIAL_HASHING
AttributeHandler<PFP::BOOLATTRIB> subdivisableFace;
AttributeHandler<PFP::BOOLATTRIB, FACE> subdivisableFace;
PFP::TAB_AGENTVECT agentvect;
PFP::TAB_AGENTVECT neighborAgentvect;
PFP::TAB_OBSTACLEVECT obstvect;
#endif
CellMarker obstacleMark;
CellMarker buildingMark;
CellMarker pedWayMark;
CellMarker<EDGE> obstacleMark;
CellMarker<FACE> buildingMark;
CellMarker<FACE> pedWayMark;
#ifndef SPATIAL_HASHING
static const unsigned int nbAgentsToSubdivide = 5;
static const unsigned int nbAgentsToSimplify = 4;
CellMarker refineMark;
CellMarker coarsenMark;
CellMarker<FACE> refineMark;
CellMarker<FACE> coarsenMark;
std::vector<Dart> refineCandidate;
std::vector<Dart> coarsenCandidate;
#endif
......
......@@ -8,7 +8,7 @@ namespace ExportScene
{
template <typename PFP>
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, std::string& filename);
bool exportSceneToFile(typename PFP::MAP& map,const VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, std::string& filename);
}
......
......@@ -7,7 +7,7 @@ namespace ExportScene
{
template <typename PFP>
bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& position, CellMarker& obstacleMark, CellMarker& buildingMark, std::string& filename)
bool exportSceneToFile(typename PFP::MAP& map,const VertexAttribute<typename PFP::VEC3>& position, CellMarker<EDGE>& obstacleMark, CellMarker<FACE>& buildingMark, std::string& filename)
{
std::ofstream out(filename.c_str(), std::ios::out);
if (!out.good())
......@@ -16,7 +16,7 @@ bool exportSceneToFile(typename PFP::MAP& map,const typename PFP::TVEC3& positio
return false;
}
CellMarker f(map, FACE);
CellMarker<FACE> f(map);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
......
......@@ -8,10 +8,10 @@ namespace PathFinder
{
template <typename PFP>
float pathCostSqr(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, CellMarker& bad);
float pathCostSqr(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, Dart startPos, Dart stopPos, CellMarker<FACE>& bad);
template <typename PFP>
std::vector<Dart> pathFindAStar(typename PFP::MAP& map, const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, CellMarker& bad);
std::vector<Dart> pathFindAStar(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, Dart startPos, Dart stopPos, CellMarker<FACE>& bad);
}
......
......@@ -10,7 +10,7 @@ namespace PathFinder
template <typename PFP>
float pathCostSqr(typename PFP::MAP& map,const typename PFP::TVEC3& position, Dart startPos, Dart stopPos, CellMarker& bad)
float pathCostSqr(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, Dart startPos, Dart stopPos, CellMarker<FACE>& bad)
{
// float penalty=100000000.0f;
// Dart dd = startPos;
......@@ -29,16 +29,16 @@ 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, CellMarker& bad)
std::vector<Dart> pathFindAStar(typename PFP::MAP& map, const VertexAttribute<typename PFP::VEC3>& position, Dart startPos, Dart stopPos, CellMarker<FACE>& bad)
{
std::vector<Dart> path;
AutoAttributeHandler< float > tablePathCost(map,FACE);
AutoAttributeHandler< Dart > tablePred(map,FACE);
FaceAutoAttribute< float > tablePathCost(map);
FaceAutoAttribute< Dart > tablePred(map);
std::multimap<float,Dart> vToDev;
CellMarker m(map,FACE);
CellMarker<FACE> m(map);
vToDev.insert(std::make_pair(0, stopPos));
......
......@@ -26,7 +26,7 @@
#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"
......@@ -59,7 +59,7 @@ public:
#ifndef SPATIAL_HASHING
void exportInfoFace(std::ofstream& out, Dart d);
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 exportScenePov(PFP::MAP& map, VertexAttribute<VEC3>& 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());
#endif
void cb_keyPress(int keycode) ;
......
......@@ -15,15 +15,15 @@
using namespace CGoGN;
EnvMap::EnvMap() :
obstacleMarkS(mapScenary, EDGE),
buildingMarkS(mapScenary, FACE),
obstacleMark(map, EDGE),
buildingMark(map, FACE),
pedWayMark(map, FACE)
obstacleMarkS(mapScenary),
buildingMarkS(mapScenary),
obstacleMark(map),
buildingMark(map),
pedWayMark(map)
#ifndef SPATIAL_HASHING
,
refineMark(map, FACE),
coarsenMark(map, FACE)
refineMark(map),
coarsenMark(map)
#else
,
origin(70 * 24 / 2.0, 70 * 24 / 2.0, 0.0),
......@@ -40,14 +40,14 @@ EnvMap::EnvMap() :
ht_obstacles(1024)
#endif
{
position = map.addAttribute<PFP::VEC3>(VERTEX, "position");
normal = map.addAttribute<PFP::VEC3>(VERTEX, "normal");
position = map.addAttribute<VEC3, VERTEX>("position");
normal = map.addAttribute<VEC3, VERTEX>("normal");
#ifndef SPATIAL_HASHING
agentvect = map.addAttribute<PFP::AGENTVECT>(FACE, "agents");
neighborAgentvect = map.addAttribute<PFP::AGENTVECT>(FACE, "neighborAgents");
obstvect = map.addAttribute<PFP::OBSTACLEVECT>(FACE, "obstacles");
subdivisableFace = map.addAttribute<PFP::BOOLATTRIB>(FACE, "subdivisableFace");
agentvect = map.addAttribute<PFP::AGENTVECT, FACE>("agents");
neighborAgentvect = map.addAttribute<PFP::AGENTVECT, FACE>("neighborAgents");
obstvect = map.addAttribute<PFP::OBSTACLEVECT, FACE>("obstacles");
subdivisableFace = map.addAttribute<PFP::BOOLATTRIB, FACE>("subdivisableFace");
refineCandidate.reserve(100);
coarsenCandidate.reserve(100);
......@@ -56,7 +56,7 @@ EnvMap::EnvMap() :
void EnvMap::markPedWay()
{
CellMarker treat(map,FACE);
CellMarker<FACE> treat(map);
for(Dart d = map.begin();d != map.end(); map.next(d))
{
if(!treat.isMarked(d))
......@@ -109,10 +109,10 @@ void EnvMap::markPedWay()
unsigned int EnvMap::mapMemoryCost()
{
return (map.getAttributeContainer(DART)).memorySize()
+ (map.getAttributeContainer(VERTEX)).memorySize()
+ (map.getAttributeContainer(EDGE)).memorySize()
+ (map.getAttributeContainer(FACE)).memorySize();
return (map.getAttributeContainer<DART>()).memorySize()
+ (map.getAttributeContainer<VERTEX>()).memorySize()
+ (map.getAttributeContainer<EDGE>()).memorySize()
+ (map.getAttributeContainer<FACE>()).memorySize();
}
void EnvMap::scale(float scaleVal)
......@@ -149,9 +149,9 @@ void EnvMap::subdivideAllToMaxLevel()
bool subdiv;
do
{
subdiv=false;
subdiv = false;
{
CellMarker subd(map,FACE);
CellMarker<FACE> subd(map,FACE);
for(Dart d = map.begin(); d!= map.end(); map.next(d))
{
if(!subd.isMarked(d))
......@@ -169,9 +169,9 @@ void EnvMap::subdivideAllToMaxLevel()
Dart fd = old ;
do
{
PFP::VEC3& p = position[fd] ;
PFP::VEC3 edge = Algo::Geometry::vectorOutOfDart<PFP>(map, fd, position) ;
PFP::VEC3 proj = fCenter - (p + (edge * (fCenter - p) / edge.norm2()) * edge) ;
VEC3& p = position[fd] ;
VEC3 edge = Algo::Geometry::vectorOutOfDart<PFP>(map, fd, position) ;
VEC3 proj = fCenter - (p + (edge * (fCenter - p) / edge.norm2()) * edge) ;
if(proj.norm2() < minDistSq)
{
subdivisable = false ;
......@@ -199,9 +199,9 @@ void EnvMap::subdivideToProperLevel()
bool subdiv;
do
{
subdiv=false;
subdiv = false;
{
CellMarker subd(map,FACE);
CellMarker<FACE> subd(map);
for(Dart d = map.begin(); d!= map.end(); map.next(d))
{
if(!subd.isMarked(d))
......@@ -229,7 +229,7 @@ void EnvMap::subdivideToProperLevel()
Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
{
CellMarkerStore m(map, FACE);
CellMarkerStore<FACE> m(map);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!m.isMarked(d))
......@@ -248,7 +248,7 @@ Dart EnvMap::getBelongingCell(const PFP::VEC3& pos)
void EnvMap::init(unsigned int config)
{
float sideSize = 70.0f;
unsigned int nbSquares = 10;
unsigned int nbSquares = 25;
switch(config)
{
......@@ -313,7 +313,7 @@ void EnvMap::foreach_neighborFace(Dart d, FunctorType& f)
void EnvMap::registerObstaclesInFaces()
{
CellMarker m(map, FACE);
CellMarker<FACE> m(map);
for(Dart d = map.begin(); d != map.end(); map.next(d))
{
if(!m.isMarked(d))
......@@ -575,7 +575,7 @@ void EnvMap::updateMap()
map.setCurrentLevel(fLevel) ;
Algo::IHM::subdivideFace<PFP>(map, old, position) ;
CellMarkerStore newF(map, FACE) ;
CellMarkerStore<FACE> newF(map) ;
unsigned int degree = 0 ;
Dart dd = old ;
do
......@@ -672,10 +672,10 @@ void EnvMap::updateMap()
coarsenMark.unmark(fit) ;
unsigned int start = it + 1;
unsigned int fEmb = map.getEmbedding(FACE, fit) ;
unsigned int fEmb = map.getEmbedding<FACE>(fit) ;
while(start < coarsenCandidate.size())
{
if(map.getEmbedding(FACE, coarsenCandidate[start]) == fEmb)
if(map.getEmbedding<FACE>(coarsenCandidate[start]) == fEmb)
{
coarsenCandidate[start] = coarsenCandidate.back() ;
coarsenCandidate.pop_back() ;
......@@ -693,10 +693,10 @@ void EnvMap::updateMap()
nbAgents += agentvect[centerFace].size() ;
coarsenMark.unmark(centerFace) ;
unsigned int start = it + 1;
unsigned int fEmb = map.getEmbedding(FACE, centerFace) ;
unsigned int fEmb = map.getEmbedding<FACE>(centerFace) ;
while(start < coarsenCandidate.size())
{
if(map.getEmbedding(FACE, coarsenCandidate[start]) == fEmb)
if(map.getEmbedding<FACE>(coarsenCandidate[start]) == fEmb)
{
coarsenCandidate[start] = coarsenCandidate.back() ;