Compute turn angles in mercartor projection. Implements issues #596,
#532
This commit is contained in:
parent
bec4e4437d
commit
2cc2c967d1
@ -397,12 +397,12 @@ unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
|||||||
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
|
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
|
||||||
template<class CoordinateT>
|
template<class CoordinateT>
|
||||||
double EdgeBasedGraphFactory::GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const {
|
double EdgeBasedGraphFactory::GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const {
|
||||||
const int v1x = A.lon - C.lon;
|
const double v1x = (A.lon - C.lon)/100000.;
|
||||||
const int v1y = A.lat - C.lat;
|
const double v1y = lat2y(A.lat/100000.) - lat2y(C.lat/100000.);
|
||||||
const int v2x = B.lon - C.lon;
|
const double v2x = (B.lon - C.lon)/100000.;
|
||||||
const int v2y = B.lat - C.lat;
|
const double v2y = lat2y(B.lat/100000.) - lat2y(C.lat/100000.);
|
||||||
|
|
||||||
double angle = (atan2((double)v2y,v2x) - atan2((double)v1y,v1x) )*180/M_PI;
|
double angle = (atan2(v2y,v2x) - atan2(v1y,v1x) )*180/M_PI;
|
||||||
while(angle < 0)
|
while(angle < 0)
|
||||||
angle += 360;
|
angle += 360;
|
||||||
return angle;
|
return angle;
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "../Extractor/ExtractorStructs.h"
|
#include "../Extractor/ExtractorStructs.h"
|
||||||
#include "../DataStructures/HashTable.h"
|
#include "../DataStructures/HashTable.h"
|
||||||
#include "../DataStructures/ImportEdge.h"
|
#include "../DataStructures/ImportEdge.h"
|
||||||
|
#include "../DataStructures/MercatorUtil.h"
|
||||||
#include "../DataStructures/QueryEdge.h"
|
#include "../DataStructures/QueryEdge.h"
|
||||||
#include "../DataStructures/Percent.h"
|
#include "../DataStructures/Percent.h"
|
||||||
#include "../DataStructures/TurnInstructions.h"
|
#include "../DataStructures/TurnInstructions.h"
|
||||||
|
@ -97,20 +97,27 @@ Feature: Turn directions/codes
|
|||||||
| g | c | xg,xc | head,right,destination |
|
| g | c | xg,xc | head,right,destination |
|
||||||
| g | e | xg,xe | head,sharp_right,destination |
|
| g | e | xg,xe | head,sharp_right,destination |
|
||||||
|
|
||||||
@todo
|
Scenario: Turn instructions at high latitude
|
||||||
Scenario: Skadestuevej, København
|
|
||||||
https://github.com/DennisOSRM/Project-OSRM/issues/532
|
https://github.com/DennisOSRM/Project-OSRM/issues/532
|
||||||
Given the node locations
|
Given the node locations
|
||||||
| node | lat | lon |
|
| node | lat | lon |
|
||||||
| a | 55.68740 | 12.52430 |
|
| a | 55.68740 | 12.52430 |
|
||||||
| b | 55.68745 | 12.52409 |
|
| b | 55.68745 | 12.52409 |
|
||||||
| c | 55.68711 | 12.52383 |
|
| c | 55.68711 | 12.52383 |
|
||||||
|
| x | -55.68740 | 12.52430 |
|
||||||
|
| y | -55.68745 | 12.52409 |
|
||||||
|
| z | -55.68711 | 12.52383 |
|
||||||
|
|
||||||
And the ways
|
And the ways
|
||||||
| nodes |
|
| nodes |
|
||||||
| ab |
|
| ab |
|
||||||
| bc |
|
| bc |
|
||||||
|
| xy |
|
||||||
|
| yz |
|
||||||
|
|
||||||
When I route I should get
|
When I route I should get
|
||||||
| from | to | route | turns |
|
| from | to | route | turns |
|
||||||
| a | c | ab,bc | head,left,destination |
|
| a | c | ab,bc | head,left,destination |
|
||||||
|
| c | a | bc,ab | head,right,destination |
|
||||||
|
| x | z | xy,yz | head,right,destination |
|
||||||
|
| z | x | yz,xy | head,left,destination |
|
||||||
|
Loading…
Reference in New Issue
Block a user