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:
parent
2387513a1f
commit
480977ec46
1 changed files with 3 additions and 5 deletions
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue