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
d8445613
Commit
d8445613
authored
Feb 21, 2013
by
pitiot
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ecnore un bug coarse cas triangle agents
parent
247a530f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
10 deletions
+84
-10
include/env_map.h
include/env_map.h
+10
-0
include/simulator.h
include/simulator.h
+1
-1
include/viewer.h
include/viewer.h
+1
-1
src/agent.cpp
src/agent.cpp
+1
-0
src/env_map.cpp
src/env_map.cpp
+6
-4
src/simulator.cpp
src/simulator.cpp
+25
-1
src/viewer.cpp
src/viewer.cpp
+40
-3
No files found.
include/env_map.h
View file @
d8445613
...
...
@@ -247,6 +247,16 @@ inline void EnvMap::pushAgentInCells(Agent* agent, Dart d)
// assert(std::find(agentvect[d].begin(), agentvect[d].end(), agent) == agentvect[d].end());
// map.check();
TraversorF
<
PFP
::
MAP
>
tF
(
map
);
for
(
Dart
ddd
=
tF
.
begin
()
;
ddd
!=
tF
.
end
()
;
ddd
=
tF
.
next
())
{
if
(
std
::
find
(
agentvect
[
ddd
].
begin
(),
agentvect
[
ddd
].
end
(),
agent
)
!=
agentvect
[
ddd
].
end
())
std
::
cout
<<
agent
<<
" SO WRONG ADD"
<<
ddd
.
index
<<
std
::
endl
;
if
(
std
::
find
(
neighborAgentvect
[
ddd
].
begin
(),
neighborAgentvect
[
ddd
].
end
(),
agent
)
!=
neighborAgentvect
[
ddd
].
end
())
std
::
cout
<<
agent
<<
" SO SO WRONG ADD"
<<
ddd
.
index
<<
std
::
endl
;
}
addElementToVector
<
Agent
*>
(
agentvect
[
d
],
agent
);
// agentvect[d].push_back(agent) ;
// nbAgentsIncrease(d);
...
...
include/simulator.h
View file @
d8445613
...
...
@@ -112,7 +112,7 @@ public:
bool
importAgents
(
std
::
string
filename
)
;
bool
exportAgents
(
std
::
string
filename
)
;
void
checkRegistering
();
void
swapAgentsGoals
()
;
Geom
::
BoundingBox
<
VEC3
>
getAgentsBB
()
;
...
...
include/viewer.h
View file @
d8445613
...
...
@@ -172,7 +172,7 @@ public:
bool
render_anim
;
int
visu
;
Utils
::
Drawer
*
m_ds
;
bool
drawEnvLines
;
bool
drawEnvFaces
;
bool
drawEnvTopo
;
...
...
src/agent.cpp
View file @
d8445613
...
...
@@ -88,6 +88,7 @@ void Agent::init(const VEC3& start, const VEC3& goal)
movingObstacles_
=
new
MovingObstacle
*
[
maxMovingObstacles_
];
nb_mos
=
0
;
agentNo
=
cptAgent
++
;
CGoGNout
<<
this
<<
" = agent n°"
<<
agentNo
<<
CGoGNendl
;
}
...
...
src/env_map.cpp
View file @
d8445613
...
...
@@ -794,14 +794,14 @@ void EnvMap::refine()
newF
.
mark
(
dd
)
;
dd
=
map
.
phi1
(
dd
)
;
}
while
(
dd
!=
old
)
;
map
.
setCurrentLevel
(
fLevel
+
1
)
;
if
(
degree
==
3
)
{
Dart
centerFace
=
map
.
phi2
(
map
.
phi1
(
old
))
;
newF
.
mark
(
centerFace
)
;
}
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
//retrieve neighbors agents from onering cells
dd
=
old
;
do
...
...
@@ -830,7 +830,9 @@ void EnvMap::refine()
if
(
degree
==
3
)
{
map
.
setCurrentLevel
(
fLevel
+
1
)
;
Dart
centerFace
=
map
.
phi2
(
map
.
phi1
(
old
))
;
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
Dart
d3
=
centerFace
;
do
{
...
...
@@ -848,7 +850,7 @@ void EnvMap::refine()
d3
=
map
.
phi1
(
d3
)
;
}
while
(
d3
!=
centerFace
)
;
}
cout
<<
"coucou"
<<
endl
;
//agents contained in the subdivided cell are pushed correctly
for
(
PFP
::
AGENTS
::
iterator
ait
=
oldAgents
.
begin
();
ait
!=
oldAgents
.
end
();
++
ait
)
{
...
...
@@ -1155,7 +1157,7 @@ void EnvMap::updateMap()
assert
(
map
.
getCurrentLevel
()
==
map
.
getMaxLevel
())
;
refine
();
//
coarse();
coarse
();
}
void
EnvMap
::
resetAgentInFace
(
Agent
*
agent
)
...
...
src/simulator.cpp
View file @
d8445613
...
...
@@ -104,7 +104,7 @@ void Simulator::doStep()
envMap_
.
clearUpdateCandidates
()
;
envMap_
.
map
.
setCurrentLevel
(
envMap_
.
map
.
getMaxLevel
())
;
#endif
checkRegistering
();
for
(
unsigned
int
i
=
0
;
i
<
movingObstacles_
.
size
()
;
++
i
)
{
movingObstacles_
[
i
]
->
computePrefVelocity
()
;
...
...
@@ -1088,3 +1088,27 @@ Geom::BoundingBox<VEC3> Simulator::getAgentsBB()
}
return
bb
;
}
void
Simulator
::
checkRegistering
()
{
for
(
std
::
vector
<
Agent
*>::
iterator
it
=
agents_
.
begin
()
;
it
!=
agents_
.
end
()
;
++
it
)
{
TraversorF
<
PFP
::
MAP
>
tF
(
envMap_
.
map
);
for
(
Dart
d
=
tF
.
begin
()
;
d
!=
tF
.
end
()
;
d
=
tF
.
next
())
{
PFP
::
AGENTS
a
=
envMap_
.
agentvect
[
d
];
PFP
::
AGENTS
::
iterator
f1
=
std
::
find
(
a
.
begin
(),
a
.
end
(),
*
it
);
if
(
f1
!=
a
.
end
())
if
(
std
::
find
(
++
f1
,
a
.
end
(),
*
it
)
!=
a
.
end
())
std
::
cout
<<
"pas cool."
<<
(
*
it
)
->
agentNo
<<
std
::
endl
;
a
=
envMap_
.
neighborAgentvect
[
d
];
PFP
::
AGENTS
::
iterator
f2
=
std
::
find
(
a
.
begin
(),
a
.
end
(),
*
it
);
if
(
f2
!=
a
.
end
())
if
(
std
::
find
(
++
f2
,
a
.
end
(),
*
it
)
!=
a
.
end
())
std
::
cout
<<
"pas cool, mais un peu moins."
<<
(
*
it
)
->
agentNo
<<
std
::
endl
;
}
}
}
src/viewer.cpp
View file @
d8445613
...
...
@@ -126,7 +126,7 @@ void SocialAgents::cb_initGL()
// create the render
m_render
=
new
Algo
::
Render
::
GL2
::
MapRender
();
m_renderTopo
=
new
Algo
::
Render
::
GL2
::
TopoRender
();
m_ds
=
new
Utils
::
Drawer
();
if
(
simulator
.
config
==
5
)
m_renderPedway
=
new
Algo
::
Render
::
GL2
::
MapRender
();
...
...
@@ -494,7 +494,16 @@ void SocialAgents::cb_redraw()
glPolygonMode
(
GL_FRONT_AND_BACK
,
GL_FILL
)
;
glEnable
(
GL_LIGHTING
);
glm
::
mat4
&
matrice
=
modelViewMatrix
();
Geom
::
Matrix44f
matrix
;
for
(
unsigned
int
i
=
0
;
i
<
4
;
i
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
4
;
j
++
)
{
matrix
(
i
,
j
)
=
matrice
[
i
][
j
];
}
}
// cout<<matrice[0][0]<<endl;
dock
.
check_slide
->
setRange
(
0
,
simulator
.
envMap_
.
map
.
end
().
index
)
;
...
...
@@ -528,6 +537,34 @@ void SocialAgents::cb_redraw()
// renderAgent(simulator.envMap_, *it, drawAgentsNeighborDist, drawAgentsObstacleDist, drawAgentsPath,
// (*it)->color1, (*it)->color2, (*it)->color3) ;
// }
if
(
target_Agent
)
{
glDisable
(
GL_LIGHTING
);
VEC3
pos
=
simulator
.
agents_
[
agentSlider
]
->
part_
.
getPosition
();
CGoGNout
<<
"agent "
<<
agentSlider
<<
" sélectionné, à la position :"
<<
pos
<<
CGoGNendl
;
m_ds
->
newList
(
GL_COMPILE
);
m_ds
->
lineWidth
(
5.0
f
);
m_ds
->
pointSize
(
10.0
f
);
m_ds
->
begin
(
GL_POINTS
);
// fait varier la couleur du plus pres au plus loin
m_ds
->
color3f
(
0.0
f
,
1.0
f
,
0.9
f
);
m_ds
->
vertex
(
pos
);
m_ds
->
vertex
(
pos
+
VEC3
(
0
,
0
,
50
));
m_ds
->
vertex
(
pos
+
VEC3
(
0
,
10
,
50
));
// m_ds->vertex(VEC3 (pos[0]+10,pos[1]-10,pos[2]));
m_ds
->
end
();
m_ds
->
endList
();
m_ds
->
callList
();
}
}
if
(
drawMovingObstacles
)
...
...
@@ -822,7 +859,7 @@ void SocialAgents::animate()
// if (CityGenerator::animateCity<PFP>(&simulator.envMap_)) simulator.addPathToCorner() ;
// simulator.addPathsToAgents() ;
//
//
std::cout << "t : " << simulator.globalTime_ << std::endl ;
std
::
cout
<<
"t : "
<<
simulator
.
globalTime_
<<
std
::
endl
;
//
// timeval startTime ;
// gettimeofday(&startTime, NULL) ;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment