From 480977ec464697195ce1a9caca99a0a2a91e845c Mon Sep 17 00:00:00 2001 From: quaelnix <122357328+quaelnix@users.noreply.github.com> Date: Wed, 8 Feb 2023 22:01:09 +0100 Subject: [PATCH] Fix regression in travel time computation abrensch@17be365 introduced a bug that causes a negative bias in the calculated incline each time the elevation buffer is reset, which results in an additional misestimation of the travel time when via points are added. --- brouter-core/src/main/java/btools/router/StdPath.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/brouter-core/src/main/java/btools/router/StdPath.java b/brouter-core/src/main/java/btools/router/StdPath.java index b890c27..71ed848 100644 --- a/brouter-core/src/main/java/btools/router/StdPath.java +++ b/brouter-core/src/main/java/btools/router/StdPath.java @@ -177,13 +177,11 @@ final class StdPath extends OsmPath { private double calcIncline(double dist) { double min_delta = 3.; - double shift; + double shift = 0.; if (elevation_buffer > min_delta) { shift = -min_delta; - } else if (elevation_buffer < min_delta) { - shift = -min_delta; - } else { - return 0.; + } else if (elevation_buffer < -min_delta) { + shift = min_delta; } double decayFactor = FastMath.exp(-dist / 100.); float new_elevation_buffer = (float) ((elevation_buffer + shift) * decayFactor - shift);