Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit e288cfa1 authored by Benedikt Kleinmeier's avatar Benedikt Kleinmeier
Browse files

Revised comments in "OSMBehaviorController.java".

parent 0c8ac8ea
Pipeline #103955 failed with stages
in 51 minutes and 43 seconds
...@@ -148,11 +148,13 @@ public class OSMBehaviorController { ...@@ -148,11 +148,13 @@ public class OSMBehaviorController {
List<Pedestrian> closestPedestrians = topography.getSpatialMap(Pedestrian.class) List<Pedestrian> closestPedestrians = topography.getSpatialMap(Pedestrian.class)
.getObjects(positionOfPedestrian, pedestrian.getRadius() * 5); .getObjects(positionOfPedestrian, pedestrian.getRadius() * 5);
// Filter out "me" and pedestrians which are farer away from target than "me".
closestPedestrians = closestPedestrians.stream() closestPedestrians = closestPedestrians.stream()
.filter(candidate -> pedestrian.getId() != candidate.getId()) // Filter out "me". .filter(candidate -> pedestrian.getId() != candidate.getId())
.filter(candidate -> pedestrian.getTargetPotential(candidate.getPosition()) < pedestrian.getTargetPotential(pedestrian.getPosition())) // Filter out pedestrians which are farer away from target than me. .filter(candidate -> pedestrian.getTargetPotential(candidate.getPosition()) < pedestrian.getTargetPotential(pedestrian.getPosition()))
.collect(Collectors.toList()); .collect(Collectors.toList());
// Sort by distance away from "me".
closestPedestrians = closestPedestrians.stream() closestPedestrians = closestPedestrians.stream()
.sorted((pedestrian1, pedestrian2) -> .sorted((pedestrian1, pedestrian2) ->
Double.compare(positionOfPedestrian.distance(pedestrian1.getPosition()), positionOfPedestrian.distance(pedestrian2.getPosition()))) Double.compare(positionOfPedestrian.distance(pedestrian1.getPosition()), positionOfPedestrian.distance(pedestrian2.getPosition())))
...@@ -183,7 +185,7 @@ public class OSMBehaviorController { ...@@ -183,7 +185,7 @@ public class OSMBehaviorController {
* This is required to decide if pedestrian1 and pedestrian2 can be swapped because they have different walking * This is required to decide if pedestrian1 and pedestrian2 can be swapped because they have different walking
* directions. * directions.
* *
* @return An angle between 0 and <i>pi</i> or -1 if at least one of the given pedestrians has no target. * @return An angle between 0 and <i>pi</i> radian or -1 if at least one of the given pedestrians has no target.
*/ */
public double calculateAngleBetweenTargets(Pedestrian pedestrian1, Pedestrian pedestrian2, Topography topography) { public double calculateAngleBetweenTargets(Pedestrian pedestrian1, Pedestrian pedestrian2, Topography topography) {
double angleInRadian = -1; double angleInRadian = -1;
...@@ -206,6 +208,7 @@ public class OSMBehaviorController { ...@@ -206,6 +208,7 @@ public class OSMBehaviorController {
} }
private void swapPedestrians(Pedestrian pedestrian1, Pedestrian pedestrian2) { private void swapPedestrians(Pedestrian pedestrian1, Pedestrian pedestrian2) {
// TODO Use "makeStep()" to swap both pedestrians.
VPoint newPosition = pedestrian2.getPosition().clone(); VPoint newPosition = pedestrian2.getPosition().clone();
VPoint oldPosition = pedestrian1.getPosition().clone(); VPoint oldPosition = pedestrian1.getPosition().clone();
......
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