Skip to content

Commit

Permalink
minor copy-edits to PR #946
Browse files Browse the repository at this point in the history
  • Loading branch information
DennisOSRM committed Mar 12, 2014
1 parent ecfda14 commit e07423f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions DataStructures/EdgeBasedNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include <boost/assert.hpp>

#include "../Util/MercatorUtil.h"
#include "../Util/SimpleLogger.h"
#include "../typedefs.h"

#include <osrm/Coordinate.h>
Expand Down Expand Up @@ -36,7 +35,7 @@ struct EdgeBasedNode {
FixedPointCoordinate & nearest_location,
double & ratio,
double precision = COORDINATE_PRECISION
) const {
) const {
BOOST_ASSERT( query_location.isValid() );

const double epsilon = 1.0/precision;
Expand All @@ -51,7 +50,7 @@ struct EdgeBasedNode {

// r : query location
const Point r(lat2y(query_location.lat/COORDINATE_PRECISION),
query_location.lon/COORDINATE_PRECISION);
query_location.lon/COORDINATE_PRECISION);

const Point foot = ComputePerpendicularFoot(p, q, r, epsilon);
ratio = ComputeRatio(p, q, foot, epsilon);
Expand Down Expand Up @@ -103,7 +102,6 @@ struct EdgeBasedNode {

typedef std::pair<double,double> Point;


// Compute the perpendicular foot of point r on the line defined by p and q.
Point ComputePerpendicularFoot(const Point &p, const Point &q, const Point &r, double epsilon) const {

Expand Down Expand Up @@ -131,7 +129,7 @@ struct EdgeBasedNode {
double ComputeRatio(const Point & p, const Point & q, const Point & r, double epsilon) const {

const bool is_parallel_to_x_axis = std::abs(q.second-p.second) < epsilon;
const bool is_parallel_to_y_axis = std::abs(q.first-p.first) < epsilon;
const bool is_parallel_to_y_axis = std::abs(q.first -p.first ) < epsilon;

double ratio;

Expand Down Expand Up @@ -164,12 +162,13 @@ struct EdgeBasedNode {
return FixedPointCoordinate(lat1, lon1);
} else if( lambda >= 1.0 ) {
return FixedPointCoordinate(lat2, lon2);
} else {
// r lies between p and q
return FixedPointCoordinate(y2lat(r.first)*COORDINATE_PRECISION,
r.second*COORDINATE_PRECISION);
}

// r lies between p and q
return FixedPointCoordinate(
y2lat(r.first)*COORDINATE_PRECISION,
r.second*COORDINATE_PRECISION
);
}

};
Expand Down

0 comments on commit e07423f

Please sign in to comment.