Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Hurstel
CGoGN
Commits
90704e8e
Commit
90704e8e
authored
Feb 01, 2011
by
Pierre Kraemer
Browse files
SocialAgents -> config exemple
parent
7bc719f8
Changes
5
Hide whitespace changes
Inline
Side-by-side
Apps/Examples/SocialAgents/include/env_generator.hpp
View file @
90704e8e
...
...
@@ -148,7 +148,7 @@ void generateSmallCity(typename PFP::MAP& map, EMBV& position, DartMarker& close
// sideSize *= 0.2f;
unsigned
int
nbBuilding
=
1000
;
float
height
=
sideSize
/
2.0
f
;
unsigned
int
side
=
20
;
unsigned
int
side
=
5
;
generateGrid
<
PFP
,
EMBV
>
(
map
,
position
,
side
,
side
,
sideSize
,
closeMark
);
Dart
dEnd
=
map
.
end
();
...
...
Apps/Examples/SocialAgents/src/env_map.cpp
View file @
90704e8e
...
...
@@ -339,29 +339,6 @@ void EnvMap::addNeighborAgents(PFP::AGENTS agentsFrom,PFP::AGENTS agentsTo)
void
EnvMap
::
updateMap
()
{
// simplifyFaces();
CellMarker
m
(
map
,
FACE_CELL
)
;
for
(
Dart
d
=
map
.
begin
();
d
!=
map
.
end
();
map
.
next
(
d
))
{
if
(
!
m
.
isMarked
(
d
))
{
m
.
mark
(
d
)
;
std
::
vector
<
Agent
*>&
agents
=
agentvect
[
d
]
;
for
(
std
::
vector
<
Agent
*>::
iterator
it
=
agents
.
begin
();
it
!=
agents
.
end
();
++
it
)
{
if
(
!
map
.
sameFace
(
d
,
(
*
it
)
->
part
->
d
))
{
std
::
cout
<<
"aaaaaaaaaaaaaaaaaaa"
<<
std
::
endl
;
std
::
cout
<<
(
*
it
)
->
part
->
state
<<
std
::
endl
;
if
(
map
.
sameFace
(
map
.
phi2
(
d
),
(
*
it
)
->
part
->
d
))
{
std
::
cout
<<
"saucisse"
<<
std
::
endl
;
}
}
}
}
}
subdivideFaces
()
;
map
.
setCurrentLevel
(
map
.
getMaxLevel
())
;
}
...
...
@@ -374,7 +351,7 @@ void EnvMap::subdivideFaces()
if
(
!
m
.
isMarked
(
d
))
{
m
.
mark
(
d
)
;
if
(
!
closeMark
.
isMarked
(
d
)
&&
agentvect
[
d
].
size
()
>
5
)
if
(
!
closeMark
.
isMarked
(
d
)
&&
agentvect
[
d
].
size
()
>
3
)
{
if
(
!
map
.
faceIsSubdivided
(
d
))
{
...
...
@@ -386,16 +363,6 @@ void EnvMap::subdivideFaces()
unsigned
int
cur
=
map
.
getCurrentLevel
()
;
unsigned
int
fLevel
=
map
.
faceLevel
(
d
)
;
// std::cout << "cur -> " << cur << " / fLevel -> " << fLevel << " :" ;
// Dart fit = d ;
// do
// {
// unsigned int e = map.getDartEmbedding(FACE_ORBIT, fit) ;
// if(e == EMBNULL) std::cout << " -" ; else std::cout << " " << e ;
// fit = map.phi1(fit) ;
// } while(fit != d) ;
// std::cout << std::endl ;
map
.
setCurrentLevel
(
fLevel
)
;
std
::
vector
<
Dart
>
marked
;
Dart
fit
=
d
;
...
...
@@ -409,35 +376,18 @@ void EnvMap::subdivideFaces()
Algo
::
IHM
::
subdivideFace
<
PFP
>
(
map
,
d
,
position
)
;
map
.
setCurrentLevel
(
fLevel
+
1
)
;
// Dart cv = map.phi2(map.phi1(d)) ;
// Dart vit = cv ;
// unsigned int i = 1 ;
// do
// {
// std::cout << " face " << i << " -> " ;
// Dart f = vit ;
// do
// {
// unsigned int e = map.getDartEmbedding(FACE_ORBIT, f) ;
// if(e == EMBNULL) std::cout << " -" ; else std::cout << " " << e ;
// f = map.phi1(f) ;
// } while(f != vit) ;
// std::cout << std::endl ;
// vit = map.alpha1(vit) ;
// ++i ;
// } while(vit != cv) ;
for
(
std
::
vector
<
Dart
>::
iterator
it
=
marked
.
begin
();
it
!=
marked
.
end
();
++
it
)
closeMark
.
mark
(
map
.
phi2
(
*
it
))
;
map
.
setCurrentLevel
(
cur
)
;
map
.
setCurrentLevel
(
map
.
getMaxLevel
()
)
;
for
(
PFP
::
AGENTS
::
iterator
it
=
agents
.
begin
();
it
!=
agents
.
end
();
++
it
)
{
resetAgentInFace
(
*
it
)
;
agentvect
[(
*
it
)
->
part
->
d
].
push_back
(
*
it
)
;
}
map
.
setCurrentLevel
(
cur
)
;
}
}
}
...
...
Apps/Examples/SocialAgents/src/simulator.cpp
View file @
90704e8e
...
...
@@ -20,7 +20,7 @@ Simulator::Simulator() : agents_(), defaultAgent_(0), globalTime_(0.0f), timeSte
// CGoGN::CityGenerator::generateToboggan<PFP>(envMap.map,envMap.position,envMap.closeMark,100,0.25,200,10);
// std::cout << "simplify" << std::endl;
//
envMap.simplify();
envMap
.
simplify
();
envMap
.
map
.
init
();
std
::
cout
<<
"setup scenario"
<<
std
::
endl
;
setupScenario
();
...
...
Apps/Examples/SocialAgents/src/viewer.cpp
View file @
90704e8e
...
...
@@ -87,7 +87,7 @@ void MyGlutWin::initGUI()
bool
MyGlutWin
::
reachedGoal
(
Simulator
*
sim
)
{
if
((
int
(
sim
->
globalTime_
)
%
10
00
)
==
0
)
if
((
int
(
sim
->
globalTime_
)
%
5
00
)
==
0
)
std
::
random_shuffle
(
sim
->
goals
.
begin
(),
sim
->
goals
.
end
()
);
// /* Check if all agents have reached their goals. */
// for (size_t i = 0; i < sim->getNumAgents(); ++i) {
...
...
@@ -381,7 +381,7 @@ void updateVisualization(Simulator* sim)
void
MyGlutWin
::
animate
(
void
)
{
// if(int(sim->globalTime_)%2)
// CGoGN::CityGenerator::animateCity<PFP,PFP::TVEC3,PFP::TAB_AGENTVECT>(sim->envMap.map,sim->envMap.position,sim->envMap.agentvect,sim->envMap.closeMark,sim->envMap.newBuildings);
//
CGoGN::CityGenerator::animateCity<PFP,PFP::TVEC3,PFP::TAB_AGENTVECT>(sim->envMap.map,sim->envMap.position,sim->envMap.agentvect,sim->envMap.closeMark,sim->envMap.newBuildings);
// sim->envMap.map.check();
// posToReach[0] += sin(rand());
// posToReach[1] += cos(rand());
...
...
include/Geometry/inclusion.hpp
View file @
90704e8e
...
...
@@ -163,7 +163,7 @@ bool arePointsEquals(const VEC3& point1, const VEC3& point2)
{
VEC3
v
(
point1
-
point2
);
#define PRECISION 1e-
20
#define PRECISION 1e-
6
return
v
.
norm2
()
<=
PRECISION
;
#undef PRECISION
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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