Compute turn angles in mercartor projection. Implements issues #596,
#532
This commit is contained in:
@@ -397,12 +397,12 @@ unsigned EdgeBasedGraphFactory::GetNumberOfNodes() const {
|
||||
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/
|
||||
template<class CoordinateT>
|
||||
double EdgeBasedGraphFactory::GetAngleBetweenTwoEdges(const CoordinateT& A, const CoordinateT& C, const CoordinateT& B) const {
|
||||
const int v1x = A.lon - C.lon;
|
||||
const int v1y = A.lat - C.lat;
|
||||
const int v2x = B.lon - C.lon;
|
||||
const int v2y = B.lat - C.lat;
|
||||
const double v1x = (A.lon - C.lon)/100000.;
|
||||
const double v1y = lat2y(A.lat/100000.) - lat2y(C.lat/100000.);
|
||||
const double v2x = (B.lon - C.lon)/100000.;
|
||||
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)
|
||||
angle += 360;
|
||||
return angle;
|
||||
|
||||
@@ -45,6 +45,7 @@
|
||||
#include "../Extractor/ExtractorStructs.h"
|
||||
#include "../DataStructures/HashTable.h"
|
||||
#include "../DataStructures/ImportEdge.h"
|
||||
#include "../DataStructures/MercatorUtil.h"
|
||||
#include "../DataStructures/QueryEdge.h"
|
||||
#include "../DataStructures/Percent.h"
|
||||
#include "../DataStructures/TurnInstructions.h"
|
||||
|
||||
Reference in New Issue
Block a user