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
6c7cbcc4
Verified
Commit
6c7cbcc4
authored
Jun 03, 2019
by
Mohcine Chraibi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Last part of correct train geometry
parent
d184bcdf
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
80 additions
and
8 deletions
+80
-8
Simulation.cpp
Simulation.cpp
+49
-8
geometry/Line.cpp
geometry/Line.cpp
+16
-0
geometry/Line.h
geometry/Line.h
+15
-0
No files found.
Simulation.cpp
View file @
6c7cbcc4
...
...
@@ -691,7 +691,7 @@ double Simulation::RunBody(double maxSimTime)
if
(
trainOutflow
[
id
]
>=
TrainTypes
[
type
]
->
nmax
)
{
std
::
cout
<<
"INFO:
\t
closing train door "
<<
transType
.
c_str
()
<<
" at "
<<
Pedestrian
::
GetGlobalTime
()
<<
"
\n
"
;
Log
->
Write
(
"INFO:
\t
closing train door %s at t=%.2f
"
,
transType
.
c_str
(),
Pedestrian
::
GetGlobalTime
()
);
Log
->
Write
(
"INFO:
\t
closing train door %s at t=%.2f
. Flow = %.2f (Train Capacity %.2f)"
,
transType
.
c_str
(),
Pedestrian
::
GetGlobalTime
(),
trainOutflow
[
id
],
TrainTypes
[
type
]
->
nmax
);
Trans
->
Close
();
}
}
...
...
@@ -780,8 +780,8 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
subroom
->
GetUID
();
auto
walls
=
subroom
->
GetAllWalls
();
// debugging
//
std::cout << "------\n";
//
---
for
(
auto
pw
:
pws
)
{
auto
pw1
=
pw
.
first
;
...
...
@@ -902,16 +902,57 @@ bool Simulation::correctGeometry(std::shared_ptr<Building> building, std::shared
else
// disjoint
{
std
::
cout
<<
"DISJOINT
\n
"
;
//------------ transition --------
Transition
*
e
=
new
Transition
();
e
->
SetID
(
transition_id
++
);
e
->
SetCaption
(
trainType
);
e
->
SetPoint1
(
p1
);
e
->
SetPoint2
(
p2
);
std
::
string
transType
=
"Train_"
+
std
::
to_string
(
tab
->
id
)
+
"_"
+
std
::
to_string
(
tab
->
tin
)
+
"_"
+
std
::
to_string
(
tab
->
tout
);
e
->
SetType
(
transType
);
room
->
AddTransitionID
(
e
->
GetUniqueID
());
// danger area
e
->
SetRoom1
(
room
);
e
->
SetSubRoom1
(
subroom
);
subroom
->
AddTransition
(
e
);
// danger area
building
->
AddTransition
(
e
);
// danger area
//--------------------------------
// find points on w1 and w2 between p1 and p2
// (A, B)
// remove all walls connected to A
// move A forwards
// remove walls... until B is found
Point
A
,
B
;
if
(
e
->
isBetween
(
w1
.
GetPoint1
()))
A
=
w1
.
GetPoint2
();
else
A
=
w1
.
GetPoint1
();
if
(
e
->
isBetween
(
w2
.
GetPoint1
()))
B
=
w2
.
GetPoint2
();
else
B
=
w2
.
GetPoint1
();
Wall
NewWall
(
A
,
p1
);
Wall
NewWall1
(
B
,
p2
);
NewWall
.
SetType
(
w1
.
GetType
());
NewWall1
.
SetType
(
w2
.
GetType
());
// remove walls between
for
(
auto
wall
:
mytrack
)
{
if
(
e
->
isBetween
(
wall
.
GetPoint1
())
||
e
->
isBetween
(
wall
.
GetPoint2
()))
{
building
->
TempRemovedWalls
[
trainId
].
push_back
(
wall
);
subroom
->
RemoveWall
(
wall
);
}
}
// changes to building
building
->
TempAddedWalls
[
trainId
].
push_back
(
NewWall
);
building
->
TempAddedWalls
[
trainId
].
push_back
(
NewWall1
);
building
->
TempAddedDoors
[
trainId
].
push_back
(
*
e
);
subroom
->
AddWall
(
NewWall
);
subroom
->
AddWall
(
NewWall1
);
// remove walls w1 and w2
}
}
std
::
cout
<<
"------
\n
"
;
/* getc(stdin); */
_routingEngine
->
setNeedUpdate
(
true
);
return
true
;
...
...
geometry/Line.cpp
View file @
6c7cbcc4
...
...
@@ -201,6 +201,16 @@ Point Line::LotPoint(const Point& p) const
return
f
;
}
// return true if point the orthogonal projection of p on Line segment is on the
// line segment.
bool
Line
::
isBetween
(
const
Point
&
p
)
const
{
const
Point
&
t
=
_point1
-
_point2
;
double
lambda
=
(
p
-
_point2
).
ScalarProduct
(
t
)
/
t
.
ScalarProduct
(
t
);
return
(
lambda
>
0
)
&&
(
lambda
<
1
);
}
/* Punkt auf der Linie mit kürzestem Abstand zu p
* In der Regel Lotfußpunkt, Ist der Lotfußpunkt nicht im Segment
* wird der entsprechende Eckpunkt der Line genommen
...
...
@@ -273,6 +283,12 @@ bool Line::operator!=(const Line& l) const
return
(
!
(
*
this
==
l
));
}
// this function is necessary to use std::set and is basically the same as !=
bool
Line
::
operator
<
(
const
Line
&
l
)
const
{
return
(
!
(
*
this
==
l
));
}
double
Line
::
GetLength
()
const
{
...
...
geometry/Line.h
View file @
6c7cbcc4
...
...
@@ -161,6 +161,12 @@ public:
*/
bool
Overlapp
(
const
Line
&
l
)
const
;
/**
* return true if point the orthogonal projection of p on Line segment is on the
* line segment.
*/
bool
isBetween
(
const
Point
&
p
)
const
;
/**
* @return true if both segments are equal. The end points must be in the range of J_EPS.
* @see Macro.h
...
...
@@ -173,6 +179,15 @@ public:
*/
bool
operator
!=
(
const
Line
&
l
)
const
;
/**
* @return true if this < l segments are not equal. The end points must be in the range of J_EPS.
* @see Macro.h
*/
bool
operator
<
(
const
Line
&
l
)
const
;
/**
* @see http://alienryderflex.com/intersect/
* @see http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/e5993847-c7a9-46ec-8edc-bfb86bd689e3/
...
...
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