From e8167b2e4e356c45c6aaba7450df6729f3c221f6 Mon Sep 17 00:00:00 2001 From: Michael Krasnyk Date: Tue, 17 Jan 2017 17:17:47 +0100 Subject: [PATCH] Use round for float to fixed coordinate transformations --- features/bicycle/ferry.feature | 6 +- features/bicycle/maxspeed.feature | 28 ++-- features/bicycle/surface.feature | 32 ++--- features/car/maxspeed.feature | 15 +-- features/car/speed.feature | 22 ++-- features/foot/ferry.feature | 6 +- .../guidance/staggered-intersections.feature | 2 +- features/guidance/turn-angles.feature | 2 +- features/testbot/bearing_param.feature | 14 +- features/testbot/compression.feature | 4 +- features/testbot/distance.feature | 124 +++++++++--------- features/testbot/distance_matrix.feature | 6 +- features/testbot/ferry.feature | 8 +- features/testbot/matching.feature | 20 +-- features/testbot/origin.feature | 4 +- features/testbot/projection.feature | 28 ++-- features/testbot/trip.feature | 12 +- include/util/coordinate.hpp | 6 +- unit_tests/extractor/raster_source.cpp | 2 +- unit_tests/library/route.cpp | 2 +- unit_tests/library/tile.cpp | 8 +- unit_tests/util/coordinate_calculation.cpp | 6 +- 22 files changed, 179 insertions(+), 178 deletions(-) diff --git a/features/bicycle/ferry.feature b/features/bicycle/ferry.feature index 056786b03..3b3950c49 100644 --- a/features/bicycle/ferry.feature +++ b/features/bicycle/ferry.feature @@ -64,6 +64,6 @@ Feature: Bike - Handle ferry routes | abcd | | ferry | yes | 1:00 | When I route I should get - | from | to | route | time | - | a | d | abcd,abcd | 3600s +-10 | - | d | a | abcd,abcd | 3600s +-10 | + | from | to | route | time | + | a | d | abcd,abcd | 3600s | + | d | a | abcd,abcd | 3600s | diff --git a/features/bicycle/maxspeed.feature b/features/bicycle/maxspeed.feature index 32b71c5f1..a4fc57b3d 100644 --- a/features/bicycle/maxspeed.feature +++ b/features/bicycle/maxspeed.feature @@ -7,15 +7,15 @@ Feature: Bike - Max speed restrictions Scenario: Bicycle - Respect maxspeeds when lower that way type speed Then routability should be - | highway | maxspeed | bothw | - | residential | | 15 km/h +- 1 | - | residential | 10 | 10 km/h +- 1 | + | highway | maxspeed | bothw | + | residential | | 15 km/h | + | residential | 10 | 9 km/h | Scenario: Bicycle - Ignore maxspeed when higher than way speed Then routability should be - | highway | maxspeed | bothw | - | residential | | 15 km/h +- 1 | - | residential | 80 | 15 km/h | + | highway | maxspeed | bothw | + | residential | | 15 km/h | + | residential | 80 | 15 km/h | @todo Scenario: Bicycle - Maxspeed formats @@ -63,14 +63,14 @@ Feature: Bike - Max speed restrictions | snail | 720s ~10% | Then routability should be - | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | - | | | | 15 km/h +- 1 | 15 km/h +- 1 | - | 10 | | | 10 km/h +- 1 | 10 km/h +- 1 | - | | 10 | | 10 km/h +- 1 | 15 km/h +- 1 | - | | | 10 | 15 km/h | 10 km/h +- 1 | - | 2 | 10 | | 10 km/h +- 1 | 2 km/h | - | 2 | | 10 | 2 km/h | 10 km/h +- 1 | - | 2 | 5 | 10 | 5 km/h | 10 km/h +- 1 | + | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | + | | | | 15 km/h | 15 km/h | + | 10 | | | 9 km/h | 9 km/h | + | | 10 | | 9 km/h | 15 km/h | + | | | 10 | 14 km/h | 9 km/h | + | 2 | 10 | | 9 km/h | 2 km/h | + | 2 | | 10 | 2 km/h | 9 km/h | + | 2 | 5 | 10 | 5 km/h | 9 km/h | Scenario: Bike - Maxspeed should not allow routing on unroutable ways Then routability should be diff --git a/features/bicycle/surface.feature b/features/bicycle/surface.feature index f7326bbf5..68ff93671 100644 --- a/features/bicycle/surface.feature +++ b/features/bicycle/surface.feature @@ -6,27 +6,27 @@ Feature: Bike - Surfaces Scenario: Bicycle - Slow surfaces Then routability should be - | highway | surface | bothw | - | cycleway | | 48 s | - | cycleway | asphalt | 47.9 s| - | cycleway | cobblestone:flattened | 72 s | - | cycleway | paving_stones | 72 s | - | cycleway | compacted | 72 s | - | cycleway | cobblestone | 120 s | - | cycleway | fine_gravel | 120 s | - | cycleway | gravel | 120 s | - | cycleway | pebblestone | 120 s | - | cycleway | dirt | 120 s | - | cycleway | earth | 120 s | - | cycleway | grass | 120 s | - | cycleway | mud | 240 s | - | cycleway | sand | 240 s | + | highway | surface | bothw | + | cycleway | | 48 s | + | cycleway | asphalt | 48 s | + | cycleway | cobblestone:flattened | 72 s | + | cycleway | paving_stones | 72 s | + | cycleway | compacted | 72 s | + | cycleway | cobblestone | 120 s | + | cycleway | fine_gravel | 120 s | + | cycleway | gravel | 120 s | + | cycleway | pebblestone | 120.1 s | + | cycleway | dirt | 120 s | + | cycleway | earth | 120 s | + | cycleway | grass | 120 s | + | cycleway | mud | 240 s | + | cycleway | sand | 240.1 s | Scenario: Bicycle - Good surfaces on small paths Then routability should be | highway | surface | bothw | | cycleway | | 48 s | - | path | | 59.9 s| + | path | | 60 s | | track | | 60 s | | track | asphalt | 60 s | | path | asphalt | 60 s | diff --git a/features/car/maxspeed.feature b/features/car/maxspeed.feature index a2ef8dc49..06f11d652 100644 --- a/features/car/maxspeed.feature +++ b/features/car/maxspeed.feature @@ -55,8 +55,8 @@ OSRM will use 4/5 of the projected free-flow speed. | highway | maxspeed | maxspeed:forward | maxspeed:backward | forw | backw | | primary | | | | 52 km/h | 52 km/h | | primary | 60 | | | 48 km/h | 48 km/h | - | primary | | 60 | | 48 km/h | 48 km/h +- 5 | - | primary | | | 60 | 52 km/h | 52 km/h +- 5 | + | primary | | 60 | | 48 km/h | 52 km/h | + | primary | | | 60 | 52 km/h | 48 km/h | | primary | 15 | 60 | | 48 km/h | 12 km/h | | primary | 15 | | 60 | 12 km/h | 48 km/h | | primary | 15 | 30 | 60 | 24 km/h | 48 km/h | @@ -91,11 +91,11 @@ OSRM will use 4/5 of the projected free-flow speed. | primary | | | | 60 | 52 km/h | 47 km/h | | primary | | 3 | | 60 | 32 km/h | 29 km/h | | primary | 15 | | 60 | | 47 km/h | 11 km/h | - | primary | 15 | 3 | 60 | | 29 km/h | 7 km/h | + | primary | 15 | 3 | 60 | | 30 km/h | 7 km/h | | primary | 15 | | | 60 | 12 km/h | 47 km/h | | primary | 15 | 3 | | 60 | 7 km/h | 29 km/h | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | - | primary | 15 | 3 | 30 | 60 | 14 km/h | 29 km/h | + | primary | 15 | 3 | 30 | 60 | 15 km/h | 29 km/h | Scenario: Car - Single lane streets be ignored or incur a penalty Then routability should be @@ -110,11 +110,11 @@ OSRM will use 4/5 of the projected free-flow speed. | primary | | | | 60 | 52 km/h | 47 km/h | | primary | | 1 | | 60 | 32 km/h | 29 km/h | | primary | 15 | | 60 | | 47 km/h | 11 km/h | - | primary | 15 | 1 | 60 | | 29 km/h | 7 km/h | + | primary | 15 | 1 | 60 | | 30 km/h | 7 km/h | | primary | 15 | | | 60 | 12 km/h | 47 km/h | | primary | 15 | 1 | | 60 | 7 km/h | 29 km/h | | primary | 15 | | 30 | 60 | 23 km/h | 47 km/h | - | primary | 15 | 1 | 30 | 60 | 14 km/h | 29 km/h | + | primary | 15 | 1 | 30 | 60 | 15 km/h | 29 km/h | Scenario: Car - Single lane streets only incure a penalty for two-way streets Then routability should be @@ -131,6 +131,5 @@ OSRM will use 4/5 of the projected free-flow speed. | primary | 30 | | | -1 | | 23 km/h | | primary | | 30 | | -1 | | 52 km/h | | primary | | | 30 | -1 | | 23 km/h | - | primary | 20 | 30 | | -1 | | 16 km/h | + | primary | 20 | 30 | | -1 | | 15 km/h | | primary | 20 | | 30 | -1 | | 23 km/h | - diff --git a/features/car/speed.feature b/features/car/speed.feature index 40588223c..f596193de 100644 --- a/features/car/speed.feature +++ b/features/car/speed.feature @@ -9,7 +9,7 @@ Feature: Car - speeds Then routability should be | highway | oneway | bothw | | motorway | no | 71 km/h | - | motorway_link | no | 36 km/h | + | motorway_link | no | 35 km/h | | trunk | no | 68 km/h | | trunk_link | no | 31 km/h | | primary | no | 52 km/h | @@ -21,17 +21,17 @@ Feature: Car - speeds | unclassified | no | 19 km/h | | residential | no | 19 km/h | | living_street | no | 8 km/h | - | service | no | 11 km/h | + | service | no | 12 km/h | # Alternating oneways have to take average waiting time into account. Scenario: Car - scaled speeds for oneway=alternating Then routability should be - | highway | oneway | junction | forw | backw | # | - | tertiary | | | 31 km/h | 31 km/h | | - | tertiary | alternating | | 12 km/h +- 1 | 12 km/h +- 1 | | - | motorway | | | 71 km/h | | implied oneway | - | motorway | alternating | | 28 km/h +- 1 | | implied oneway | - | motorway | reversible | | | | unroutable | - | primary | | roundabout | 52 km/h | | implied oneway | - | primary | alternating | roundabout | 20 km/h +- 1 | | implied oneway | - | primary | reversible | roundabout | | | unroutable | + | highway | oneway | junction | forw | backw | # | + | tertiary | | | 31 km/h | 31 km/h | | + | tertiary | alternating | | 12 km/h | 12 km/h | | + | motorway | | | 71 km/h | | implied oneway | + | motorway | alternating | | 28 km/h | | implied oneway | + | motorway | reversible | | | | unroutable | + | primary | | roundabout | 52 km/h | | implied oneway | + | primary | alternating | roundabout | 20 km/h | | implied oneway | + | primary | reversible | roundabout | | | unroutable | diff --git a/features/foot/ferry.feature b/features/foot/ferry.feature index a690af4a2..e9caec189 100644 --- a/features/foot/ferry.feature +++ b/features/foot/ferry.feature @@ -64,6 +64,6 @@ Feature: Foot - Handle ferry routes | abcd | | ferry | yes | 1:00 | When I route I should get - | from | to | route | time | - | a | d | abcd,abcd | 3600s +-10 | - | d | a | abcd,abcd | 3600s +-10 | + | from | to | route | time | + | a | d | abcd,abcd | 3600s | + | d | a | abcd,abcd | 3600s | diff --git a/features/guidance/staggered-intersections.feature b/features/guidance/staggered-intersections.feature index 655b30fc4..598e92a71 100644 --- a/features/guidance/staggered-intersections.feature +++ b/features/guidance/staggered-intersections.feature @@ -105,7 +105,7 @@ Feature: Staggered Intersections j a b c d - e f g + e f g h """ diff --git a/features/guidance/turn-angles.feature b/features/guidance/turn-angles.feature index f9db77892..fb9dae653 100644 --- a/features/guidance/turn-angles.feature +++ b/features/guidance/turn-angles.feature @@ -1358,7 +1358,7 @@ Feature: Simple Turns | | | - g a - - -b + ga - - -b f / d -c """ diff --git a/features/testbot/bearing_param.feature b/features/testbot/bearing_param.feature index 09479ded9..dca67a451 100644 --- a/features/testbot/bearing_param.feature +++ b/features/testbot/bearing_param.feature @@ -37,13 +37,13 @@ Feature: Bearing parameter | bc | When I route I should get - | from | to | bearings | route | bearing | - | 0 | c | 0 0 | | | - | 0 | c | 45 45 | bc,bc | 0->44,44->0 +- 1 | - | 0 | c | 85 85 | | | - | 0 | c | 95 95 | | | - | 0 | c | 135 135 | ac,ac | 0->135,135->0 +- 1| - | 0 | c | 180 180 | | | + | from | to | bearings | route | bearing | + | 0 | c | 0 0 | | | + | 0 | c | 45 45 | bc,bc | 0->45,45->0 | + | 0 | c | 85 85 | | | + | 0 | c | 95 95 | | | + | 0 | c | 135 135 | ac,ac | 0->135,135->0 | + | 0 | c | 180 180 | | | Scenario: Testbot - Initial bearing on split way Given the node map diff --git a/features/testbot/compression.feature b/features/testbot/compression.feature index 27255f2a1..033cc3335 100644 --- a/features/testbot/compression.feature +++ b/features/testbot/compression.feature @@ -20,5 +20,5 @@ Feature: Geometry Compression When I route I should get | from | to | route | distance | speed | - | b | e | abcdef,abcdef | 588.6m | 36 km/h | - | e | b | abcdef,abcdef | 588.6m | 36 km/h | + | b | e | abcdef,abcdef | 588.5m | 36 km/h | + | e | b | abcdef,abcdef | 588.5m | 36 km/h | diff --git a/features/testbot/distance.feature b/features/testbot/distance.feature index 83be25178..d8a8ea719 100644 --- a/features/testbot/distance.feature +++ b/features/testbot/distance.feature @@ -16,8 +16,8 @@ Feature: Distance calculation | ab | When I route I should get - | from | to | route | distance | - | a | b | ab,ab | 100m +- 2 | + | from | to | route | distance | + | a | b | ab,ab | 100m | Scenario: Distance should equal sum of segments, leftwinded Given the node map @@ -33,7 +33,7 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | d | abcde,abcde | 300m +-2 | + | a | d | abcde,abcde | 300m +-1 | Scenario: Distance should equal sum of segments, rightwinded Given the node map @@ -49,7 +49,7 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | d | abcde,abcde | 300m +-2 | + | a | d | abcde,abcde | 300m +-1 | Scenario: 10m distances Given a grid size of 10 meters @@ -65,12 +65,12 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | abc,abc | 10m +-2 | - | b | a | abc,abc | 10m +-2 | - | b | c | abc,abc | 10m +-2 | - | c | b | abc,abc | 10m +-2 | - | a | c | abc,abc | 20m +-4 | - | c | a | abc,abc | 20m +-4 | + | a | b | abc,abc | 10m | + | b | a | abc,abc | 10m | + | b | c | abc,abc | 10m | + | c | b | abc,abc | 10m | + | a | c | abc,abc | 20m | + | c | a | abc,abc | 20m | Scenario: 100m distances Given a grid size of 100 meters @@ -86,12 +86,12 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | abc,abc | 100m +-2 | - | b | a | abc,abc | 100m +-2 | - | b | c | abc,abc | 100m +-2 | - | c | b | abc,abc | 100m +-2 | - | a | c | abc,abc | 200m +-4 | - | c | a | abc,abc | 200m +-4 | + | a | b | abc,abc | 100m | + | b | a | abc,abc | 100m | + | b | c | abc,abc | 100m | + | c | b | abc,abc | 100m | + | a | c | abc,abc | 200m | + | c | a | abc,abc | 200m | Scenario: 1km distance Given a grid size of 1000 meters @@ -107,12 +107,12 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | abc,abc | 1000m +-2 | - | b | a | abc,abc | 1000m +-2 | - | b | c | abc,abc | 1000m +-2 | - | c | b | abc,abc | 1000m +-2 | - | a | c | abc,abc | 2000m +-4 | - | c | a | abc,abc | 2000m +-4 | + | a | b | abc,abc | 1000m +-1 | + | b | a | abc,abc | 1000m +-1 | + | b | c | abc,abc | 1000m +-1 | + | c | b | abc,abc | 1000m +-1 | + | a | c | abc,abc | 2000m +-1 | + | c | a | abc,abc | 2000m +-1 | Scenario: Distance of a winding south-north path Given a grid size of 10 meters @@ -130,13 +130,13 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | abcdefgh,abcdefgh | 10m +-2 | - | a | c | abcdefgh,abcdefgh | 20m +-4 | - | a | d | abcdefgh,abcdefgh | 30m +-6 | - | a | e | abcdefgh,abcdefgh | 40m +-8 | - | a | f | abcdefgh,abcdefgh | 50m +-10 | - | a | g | abcdefgh,abcdefgh | 60m +-12 | - | a | h | abcdefgh,abcdefgh | 70m +-14 | + | a | b | abcdefgh,abcdefgh | 10m | + | a | c | abcdefgh,abcdefgh | 20m | + | a | d | abcdefgh,abcdefgh | 30m | + | a | e | abcdefgh,abcdefgh | 40m | + | a | f | abcdefgh,abcdefgh | 50m | + | a | g | abcdefgh,abcdefgh | 60m +-1 | + | a | h | abcdefgh,abcdefgh | 70m +-1 | Scenario: Distance of a winding east-west path Given a grid size of 10 meters @@ -152,13 +152,13 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | b | abcdefgh,abcdefgh | 10m +-2 | - | a | c | abcdefgh,abcdefgh | 20m +-4 | - | a | d | abcdefgh,abcdefgh | 30m +-6 | - | a | e | abcdefgh,abcdefgh | 40m +-8 | - | a | f | abcdefgh,abcdefgh | 50m +-10 | - | a | g | abcdefgh,abcdefgh | 60m +-12 | - | a | h | abcdefgh,abcdefgh | 70m +-14 | + | a | b | abcdefgh,abcdefgh | 10m | + | a | c | abcdefgh,abcdefgh | 20m | + | a | d | abcdefgh,abcdefgh | 30m | + | a | e | abcdefgh,abcdefgh | 40m | + | a | f | abcdefgh,abcdefgh | 50m | + | a | g | abcdefgh,abcdefgh | 60m +-1 | + | a | h | abcdefgh,abcdefgh | 70m +-1 | Scenario: Geometric distances Given a grid size of 100 meters @@ -201,31 +201,31 @@ Feature: Distance calculation | xy | When I route I should get - | from | to | route | distance | - | x | a | xa,xa | 300m +-2 | - | x | b | xb,xb | 316m +-2 | - | x | c | xc,xc | 360m +-2 | - | x | d | xd,xd | 424m +-2 | - | x | e | xe,xe | 360m +-2 | - | x | f | xf,xf | 316m +-2 | - | x | g | xg,xg | 300m +-2 | - | x | h | xh,xh | 316m +-2 | - | x | i | xi,xi | 360m +-2 | - | x | j | xj,xj | 424m +-2 | - | x | k | xk,xk | 360m +-2 | - | x | l | xl,xl | 316m +-2 | - | x | m | xm,xm | 300m +-2 | - | x | n | xn,xn | 316m +-2 | - | x | o | xo,xo | 360m +-2 | - | x | p | xp,xp | 424m +-2 | - | x | q | xq,xq | 360m +-2 | - | x | r | xr,xr | 316m +-2 | - | x | s | xs,xs | 300m +-2 | - | x | t | xt,xt | 316m +-2 | - | x | u | xu,xu | 360m +-2 | - | x | v | xv,xv | 424m +-2 | - | x | w | xw,xw | 360m +-2 | - | x | y | xy,xy | 316m +-2 | + | from | to | route | distance | + | x | a | xa,xa | 300m +-1 | + | x | b | xb,xb | 316m +-1 | + | x | c | xc,xc | 360m +-1 | + | x | d | xd,xd | 424m +-1 | + | x | e | xe,xe | 360m +-1 | + | x | f | xf,xf | 316m +-1 | + | x | g | xg,xg | 300m +-1 | + | x | h | xh,xh | 316m +-1 | + | x | i | xi,xi | 360m +-1 | + | x | j | xj,xj | 424m +-1 | + | x | k | xk,xk | 360m +-1 | + | x | l | xl,xl | 316m +-1 | + | x | m | xm,xm | 300m +-1 | + | x | n | xn,xn | 316m +-1 | + | x | o | xo,xo | 360m +-1 | + | x | p | xp,xp | 424m +-1 | + | x | q | xq,xq | 360m +-1 | + | x | r | xr,xr | 316m +-1 | + | x | s | xs,xs | 300m +-1 | + | x | t | xt,xt | 316m +-1 | + | x | u | xu,xu | 360m +-1 | + | x | v | xv,xv | 424m +-1 | + | x | w | xw,xw | 360m +-1 | + | x | y | xy,xy | 316m +-1 | @maze Scenario: Distance of a maze of short segments @@ -245,4 +245,4 @@ Feature: Distance calculation When I route I should get | from | to | route | distance | - | a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-2 | + | a | t | abcdefghijklmnopqrst,abcdefghijklmnopqrst | 133m +-1 | diff --git a/features/testbot/distance_matrix.feature b/features/testbot/distance_matrix.feature index 36683d4f2..743fb0d67 100644 --- a/features/testbot/distance_matrix.feature +++ b/features/testbot/distance_matrix.feature @@ -52,9 +52,9 @@ Feature: Basic Distance Matrix | ab | When I request a travel time matrix I should get - | | a | b | - | a | 0 | 9 +- 2 | - | b | 9 ~15% | 0 | + | | a | b | + | a | 0 | 10 | + | b | 10 | 0 | Scenario: Testbot - Travel time matrix of small grid Given the node map diff --git a/features/testbot/ferry.feature b/features/testbot/ferry.feature index a634f93cd..1fe98dfde 100644 --- a/features/testbot/ferry.feature +++ b/features/testbot/ferry.feature @@ -164,8 +164,8 @@ Feature: Testbot - Handle ferry routes | xa | primary | | | | yg | primary | | | | xy | primary | | | - | abcd | | ferry | 0:01 | - | defg | | ferry | 0:01 | + | abcd | | ferry | 0:02 | + | defg | | ferry | 0:02 | When I route I should get | from | to | route | time | @@ -187,8 +187,8 @@ Feature: Testbot - Handle ferry routes When I route I should get | from | to | route | time | - | a | g | abcdefg,abcdefg | 23400s +-2 | - | g | a | abcdefg,abcdefg | 23400s +-2 | + | a | g | abcdefg,abcdefg | 23400s +-3 | + | g | a | abcdefg,abcdefg | 23400s +-3 | @todo Scenario: Testbot - Ferry duration formats diff --git a/features/testbot/matching.feature b/features/testbot/matching.feature index a19ca2da9..56a6fe2fc 100644 --- a/features/testbot/matching.feature +++ b/features/testbot/matching.feature @@ -141,15 +141,15 @@ Feature: Basic Map Matching And the contract extra arguments "--segment-speed-file {speeds_file}" When I match I should get - | trace | matchings | annotation | - | abeh | abeh | 1:9.897633:1,0:0:0,1:10.008842:0,1:10.008842:0,1:10.008842:0,0:0:0,2:20.017685:0,1:10.008842:0 | - | abci | abci | 1:9.897633:1,0:0:0,1:10.008842:0,0:0.111209:0,1:10.010367:0 | + | trace | matchings | annotation | + | abeh | abeh | 1:10.008842:1,0:0:0,1:10.008842:0,1:10.008842:0,1:10.008842:0,0:0:0,2:19.906475:0,1:10.008842:0 | + | abci | abci | 1:10.008842:1,0:0:0,1:10.008842:0,0:0:0,1:10.010367:0 | # The following is the same as the above, but separated for readability (line length) When I match I should get | trace | matchings | OSM IDs | | abeh | abeh | 1,2,3,2,3,4,5,4,5,6,7 | - | abci | abci | 1,2,3,2,3,8,3,8 | + | abci | abci | 1,2,3,2,3,2,3,8 | Scenario: Testbot - Regression test for #3037 Given the query options @@ -174,8 +174,8 @@ Feature: Basic Map Matching | fb | yes | When I match I should get - | trace | matchings | geometry | - | efbc | efbc | 1,0.99964,1.000359,0.99964,1.000359,1,1.000718,1 | + | trace | matchings | geometry | + | efbc | efbc | 1,0.99964,1.00036,0.99964,1.00036,1,1.000719,1 | Scenario: Testbot - Geometry details using geojson Given the query options @@ -194,8 +194,8 @@ Feature: Basic Map Matching | bd | no | When I match I should get - | trace | matchings | geometry | - | abd | abd | 1,1,1.000089,1,1.000089,1,1.000089,0.99991 | + | trace | matchings | geometry | + | abd | abd | 1,1,1.00009,1,1.00009,1,1.00009,0.99991 | Scenario: Testbot - Geometry details using polyline Given the query options @@ -234,8 +234,8 @@ Feature: Basic Map Matching | bd | no | When I match I should get - | trace | matchings | geometry | - | abd | abd | 1,1,1,1.000089,1,1.000089,0.99991,1.000089 | + | trace | matchings | geometry | + | abd | abd | 1,1,1,1.00009,1,1.00009,0.99991,1.00009 | Scenario: Testbot - Speed greater than speed threshhold Given a grid size of 10 meters diff --git a/features/testbot/origin.feature b/features/testbot/origin.feature index e56e94dc8..c21febd07 100644 --- a/features/testbot/origin.feature +++ b/features/testbot/origin.feature @@ -53,7 +53,7 @@ Feature: Routing close to the [0,0] origin When I route I should get | from | to | route | distance | - | b | d | abcde,abcde | 200m +-2 | + | b | d | abcde,abcde | 200m | | d | b | | | Scenario: North-south oneways crossing the origin @@ -71,5 +71,5 @@ Feature: Routing close to the [0,0] origin When I route I should get | from | to | route | distance | - | b | d | abcde,abcde | 200m +-2 | + | b | d | abcde,abcde | 200m | | d | b | | | diff --git a/features/testbot/projection.feature b/features/testbot/projection.feature index cabd38e96..6d330b237 100644 --- a/features/testbot/projection.feature +++ b/features/testbot/projection.feature @@ -11,11 +11,11 @@ Feature: Projection to nearest point on road Given the profile "testbot" Given the node locations - | node | lat | lon | - | a | 80.00000 | 0.00000 | - | b | 80.00639 | 0.03667 | - | c | 80.01278 | 0.07333 | - | d | 80.00000 | 0.07333 | + | node | lat | lon | + | a | 80.000000 | 0.0000000 | + | b | 80.006350 | 0.0366666 | + | c | 80.012730 | 0.0733333 | + | d | 80.000000 | 0.0733333 | And the ways | nodes | @@ -23,16 +23,16 @@ Feature: Projection to nearest point on road Scenario: Projection onto way at high latitudes, 1km distance When I route I should get - | from | to | route | bearing | distance | - | b | a | abc,abc | 0->225,225->0 | 1000m +- 7 | - | b | c | abc,abc | 0->45,45->0 | 1000m +- 7 | - | a | d | abc,abc | 0->45,45->0 | 1000m +- 7 | - | d | a | abc,abc | 0->225,225->0 | 1000m +- 7 | - | c | d | abc,abc | 0->225,224->0 | 1000m +- 8 | - | d | c | abc,abc | 0->44,45->0 | 1000m +- 8 | + | from | to | route | bearing | distance | + | b | a | abc,abc | 0->225,225->0 | 1000m | + | b | c | abc,abc | 0->45,45->0 | 1000m +- 3 | + | a | d | abc,abc | 0->45,45->0 | 1000m | + | d | a | abc,abc | 0->225,225->0 | 1000m | + | c | d | abc,abc | 0->225,225->0 | 1000m +- 3 | + | d | c | abc,abc | 0->45,45->0 | 1000m +- 3 | Scenario: Projection onto way at high latitudes, no distance When I route I should get | from | to | route | distance | - | d | b | abc,abc | 0m +-5 | - | b | d | abc,abc | 0m +-5 | + | d | b | abc,abc | 0m | + | b | d | abc,abc | 0m | diff --git a/features/testbot/trip.feature b/features/testbot/trip.feature index 52d262d82..743224c67 100644 --- a/features/testbot/trip.feature +++ b/features/testbot/trip.feature @@ -141,9 +141,9 @@ Feature: Basic trip planning | da | When I plan a trip I should get - | waypoints | trips | durations | geometry | - | a,b,c,d | abcda | 7.6 | 1,1,1.000089,1,1,0.99991,1.000089,1,1,1,1.000089,0.99991,1,1 | - | d,b,c,a | dbcad | 7.6 | 1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089,1,1,1,1.000089,0.99991 | + | waypoints | trips | durations | geometry | + | a,b,c,d | abcda | 7.6 | 1,1,1.00009,1,1,0.99991,1.00009,1,1,1,1.00009,0.99991,1,1 | + | d,b,c,a | dbcad | 7.6 | 1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1,1,1.00009,0.99991 | Scenario: Testbot - Trip with geometry details of polyline Given the query options @@ -185,6 +185,6 @@ Feature: Basic trip planning | da | When I plan a trip I should get - | waypoints | trips | durations | geometry | - | a,b,c,d | abcda | 7.6 | 1,1,1,1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089,1,1 | - | d,b,c,a | dbcad | 7.6 | 0.99991,1.000089,1,1,1,1.000089,0.99991,1,1,1.000089,1,1,0.99991,1.000089 | + | waypoints | trips | durations | geometry | + | a,b,c,d | abcda | 7.6 | 1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009,1,1 | + | d,b,c,a | dbcad | 7.6 | 0.99991,1.00009,1,1,1,1.00009,0.99991,1,1,1.00009,1,1,0.99991,1.00009 | diff --git a/include/util/coordinate.hpp b/include/util/coordinate.hpp index e2b2a537b..13aca3d94 100644 --- a/include/util/coordinate.hpp +++ b/include/util/coordinate.hpp @@ -60,7 +60,8 @@ OSRM_STRONG_TYPEDEF(double, FloatLongitude) inline FixedLatitude toFixed(const FloatLatitude floating) { const auto latitude = static_cast(floating); - const auto fixed = boost::numeric_cast(latitude * COORDINATE_PRECISION); + const auto fixed = + boost::numeric_cast(std::round(latitude * COORDINATE_PRECISION)); return FixedLatitude{fixed}; } @@ -74,7 +75,8 @@ inline FixedLatitude toFixed(const FloatLatitude floating) inline FixedLongitude toFixed(const FloatLongitude floating) { const auto longitude = static_cast(floating); - const auto fixed = boost::numeric_cast(longitude * COORDINATE_PRECISION); + const auto fixed = + boost::numeric_cast(std::round(longitude * COORDINATE_PRECISION)); return FixedLongitude{fixed}; } diff --git a/unit_tests/extractor/raster_source.cpp b/unit_tests/extractor/raster_source.cpp index 7693c6370..cbfac6433 100644 --- a/unit_tests/extractor/raster_source.cpp +++ b/unit_tests/extractor/raster_source.cpp @@ -63,7 +63,7 @@ BOOST_AUTO_TEST_CASE(raster_test) CHECK_INTERPOLATE(0, 1.08, 1.05, 160); CHECK_INTERPOLATE(0, 1.01, 1.05, 20); // ARBITRARY - BETWEEN DATA - CHECK_INTERPOLATE(0, 1.054, 1.023, 53); + CHECK_INTERPOLATE(0, 1.054, 1.023, 54); CHECK_INTERPOLATE(0, 1.056, 1.028, 68); CHECK_INTERPOLATE(0, 1.05, 1.028, 56); diff --git a/unit_tests/library/route.cpp b/unit_tests/library/route.cpp index 4ef0b06d8..d4c2db644 100644 --- a/unit_tests/library/route.cpp +++ b/unit_tests/library/route.cpp @@ -36,7 +36,7 @@ BOOST_AUTO_TEST_CASE(test_route_same_coordinates_fixture) for (auto &itr : result.values["waypoints"].get().values) itr.get().values["hint"] = ""; - const auto location = json::Array{{{7.437070}, {43.749247}}}; + const auto location = json::Array{{{7.437070}, {43.749248}}}; json::Object reference{ {{"code", "Ok"}, diff --git a/unit_tests/library/tile.cpp b/unit_tests/library/tile.cpp index 0ceb0f678..2e0f14ee9 100644 --- a/unit_tests/library/tile.cpp +++ b/unit_tests/library/tile.cpp @@ -32,7 +32,7 @@ BOOST_AUTO_TEST_CASE(test_tile) const auto rc = osrm.Tile(params, result); BOOST_CHECK(rc == Status::Ok); - BOOST_CHECK_EQUAL(result.size(), 114098); + BOOST_CHECK_EQUAL(result.size(), 114033); protozero::pbf_reader tile_message(result); tile_message.next(); @@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns) } std::sort(actual_turn_penalties.begin(), actual_turn_penalties.end()); const std::vector expected_turn_penalties = { - 0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.3f, 1.8f, 5.4f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f}; + 0, 0, 0, 0, 0, 0, .1f, .1f, .3f, .4f, 1.2f, 1.9f, 5.3f, 5.5f, 5.8f, 7.1f, 7.2f, 7.2f}; BOOST_CHECK(actual_turn_penalties == expected_turn_penalties); // Verify the expected turn angles @@ -342,7 +342,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns) } std::sort(actual_turn_angles.begin(), actual_turn_angles.end()); const std::vector expected_turn_angles = { - -123, -120, -118, -64, -57, -29, -28, -3, -2, 2, 3, 28, 29, 57, 64, 118, 120, 123}; + -122, -120, -117, -65, -57, -30, -28, -3, -2, 2, 3, 28, 30, 57, 65, 117, 120, 122}; BOOST_CHECK(actual_turn_angles == expected_turn_angles); // Verify the expected bearings @@ -354,7 +354,7 @@ BOOST_AUTO_TEST_CASE(test_tile_turns) } std::sort(actual_turn_bearings.begin(), actual_turn_bearings.end()); const std::vector expected_turn_bearings = { - 49, 49, 106, 106, 169, 169, 171, 171, 229, 229, 258, 258, 287, 287, 349, 349, 352, 352}; + 49, 49, 107, 107, 169, 169, 171, 171, 229, 229, 257, 257, 286, 286, 349, 349, 352, 352}; BOOST_CHECK(actual_turn_bearings == expected_turn_bearings); } diff --git a/unit_tests/util/coordinate_calculation.cpp b/unit_tests/util/coordinate_calculation.cpp index 32a9fd542..2abdda8ab 100644 --- a/unit_tests/util/coordinate_calculation.cpp +++ b/unit_tests/util/coordinate_calculation.cpp @@ -262,7 +262,7 @@ BOOST_AUTO_TEST_CASE(circleCenter) auto result = coordinate_calculation::circleCenter(a, b, c); BOOST_CHECK(result); - BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-100.000833}, FloatLatitude{10.000833})); + BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-100.0008333}, FloatLatitude{10.0008333})); // Co-linear longitude a = Coordinate(FloatLongitude{-100.}, FloatLatitude{10.}); @@ -285,7 +285,7 @@ BOOST_AUTO_TEST_CASE(circleCenter) c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259}); result = coordinate_calculation::circleCenter(a, b, c); BOOST_CHECK(result); - BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.09642}, FloatLatitude{41.14707})); + BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.09642}, FloatLatitude{41.1470705})); // Co-linear latitude, variation a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147101}); @@ -293,7 +293,7 @@ BOOST_AUTO_TEST_CASE(circleCenter) c = Coordinate(FloatLongitude{-112.096419}, FloatLatitude{41.147259}); result = coordinate_calculation::circleCenter(a, b, c); BOOST_CHECK(result); - BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.096512}, FloatLatitude{41.146962})); + BOOST_CHECK_EQUAL(*result, Coordinate(FloatLongitude{-112.0965125}, FloatLatitude{41.1469622})); // Co-linear latitude, impossible to calculate a = Coordinate(FloatLongitude{-112.096234}, FloatLatitude{41.147259});