Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
JPSreport
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
JuPedSim
JPSreport
Commits
b7f73ad6
Verified
Commit
b7f73ad6
authored
6 years ago
by
Mohcine Chraibi
Browse files
Options
Downloads
Patches
Plain Diff
add dummy pedestrians when numPeds < 3
parent
f6bb29e8
No related branches found
No related tags found
2 merge requests
!15
Resolve "Method D | IndividualFD file use wrong PersID"
,
!14
Resolve "Method I | new measurement method"
Pipeline
#17432
failed
6 years ago
Stage: configure
Stage: compile
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
Analysis.cpp
+5
-8
5 additions, 8 deletions
Analysis.cpp
methods/Method_I.cpp
+523
-532
523 additions, 532 deletions
methods/Method_I.cpp
methods/VoronoiDiagram.cpp
+30
-1
30 additions, 1 deletion
methods/VoronoiDiagram.cpp
with
558 additions
and
541 deletions
Analysis.cpp
+
5
−
8
View file @
b7f73ad6
...
...
@@ -161,6 +161,7 @@ void Analysis::InitArgs(ArgumentParser* args)
_StopFramesMethodD
=
args
->
GetStopFramesMethodD
();
_IndividualFDFlags
=
args
->
GetIndividualFDFlags
();
_plotTimeseriesD
=
args
->
GetIsPlotTimeSeriesD
();
_geoPoly
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_D
);
}
if
(
args
->
GetIsMethodI
())
{
_DoesUseMethodI
=
true
;
...
...
@@ -173,6 +174,7 @@ void Analysis::InitArgs(ArgumentParser* args)
_StopFramesMethodI
=
args
->
GetStopFramesMethodI
();
_IndividualFDFlags
=
args
->
GetIndividualFDFlags
();
_plotTimeseriesI
=
args
->
GetIsPlotTimeSeriesI
();
_geoPoly
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_I
);
}
_deltaF
=
args
->
GetDelatT_Vins
();
...
...
@@ -186,7 +188,6 @@ void Analysis::InitArgs(ArgumentParser* args)
_IgnoreBackwardMovement
=
args
->
GetIgnoreBackwardMovement
();
_grid_size_X
=
int
(
args
->
GetGridSizeX
());
_grid_size_Y
=
int
(
args
->
GetGridSizeY
());
_geoPoly
=
ReadGeometry
(
args
->
GetGeometryFilename
(),
_areaForMethod_D
);
_geometryFileName
=
args
->
GetGeometryFilename
();
_projectRootDir
=
args
->
GetProjectRootDir
();
_trajFormat
=
args
->
GetFileFormat
();
...
...
@@ -199,11 +200,11 @@ void Analysis::InitArgs(ArgumentParser* args)
std
::
map
<
int
,
polygon_2d
>
Analysis
::
ReadGeometry
(
const
fs
::
path
&
geometryFile
,
const
std
::
vector
<
MeasurementArea_B
*>&
areas
)
{
_building
=
new
Building
();
_building
->
LoadGeometry
(
geometryFile
.
string
());
// create the polygons
_building
->
InitGeometry
();
// _building->AddSurroundingRoom();
double
geo_minX
=
FLT_MAX
;
double
geo_minY
=
FLT_MAX
;
...
...
@@ -221,10 +222,8 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
for
(
auto
&&
it_sub
:
it_room
.
second
->
GetAllSubRooms
())
{
SubRoom
*
subroom
=
it_sub
.
second
.
get
();
point_2d
point
(
0
,
0
);
boost
::
geometry
::
centroid
(
area
->
_poly
,
point
);
//check if the area is contained in the obstacle
if
(
subroom
->
IsInSubRoom
(
Point
(
point
.
x
()
/
M2CM
,
point
.
y
()
/
M2CM
)))
{
...
...
@@ -245,7 +244,6 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
geoPoly
[
area
->
_id
].
inners
().
resize
(
k
++
);
geoPoly
[
area
->
_id
].
inners
().
back
();
model
::
ring
<
point_2d
>&
inner
=
geoPoly
[
area
->
_id
].
inners
().
back
();
for
(
auto
&&
tmp_point
:
obst
->
GetPolygon
())
{
append
(
inner
,
make
<
point_2d
>
(
tmp_point
.
_x
*
M2CM
,
tmp_point
.
_y
*
M2CM
));
...
...
@@ -267,9 +265,8 @@ std::map<int, polygon_2d> Analysis::ReadGeometry(const fs::path& geometryFile, c
_highVertexY
=
geo_maxY
;
_lowVertexX
=
geo_minX
;
_lowVertexY
=
geo_minY
;
//
using boost::geometry::dsv;
using
boost
::
geometry
::
dsv
;
// cout<<"INFO: \tGeometry polygon is:\t" << dsv(geoPoly[1])<<endl;
return
geoPoly
;
}
...
...
@@ -488,7 +485,7 @@ int Analysis::RunAnalysis(const fs::path& filename, const fs::path& path)
bool
result_I
=
method_I
.
Process
(
data
,
_scriptsLocation
,
_areaForMethod_I
[
i
]
->
_zPos
);
if
(
result_I
)
{
Log
->
Write
(
"INFO:
\t
Success with Method I uing measurement area id %d!
\n
"
,
_areaForMethod_I
[
i
]
->
_id
);
Log
->
Write
(
"INFO:
\t
Success with Method I u
s
ing measurement area id %d!
\n
"
,
_areaForMethod_I
[
i
]
->
_id
);
std
::
cout
<<
"INFO:
\t
Success with Method I using measurement area id "
<<
_areaForMethod_I
[
i
]
->
_id
<<
"
\n
"
;
if
(
_plotTimeseriesI
[
i
])
{
...
...
This diff is collapsed.
Click to expand it.
methods/Method_I.cpp
+
523
−
532
View file @
b7f73ad6
...
...
@@ -152,13 +152,12 @@ bool Method_I::Process (const PedData& peddata,const fs::path& scriptsLocation,
XInFrame
.
erase
(
XInFrame
.
begin
()
+
i
);
YInFrame
.
erase
(
YInFrame
.
begin
()
+
i
);
VInFrame
.
erase
(
VInFrame
.
begin
()
+
i
);
Log
->
Write
(
"Warning:
\t
Pedestrian removed"
);
i
--
;
}
}
int
NumPeds
=
IdInFrame
.
size
();
//---------------------------------------------------------------------------------------------------------------
if
(
NumPeds
>
3
)
{
if
(
_isOneDimensional
)
{
CalcVoronoiResults1D
(
XInFrame
,
VInFrame
,
IdInFrame
,
_areaForMethod_I
->
_poly
,
str_frid
);
...
...
@@ -210,12 +209,6 @@ bool Method_I::Process (const PedData& peddata,const fs::path& scriptsLocation,
Log
->
Write
(
"WARNING:
\t
Voronoi Diagrams are not obtained!. Frame: %d (minFrame = %d)
\n
"
,
frid
,
minFrame
);
}
}
}
// if N >3
else
{
Log
->
Write
(
"INFO:
\t
The number of the pedestrians is small (%d). Frame = %d (minFrame = %d)
\n
"
,
NumPeds
,
frid
,
minFrame
);
}
}
fclose
(
_fVoronoiRhoV
);
if
(
_calcIndividualFD
)
{
...
...
@@ -285,8 +278,6 @@ std::vector<std::pair<polygon_2d, int> > Method_I::GetPolygons(vector<double>& X
double
boundpoint
=
10
*
max
(
max
(
fabs
(
_geoMinX
),
fabs
(
_geoMinY
)),
max
(
fabs
(
_geoMaxX
),
fabs
(
_geoMaxY
)));
std
::
vector
<
std
::
pair
<
polygon_2d
,
int
>
>
polygons_id
;
polygons_id
=
vd
.
getVoronoiPolygons
(
XInFrame
,
YInFrame
,
VInFrame
,
IdInFrame
,
boundpoint
);
// std:: cout << " GetPolygons " << polygons_id.size() << "\n";
polygon_2d
poly
;
if
(
_cutByCircle
)
{
...
...
This diff is collapsed.
Click to expand it.
methods/VoronoiDiagram.cpp
+
30
−
1
View file @
b7f73ad6
...
...
@@ -49,11 +49,39 @@ VoronoiDiagram::~VoronoiDiagram()
std
::
vector
<
std
::
pair
<
polygon_2d
,
int
>
>
VoronoiDiagram
::
getVoronoiPolygons
(
vector
<
double
>&
XInFrame
,
vector
<
double
>&
YInFrame
,
vector
<
double
>&
VInFrame
,
vector
<
int
>&
IdInFrame
,
const
double
Bound_Max
)
{
const
int
numPedsInFrame
=
IdInFrame
.
size
();
int
numPedsInFrame
=
IdInFrame
.
size
();
vector
<
int
>
XInFrame_temp
;
vector
<
int
>
YInFrame_temp
;
vector
<
double
>
VInFrame_temp
;
vector
<
int
>
IdInFrame_temp
;
// in case 1 or 2 pedestrians are in the geometry
// add dummy pedestrians around to enable voronoi calculations
// @todo: maybe use negative ids for these dummy pedestrians to exclude
// them from any analysis.
if
(
numPedsInFrame
==
1
||
numPedsInFrame
==
2
)
{
numPedsInFrame
+=
4
;
// up right
XInFrame
.
push_back
(
XInFrame
[
0
]
+
10
);
YInFrame
.
push_back
(
YInFrame
[
0
]
+
10
);
VInFrame
.
push_back
(
VInFrame
[
0
]);
IdInFrame
.
push_back
(
IdInFrame
[
0
]
+
1
);
// up left
XInFrame
.
push_back
(
XInFrame
[
0
]
-
10
);
YInFrame
.
push_back
(
YInFrame
[
0
]
+
10
);
VInFrame
.
push_back
(
VInFrame
[
0
]);
IdInFrame
.
push_back
(
IdInFrame
[
0
]
+
2
);
// down right
XInFrame
.
push_back
(
XInFrame
[
0
]
+
10
);
YInFrame
.
push_back
(
YInFrame
[
0
]
-
10
);
VInFrame
.
push_back
(
VInFrame
[
0
]);
IdInFrame
.
push_back
(
IdInFrame
[
0
]
+
3
);
// down left
XInFrame
.
push_back
(
XInFrame
[
0
]
-
10
);
YInFrame
.
push_back
(
YInFrame
[
0
]
-
10
);
VInFrame
.
push_back
(
VInFrame
[
0
]);
IdInFrame
.
push_back
(
IdInFrame
[
0
]
+
4
);
}
for
(
int
i
=
0
;
i
<
numPedsInFrame
;
i
++
)
{
...
...
@@ -64,6 +92,7 @@ std::vector<std::pair<polygon_2d, int> > VoronoiDiagram::getVoronoiPolygons(vect
IdInFrame_temp
.
push_back
(
IdInFrame
[
i
]);
}
VD
voronoidiagram
;
construct_voronoi
(
points
.
begin
(),
points
.
end
(),
&
voronoidiagram
);
int
Ncell
=
0
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment