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
JPScore
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
92
Issues
92
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
JuPedSim
JPScore
Commits
466520a1
Commit
466520a1
authored
Sep 09, 2015
by
Andrijana Brkic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
syntax changes in the file (for loops..)
parent
2084239f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
voronoi-boost/VoronoiPositionGenerator.cpp
voronoi-boost/VoronoiPositionGenerator.cpp
+17
-15
No files found.
voronoi-boost/VoronoiPositionGenerator.cpp
View file @
466520a1
...
...
@@ -99,23 +99,22 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
radius
=
existing_peds
[
0
]
->
GetEllipse
().
GetBmax
();
SubRoom
*
subroom
=
building
->
GetRoom
(
roomID
)
->
GetSubRoom
(
subroomID
);
const
vector
<
Point
>&
room_vertices
=
subroom
->
GetPolygon
();
double
factor
=
100
;
//factor for conversion to integer for the boost voronoi
vector
<
Point
>
fake_peds
;
//the positions of "fake" pedestrians converted to int
Point
temp
(
0
,
0
);
for
(
unsigned
int
i
=
0
;
i
<
room_vertices
.
size
();
i
++
)
for
(
auto
vert
:
subroom
->
GetPolygon
()
)
//room vertices
{
const
Point
&
center_pos
=
subroom
->
GetCentroid
();
temp
.
SetX
(
center_pos
.
GetX
()
-
room_vertices
[
i
]
.
GetX
(
)
);
temp
.
SetY
(
center_pos
.
GetY
()
-
room_vertices
[
i
]
.
GetY
(
)
);
temp
=
temp
/
sqrt
(
temp
.
NormSquare
());
temp
=
temp
*
(
radius
*
1.4
);
//now the norm of the vector is ~r*sqrt(2), pointing to the center
temp
=
temp
+
room_vertices
[
i
]
;
temp
.
SetX
(
(
int
)(
temp
.
GetX
()
*
factor
)
);
temp
.
SetY
(
(
int
)(
temp
.
GetY
()
*
factor
)
);
fake_peds
.
push_back
(
temp
);
const
Point
&
center_pos
=
subroom
->
GetCentroid
();
temp
.
SetX
(
center_pos
.
GetX
()
-
vert
.
GetX
(
)
);
temp
.
SetY
(
center_pos
.
GetY
()
-
vert
.
GetY
(
)
);
temp
=
temp
/
sqrt
(
temp
.
NormSquare
());
temp
=
temp
*
(
radius
*
1.4
);
//now the norm of the vector is ~r*sqrt(2), pointing to the center
temp
=
temp
+
vert
;
temp
.
SetX
(
(
int
)(
temp
.
GetX
()
*
factor
)
);
temp
.
SetY
(
(
int
)(
temp
.
GetY
()
*
factor
)
);
fake_peds
.
push_back
(
temp
);
}
std
::
vector
<
Pedestrian
*>::
iterator
iter_ped
;
...
...
@@ -190,7 +189,8 @@ bool ComputeBestPositionVoronoiBoost(AgentsSource* src, std::vector<Pedestrian*>
v
=
v
/
no
;
//this is the mean of all velocities
//adding fake people to the voronoi diagram
for
(
unsigned
int
i
=
0
;
i
<
room_vertices
.
size
();
i
++
)
for
(
unsigned
int
i
=
0
;
i
<
subroom
->
GetPolygon
().
size
();
i
++
)
{
discrete_positions
.
push_back
(
fake_peds
[
i
]
);
velocities_vector
.
push_back
(
v
);
...
...
@@ -284,7 +284,9 @@ void VoronoiBestVertexMax (const std::vector<Point>& discrete_positions, const v
double
factor
,
voronoi_diagram
<
double
>::
const_vertex_iterator
&
max_it
,
double
&
max_dis
,
double
radius
)
{
double
dis
=
0
;
for
(
voronoi_diagram
<
double
>::
const_vertex_iterator
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
for
(
auto
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
{
Point
vert_pos
(
it
->
x
()
/
factor
,
it
->
y
()
/
factor
);
if
(
subroom
->
IsInSubRoom
(
vert_pos
)
)
...
...
@@ -315,7 +317,7 @@ void VoronoiBestVertexRandMax (const std::vector<Point>& discrete_positions, con
vector
<
double
>
partial_sums
;
unsigned
int
size
=
0
;
for
(
voronoi_diagram
<
double
>::
const_vertex_iterator
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
for
(
auto
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
{
Point
vert_pos
=
Point
(
it
->
x
()
/
factor
,
it
->
y
()
/
factor
);
if
(
subroom
->
IsInSubRoom
(
vert_pos
)
)
...
...
@@ -369,7 +371,7 @@ void VoronoiBestVertexRand (const std::vector<Point>& discrete_positions, const
std
::
vector
<
voronoi_diagram
<
double
>::
const_vertex_iterator
>
possible_vertices
;
std
::
vector
<
double
>
distances
;
for
(
voronoi_diagram
<
double
>::
const_vertex_iterator
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
for
(
auto
it
=
vd
.
vertices
().
begin
();
it
!=
vd
.
vertices
().
end
();
++
it
)
{
Point
vert_pos
=
Point
(
it
->
x
()
/
factor
,
it
->
y
()
/
factor
);
if
(
subroom
->
IsInSubRoom
(
vert_pos
)
)
...
...
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