diff --git a/brouter-core/src/main/java/btools/router/KinematicPath.java b/brouter-core/src/main/java/btools/router/KinematicPath.java index e15d2cb..2d84c6c 100644 --- a/brouter-core/src/main/java/btools/router/KinematicPath.java +++ b/brouter-core/src/main/java/btools/router/KinematicPath.java @@ -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) @@ -57,7 +54,7 @@ final class KinematicPath extends OsmPath { 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); diff --git a/brouter-core/src/main/java/btools/router/StdPath.java b/brouter-core/src/main/java/btools/router/StdPath.java index d7c8f34..925b06a 100644 --- a/brouter-core/src/main/java/btools/router/StdPath.java +++ b/brouter-core/src/main/java/btools/router/StdPath.java @@ -5,8 +5,6 @@ */ package btools.router; -import btools.util.FastMath; - final class StdPath extends OsmPath { /** * The elevation-hysteresis-buffer (0-10 m) @@ -200,7 +198,7 @@ final class StdPath extends OsmPath { } 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; @@ -227,7 +225,7 @@ final class StdPath extends OsmPath { 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); diff --git a/brouter-util/src/main/java/btools/util/FastMath.java b/brouter-util/src/main/java/btools/util/FastMath.java deleted file mode 100644 index 05d4431..0000000 --- a/brouter-util/src/main/java/btools/util/FastMath.java +++ /dev/null @@ -1,21 +0,0 @@ -package btools.util; - -/** - * Some fast approximations to mathematical functions - * - * @author ab - */ -public class FastMath { - /** - * Approximation to Math.exp for small negative arguments - */ - public static double exp(double e) { - double x = e; - double f = 1.; - while (e < -1.) { - e += 1.; - f *= 0.367879; - } - return f * (1. + x * (1. + x * (0.5 + x * (0.166667 + 0.0416667 * x)))); - } -}