Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix inappropriate approximation of Math.exp #502

Merged
merged 1 commit into from
Apr 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions brouter-core/src/main/java/btools/router/KinematicPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/
package btools.router;

import btools.util.FastMath;


final class KinematicPath extends OsmPath {
private double ekin; // kinetic energy (Joule)
private double totalTime; // travel time (seconds)
Expand Down Expand Up @@ -57,7 +54,7 @@ protected double processWaySection(RoutingContext rc, double dist, double delta_

double curveSpeed = aa > 10. ? 200. / aa : 20.;
double distanceTime = dist / curveSpeed;
double decayFactor = FastMath.exp(-distanceTime / km.turnAngleDecayTime);
double decayFactor = Math.exp(-distanceTime / km.turnAngleDecayTime);
floatingAngleLeft = (float) (floatingAngleLeft * decayFactor);
floatingAngleRight = (float) (floatingAngleRight * decayFactor);

Expand Down
6 changes: 2 additions & 4 deletions brouter-core/src/main/java/btools/router/StdPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
*/
package btools.router;

import btools.util.FastMath;

final class StdPath extends OsmPath {
/**
* The elevation-hysteresis-buffer (0-10 m)
Expand Down Expand Up @@ -200,7 +198,7 @@ private double calcIncline(double dist) {
} else if (elevation_buffer < -min_delta) {
shift = min_delta;
}
double decayFactor = FastMath.exp(-dist / 100.);
double decayFactor = Math.exp(-dist / 100.);
float new_elevation_buffer = (float) ((elevation_buffer + shift) * decayFactor - shift);
double incline = (elevation_buffer - new_elevation_buffer) / dist;
elevation_buffer = new_elevation_buffer;
Expand All @@ -227,7 +225,7 @@ protected void computeKinematic(RoutingContext rc, double dist, double delta_h,
double f_roll = rc.totalMass * GRAVITY * (rc.defaultC_r + incline);
if (rc.footMode) {
// Use Tobler's hiking function for walking sections
speed = rc.maxSpeed * FastMath.exp(-3.5 * Math.abs(incline + 0.05));
speed = rc.maxSpeed * Math.exp(-3.5 * Math.abs(incline + 0.05));
} else if (rc.bikeMode) {
speed = solveCubic(rc.S_C_x, f_roll, rc.bikerPower);
speed = Math.min(speed, maxSpeed);
Expand Down
21 changes: 0 additions & 21 deletions brouter-util/src/main/java/btools/util/FastMath.java

This file was deleted.