From 1c415933dac772b9e20e5cf6c25b8cf115da5481 Mon Sep 17 00:00:00 2001 From: DennisOSRM Date: Wed, 19 Sep 2012 14:01:06 +0200 Subject: [PATCH] Fixing comparison of floats --- DataStructures/NNGrid.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DataStructures/NNGrid.h b/DataStructures/NNGrid.h index 80170295d..e35fa2b25 100644 --- a/DataStructures/NNGrid.h +++ b/DataStructures/NNGrid.h @@ -89,10 +89,10 @@ public: ramInFile.close(); } +#ifndef ROUTED template inline void ConstructGrid(DeallocatingVector & edgeList, char * ramIndexOut, char * fileIndexOut) { //TODO: Implement this using STXXL-Streams -#ifndef ROUTED Percent p(edgeList.size()); BOOST_FOREACH(EdgeT & edge, edgeList) { p.printIncrement(); @@ -147,8 +147,8 @@ public: ramFile.write((char *)&ramIndexTable[0], sizeof(unsigned long)*1024*1024 ); //close ram index file ramFile.close(); -#endif } +#endif bool FindPhantomNodeForCoordinate( const _Coordinate & location, PhantomNode & resultNode, const unsigned zoomLevel) { bool ignoreTinyComponents = (zoomLevel <= 14); @@ -450,15 +450,15 @@ private: localStream->read(static_cast(static_cast(&result[currentSizeOfResult])), lengthOfBucket*sizeof(_GridEdge)); } - inline void AddEdge(const _GridEdge & edge) { #ifndef ROUTED + inline void AddEdge(const _GridEdge & edge) { std::vector indexList; GetListOfIndexesForEdgeAndGridSize(edge.startCoord, edge.targetCoord, indexList); for(unsigned i = 0; i < indexList.size(); ++i) { entries.push_back(GridEntry(edge, indexList[i].first, indexList[i].second)); } -#endif } +#endif inline double ComputeDistance(const _Coordinate& inputPoint, const _Coordinate& source, const _Coordinate& target, _Coordinate& nearest, double *r) { @@ -469,7 +469,7 @@ private: const double c = static_cast(target.lat); const double d = static_cast(target.lon); double p,q,mX,nY; - if(fabs(a-c) < FLT_EPSILON){ + if(fabs(a-c) > FLT_EPSILON){ const double m = (d-b)/(c-a); // slope // Projection of (x,y) on line joining (a,b) and (c,d) p = ((x + (m*y)) + (m*m*a - m*b))/(1. + m*m);