Starting from 2021-07-01, all LRZ GitLab users will be required to explicitly accept the GitLab Terms of Service. Please see the detailed information at https://doku.lrz.de/display/PUBLIC/GitLab and make sure that your projects conform to the requirements.

Commit 9b60dc34 authored by Marion Goedel's avatar Marion Goedel
Browse files

[Bugfix] NumberOverlapsProcessor: The number of overlaps needs to be divided...

[Bugfix] NumberOverlapsProcessor: The number of overlaps needs to be divided by two since the overlaps occurs for both pedestrians that overlap.
parent 37fde165
Pipeline #64830 failed with stages
in 45 seconds
......@@ -51,16 +51,20 @@ public class NumberOverlapsProcessor extends DataProcessor<NoDataKey, Long> {
if (this.pedOverlapProc.getValues().size() > 0) {
numberOverlaps = this.pedOverlapProc.getValues().stream().filter(i -> i == 1).count();
numberOverlaps = this.pedOverlapProc.getValues().stream().filter(i -> i == 1).count()/2;
}
/* // Uncomment this code if you want to get the info box with the number of overlaps
if (numberOverlaps > 0 ) {
NumberOverlapsProcessor.infoBox(numberOverlaps + " Overlaps have occured during the simulation!", "Number Overlaps");
System.out.println("* CAREFUL *: " + numberOverlaps + " Overlaps have occured during the simulation!");
}
NumberOverlapsProcessor.infoBox(numberOverlaps/2 + " Overlaps have occured during the simulation!", "Number Overlaps");
System.out.println("* CAREFUL *: " + numberOverlaps/2 + " Overlaps have occured during the simulation!");
}else{
NumberOverlapsProcessor.infoBox("No Overlaps have occured during the simulation :)", "Number Overlaps");
}
*/
this.putValue(NoDataKey.key(), numberOverlaps);
}
......
......@@ -26,6 +26,7 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
@Override
protected void doUpdate(final SimulationState state) {
this.pedRadius = state.getTopography().getAttributesPedestrian().getRadius(); // in init there is no access to the state
Collection<Pedestrian> peds = state.getTopography().getElements(Pedestrian.class);
peds.forEach(p -> this.putValue(
new TimestepPedestrianIdKey(state.getStep(), p.getId()),
......@@ -41,7 +42,7 @@ public class PedestrianOverlapProcessor extends DataProcessor<TimestepPedestrian
}
private int calculateOverlaps(final Collection<Pedestrian> peds, VPoint pos) {
return (int) peds.stream().filter(p -> p.getPosition().distance(pos) < 2 * this.pedRadius).count() - 1;
return (int) peds.stream().filter(p -> p.getPosition().distance(pos) <= 2 * this.pedRadius).count() - 1;
}
@Override
......
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