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

In "PedestrianOSM.getPotential()", check if target potential is located within an obstacle.

parent d8df84a1
......@@ -229,12 +229,19 @@ public class PedestrianOSM extends Pedestrian {
public double getPotential(IPoint newPos) {
double targetPotential = potentialFieldTarget.getPotential(newPos, this);
targetPotential *= -1;
// The target potential is intialized with "Double.MAX_VALUE" in obstacle regions!
// Multiplying "Double.MAX_VALUE" with "-1" would cause an agent to walk into an obstacle.
if (targetPotential != Double.MAX_VALUE) {
targetPotential *= -1;
double pedestrianPotential = potentialFieldPedestrian
.getAgentPotential(newPos, this, relevantPedestrians);
double obstacleRepulsionPotential = potentialFieldObstacle
.getObstaclePotential(newPos, this);
return targetPotential + pedestrianPotential
+ obstacleRepulsionPotential;
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