Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SocialAgents3D
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thomas Pitiot
SocialAgents3D
Commits
435ef2ea
Commit
435ef2ea
authored
Feb 14, 2013
by
pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
version a jour avec pb Dart==NIL
parent
14a82956
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
1384 additions
and
883 deletions
+1384
-883
Debug/CMakeLists.txt
Debug/CMakeLists.txt
+16
-1
Release/CMakeLists.txt
Release/CMakeLists.txt
+16
-1
include/agent.h
include/agent.h
+4
-2
include/env_generator.h
include/env_generator.h
+3
-5
include/env_generator.hpp
include/env_generator.hpp
+81
-79
include/env_map.h
include/env_map.h
+2
-11
include/env_render.h
include/env_render.h
+156
-123
include/moving_mesh.h
include/moving_mesh.h
+10
-0
include/moving_obstacle.h
include/moving_obstacle.h
+10
-5
include/path_finder.hpp
include/path_finder.hpp
+2
-2
include/pfp.h
include/pfp.h
+1
-1
include/simulator.h
include/simulator.h
+1
-1
include/viewer.h
include/viewer.h
+131
-2
src/agent.cpp
src/agent.cpp
+63
-21
src/env_map.cpp
src/env_map.cpp
+37
-26
src/moving_mesh.cpp
src/moving_mesh.cpp
+34
-22
src/moving_obstacle.cpp
src/moving_obstacle.cpp
+182
-68
src/simulator.cpp
src/simulator.cpp
+41
-27
src/viewer.cpp
src/viewer.cpp
+594
-486
No files found.
Debug/CMakeLists.txt
View file @
435ef2ea
...
...
@@ -9,13 +9,25 @@ ELSE (WIN32)
ENDIF
(
WIN32
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
../include
${
CGoGN_ROOT_DIR
}
/include
${
COMMON_INCLUDES
}
${
CMAKE_CURRENT_SOURCE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
GLOB
shaders_srcD
../include/*.frag
../include/*.vert
../include/*.geom
)
add_custom_target
(
shader_targetD
${
CGoGN_ROOT_DIR
}
/ThirdParty/bin/shader_to_h
${
shaders_srcD
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
SOURCES
${
shaders_srcD
}
)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -p")
QT4_WRAP_UI
(
socialAgents_ui ../include/socialAgents.ui
)
...
...
@@ -30,8 +42,11 @@ add_executable( socialAgentsD
../src/moving_mesh.cpp
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
${
socialAgents_moc
}
${
socialAgents_ui
}
)
add_dependencies
(
socialAgentsD shader_targetD
)
target_link_libraries
(
socialAgentsD
${
CGoGN_LIBS_D
}
${
COMMON_LIBS
}
)
Release/CMakeLists.txt
View file @
435ef2ea
...
...
@@ -9,13 +9,25 @@ ELSE (WIN32)
ENDIF
(
WIN32
)
include_directories
(
${
CMAKE_CURRENT_BINARY_DIR
}
../include
${
CGoGN_ROOT_DIR
}
/include
${
COMMON_INCLUDES
}
${
CMAKE_CURRENT_SOURCE_DIR
}
${
CMAKE_CURRENT_BINARY_DIR
}
)
file
(
GLOB
shaders_src
../include/*.frag
../include/*.vert
../include/*.geom
)
add_custom_target
(
shader_target
${
CGoGN_ROOT_DIR
}
/ThirdParty/bin/shader_to_h
${
shaders_src
}
WORKING_DIRECTORY
${
CMAKE_CURRENT_BINARY_DIR
}
SOURCES
${
shaders_src
}
)
#SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
QT4_WRAP_UI
(
socialAgents_ui ../include/socialAgents.ui
)
...
...
@@ -30,8 +42,11 @@ add_executable( socialAgents
../src/moving_mesh.cpp
../src/gl2ps.c
../src/ShapeMatching/rigidXfComputation.cpp
../src/shaderCustom.cpp
${
socialAgents_moc
}
${
socialAgents_ui
}
)
add_dependencies
(
socialAgents shader_target
)
target_link_libraries
(
socialAgents
${
CGoGN_LIBS_R
}
${
COMMON_LIBS
}
)
include/agent.h
View file @
435ef2ea
...
...
@@ -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
...
...
@@ -85,6 +85,8 @@ public:
static
unsigned
int
cptAgent
;
VEC3
forces
;
float
color1
;
float
color2
;
float
color3
;
...
...
include/env_generator.h
View file @
435ef2ea
...
...
@@ -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
>
...
...
include/env_generator.hpp
View file @
435ef2ea
...
...
@@ -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.0
f
)
;
...
...
@@ -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.0
f
/
4.0
f
)
*
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.0
f
)
;
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.0
f
;
//move vertices for equilateral triangles
toCut
=
envMap
.
map
.
phi1
(
toCut
)
;
//change the side of the split face
envMap
.
position
[
toCut
][
0
]
-=
envMap
.
maxCellSize
/
2.0
f
;
//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
.
newOriented
Face
(
3
)
;
//add triangle add end of lines to make a square
Dart
endSquare
=
envMap
.
map
.
new
Face
(
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.0
f
;
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.0
f
;
}
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.0
f
;
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.0
f
)
;
dRoof
=
Algo
::
Surface
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
dRoof
,
height
/
3.0
f
)
;
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.0
f
)
;
dRoof
=
Algo
::
Surface
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
dRoof
,
height
/
3.0
f
)
;
Dart
dNext
=
map
.
phi1
(
dRoof
)
;
Dart
dPrev
=
map
.
phi2
(
map
.
phi_1
(
dRoof
))
;
typename
PFP
::
VEC3
mid1
=
(
position
[
dNext
]
+
position
[
map
.
phi1
(
dNext
)])
/
2.0
f
;
...
...
@@ -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.0
f
)
;
typename
PFP
::
VEC3
c
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
dRoof
,
position
)
;
Dart
dRoofSmall
=
Algo
::
Surface
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
dRoof
,
0.0
f
)
;
Dart
dd
=
dRoofSmall
;
do
{
position
[
dd
]
=
position
[
dd
]
+
(
c
-
position
[
dd
])
/
3.0
f
;
dd
=
map
.
phi1
(
dd
)
;
}
while
(
dd
!=
dRoofSmall
)
;
dRoof
=
Algo
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
dRoofSmall
,
height
/
2.0
f
)
;
dRoof
=
Algo
::
Surface
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
dRoofSmall
,
height
/
2.0
f
)
;
}
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.5
f
;
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.0
f
)
;
typename
PFP
::
VEC3
c
=
Algo
::
Surface
::
Geometry
::
faceCentroid
<
PFP
>
(
map
,
d
,
position
)
;
Dart
dRoofSmall
=
Algo
::
Surface
::
Modelisation
::
extrudeFace
<
PFP
>
(
map
,
position
,
d
,
0.0
f
)
;
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
.
isBoundaryMarked
2
(
x
))
{
addElementToVector
<
Obstacle
*>
(
envMap
.
obstvect
[
x
],
o
);
if
(
!
map
.
isBoundaryMarked
(
map
.
phi2
(
map
.
phi1
(
x
))))
if
(
!
map
.
isBoundaryMarked
2
(
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
.
isBoundaryMarked
2
(
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.0
f
)
;
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.5
f
;
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.14159265358979323846
f
;
...
...
@@ -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
))
{
...
...
include/env_map.h
View file @
435ef2ea
...
...
@@ -188,7 +188,6 @@ void displayMO(Obstacle * o);
* INLINE FUNCTIONS *
**************************************/
template
<
typename
T
>
inline
void
addElementToVector
(
std
::
vector
<
T
>&
a
,
T
ag
)
{
...
...
@@ -267,7 +266,6 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
}
while
(
dd
!=
d
)
;
}
inline
void
EnvMap
::
popAgentInCells
(
Agent
*
agent
,
Dart
d
)
{
assert
(
map
.
getCurrentLevel
()
==
map
.
getMaxLevel
())
;
...
...
@@ -331,13 +329,9 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
beg
=
*
it
;
first
=
NIL
;
d
=
beg
;
// CGoGNout<<"beg : " << beg;
do
{
do
{
dd
=
map
.
alpha1
(
map
.
alpha1
(
d
));
// CGoGNout<<"dd : " << dd;
do
{
do
{
if
(
!
memo_mark
.
isMarked
(
dd
))
{
first
=
dd
;
...
...
@@ -348,11 +342,9 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
d
=
map
.
phi1
(
d
);
}
while
(
first
==
NIL
&&
d
!=
beg
);
// CGoGNout<<CGoGNendl;
++
it
;
}
while
(
first
==
NIL
&&
it
!=
belonging_cells
.
end
());
// assert(!buildingMark.isMarked(d)) ;
assert
(
first
!=
NIL
)
;
// CGoGNout<<"first : "<<first<<CGoGNendl;
d
=
first
;
...
...
@@ -365,7 +357,6 @@ inline void EnvMap::addObstAsNeighbor (Obstacle * o, const std::vector<Dart>& b
}
find_next
(
o
,
&
d
,
memo_mark
);
// CGoGNout<<"d : "<<d<<CGoGNendl;
}
while
(
!
map
.
sameFace
(
d
,
first
));
}
...
...
include/env_render.h
View file @
435ef2ea
...
...
@@ -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
)]
;
// PFP::VEC3 p1 = m.position[d] ;
// PFP::VEC3 p2 = m.position[m.map.phi1(d)] ;
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
()
;
//
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,36 +74,26 @@ inline void renderObstacle(EnvMap& m, MovingObstacle * obst, bool showBelonging=
if
(
showVertices
)
{
glPointSize
(
3
.
0
f
)
;
glColor3f
(
0
.
0
,
0
.
0
,
1
.
0
);
glBegin
(
GL_POINTS
)
;
for
(
unsigned
int
i
=
0
;
i
<
(
obst
->
nbVertices
)
;
++
i
)
{
const
VEC3
&
p
=
obst