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.
This commit is contained in:
quaelnix 2023-02-08 22:01:09 +01:00 committed by GitHub
parent 2387513a1f
commit 480977ec46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -177,13 +177,11 @@ final class StdPath extends OsmPath {
private double calcIncline(double dist) { private double calcIncline(double dist) {
double min_delta = 3.; double min_delta = 3.;
double shift; double shift = 0.;
if (elevation_buffer > min_delta) { if (elevation_buffer > min_delta) {
shift = -min_delta; shift = -min_delta;
} else if (elevation_buffer < min_delta) { } else if (elevation_buffer < -min_delta) {
shift = -min_delta; shift = min_delta;
} else {
return 0.;
} }
double decayFactor = FastMath.exp(-dist / 100.); double decayFactor = FastMath.exp(-dist / 100.);
float new_elevation_buffer = (float) ((elevation_buffer + shift) * decayFactor - shift); float new_elevation_buffer = (float) ((elevation_buffer + shift) * decayFactor - shift);