Commit 3c969e0d authored by Benedikt Zoennchen's avatar Benedikt Zoennchen
Browse files

quick fix in PedestrianVelocityProcessor: the velocity was NaN if the duration...

quick fix in PedestrianVelocityProcessor: the velocity was NaN if the duration was 0.0 now the velocity will be 0.0
parent 87eaa64e
...@@ -75,7 +75,7 @@ public class PedestrianVelocityProcessor extends DataProcessor<TimestepPedestria ...@@ -75,7 +75,7 @@ public class PedestrianVelocityProcessor extends DataProcessor<TimestepPedestria
VPoint posNow = pedPosProc.getValue(new TimestepPedestrianIdKey(timeStep, pedId)); VPoint posNow = pedPosProc.getValue(new TimestepPedestrianIdKey(timeStep, pedId));
double duration = (currentSimTime - lastSimTimes.getFirst()); double duration = (currentSimTime - lastSimTimes.getFirst());
double velocity = posNow.subtract(posBefore).scalarMultiply(1 / duration).distanceToOrigin(); double velocity = duration > 0 ? posNow.subtract(posBefore).scalarMultiply(1 / duration).distanceToOrigin() : 0;
return velocity; return velocity;
} }
......
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