diff options
author | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-06-28 16:45:36 +0300 |
---|---|---|
committer | Vladimir Byko-Ianko <v.bykoianko@corp.mail.ru> | 2016-07-23 10:25:10 +0300 |
commit | 504eca3c8df132eb2a6cc3d1736ae44762cdbc3a (patch) | |
tree | a77ec0b9d4c4d429045f631b84f38f52b29d90db /routing | |
parent | 06a48f68e87d06147d726827d131af4bd19bd62c (diff) |
Using altitude for bicycle and pedestrian routing.
Diffstat (limited to 'routing')
-rw-r--r-- | routing/routing_algorithm.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/routing/routing_algorithm.cpp b/routing/routing_algorithm.cpp index a4d0e85c0a..6f2fb26410 100644 --- a/routing/routing_algorithm.cpp +++ b/routing/routing_algorithm.cpp @@ -19,7 +19,9 @@ double constexpr KMPH2MPS = 1000.0 / (60 * 60); inline double TimeBetweenSec(Junction const & j1, Junction const & j2, double speedMPS) { ASSERT(speedMPS > 0.0, ()); - return MercatorBounds::DistanceOnEarth(j1.GetPoint(), j2.GetPoint()) / speedMPS; + double const distanceM = MercatorBounds::DistanceOnEarth(j1.GetPoint(), j2.GetPoint()); + double const altidudeDiffM = j2.GetAltitude() - j1.GetAltitude(); + return sqrt(distanceM * distanceM + altidudeDiffM * altidudeDiffM) / speedMPS; } /// A class which represents an weighted edge used by RoadGraph. |