Commit c2bdee25 authored by Stefan Schuhbaeck's avatar Stefan Schuhbaeck

increase size of spwan grid in SourceController to ensure peds don't overlap

parent 82ba9393
......@@ -27,12 +27,18 @@ public abstract class SourceController {
protected final double NO_EVENT = Double.MAX_VALUE;
// Pedestrians should not touch each other in the spawn position.
// Therefore increase the spwan grid by 0.1.
private final double SAFETY_OVERLAP_FACTOR = 1.1;
protected final Source source;
private final DynamicElementFactory dynamicElementFactory;
private final Topography topography;
protected final Random random;
/** <code>null</code>, if there is no next event. */
/**
* <code>null</code>, if there is no next event.
*/
protected Double timeOfNextEvent;
protected RealDistribution distribution;
protected final AttributesSource sourceAttributes;
......@@ -52,7 +58,8 @@ public abstract class SourceController {
this.topography = scenario;
this.random = random;
this.spawnArray = new SpawnArray(new VRectangle(source.getShape().getBounds2D()),
new VRectangle(0, 0, getDynamicElementShape().getRadius() * 2, getDynamicElementShape().getRadius() * 2));
new VRectangle(0, 0, getDynamicElementShape().getRadius() * 2 * SAFETY_OVERLAP_FACTOR,
getDynamicElementShape().getRadius() * 2 * SAFETY_OVERLAP_FACTOR));
timeOfNextEvent = sourceAttributes.getStartTime();
try {
......@@ -130,8 +137,8 @@ public abstract class SourceController {
}
/**
* note that most models create their own pedestrians and ignore the attributes given here.
* the source is mostly used to set the position and target ids, not the attributes.
* note that most models create their own pedestrians and ignore the attributes given here. the
* source is mostly used to set the position and target ids, not the attributes.
*/
protected void addNewAgentToScenario(final List<VPoint> position) {
position.forEach(p -> addNewAgentToScenario(p));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment