Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
9042126f
Commit
9042126f
authored
Oct 16, 2018
by
Marion Goedel
Browse files
Added a check if pedestrians that are generated are overlapping with obstacles.
parent
be202fad
Pipeline
#71957
failed with stages
in 48 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
VadereSimulator/src/org/vadere/simulator/control/SingleSourceController.java
View file @
9042126f
...
...
@@ -117,8 +117,9 @@ public class SingleSourceController extends SourceController {
VPoint
randomPoint
=
new
VPoint
(
rec
.
getMinX
()
+
random
.
nextDouble
()
*
rec
.
getWidth
(),
rec
.
getMinY
()
+
random
.
nextDouble
()
*
rec
.
getHeight
());
VShape
freeSpaceRequired
=
dynamicElementFactory
.
getDynamicElementRequiredPlace
(
randomPoint
);
// no intersection with other free spaces.
if
(
blockPedestrianShapes
.
stream
().
noneMatch
(
shape
->
shape
.
intersects
(
freeSpaceRequired
)))
{
// no intersection with other free spaces (obstacles & other pedestrians)
if
(
blockPedestrianShapes
.
stream
().
noneMatch
(
shape
->
shape
.
intersects
(
freeSpaceRequired
))
&&
this
.
getTopography
().
getObstacles
().
stream
().
noneMatch
(
obs
->
obs
.
getShape
().
intersects
(
freeSpaceRequired
)))
{
return
Optional
.
of
(
randomPoint
);
}
}
...
...
VadereSimulator/src/org/vadere/simulator/control/SourceController.java
View file @
9042126f
...
...
@@ -26,10 +26,11 @@ import java.util.Random;
public
abstract
class
SourceController
{
protected
final
double
NO_EVENT
=
Double
.
MAX_VALUE
;
public
static
final
double
SPAWN_BUFFER_SIZE
=
0.0
1
;
public
static
final
double
SPAWN_BUFFER_SIZE
=
0.0
3
;
protected
final
Source
source
;
private
final
DynamicElementFactory
dynamicElementFactory
;
private
final
Topography
topography
;
protected
final
Random
random
;
...
...
@@ -111,6 +112,10 @@ public abstract class SourceController {
abstract
protected
void
determineNumberOfSpawnsAndNextEvent
(
double
simTimeInSec
);
protected
Topography
getTopography
()
{
return
topography
;
}
protected
void
createNextEvent
()
{
if
(
isSourceWithOneSingleSpawnEvent
())
{
timeOfNextEvent
=
NO_EVENT
;
...
...
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