rename short variable names to be more telling

This commit is contained in:
Dennis Luxen 2015-01-23 09:47:44 +01:00
parent 8e105af232
commit bd1928e445
2 changed files with 16 additions and 15 deletions

View File

@ -34,16 +34,16 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <cmath> #include <cmath>
double ComputeAngle::OfThreeFixedPointCoordinates(const FixedPointCoordinate &A, double ComputeAngle::OfThreeFixedPointCoordinates(const FixedPointCoordinate &first,
const FixedPointCoordinate &C, const FixedPointCoordinate &second,
const FixedPointCoordinate &B) const FixedPointCoordinate &third)
{ {
const double v1x = (A.lon - C.lon) / COORDINATE_PRECISION; const double v1x = (first.lon - second.lon) / COORDINATE_PRECISION;
const double v1y = mercator::lat2y(A.lat / COORDINATE_PRECISION) - const double v1y = mercator::lat2y(first.lat / COORDINATE_PRECISION) -
mercator::lat2y(C.lat / COORDINATE_PRECISION); mercator::lat2y(second.lat / COORDINATE_PRECISION);
const double v2x = (B.lon - C.lon) / COORDINATE_PRECISION; const double v2x = (third.lon - second.lon) / COORDINATE_PRECISION;
const double v2y = mercator::lat2y(B.lat / COORDINATE_PRECISION) - const double v2y = mercator::lat2y(third.lat / COORDINATE_PRECISION) -
mercator::lat2y(C.lat / COORDINATE_PRECISION); mercator::lat2y(second.lat / COORDINATE_PRECISION);
double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180. / M_PI; double angle = (atan2_lookup(v2y, v2x) - atan2_lookup(v1y, v1x)) * 180. / M_PI;
while (angle < 0.) while (angle < 0.)

View File

@ -1,6 +1,6 @@
/* /*
Copyright (c) 2013, Project OSRM, Dennis Luxen, others Copyright (c) 2015, Project OSRM, Dennis Luxen, others
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, Redistribution and use in source and binary forms, with or without modification,
@ -29,13 +29,14 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define COMPUTE_ANGLE_HPP #define COMPUTE_ANGLE_HPP
struct FixedPointCoordinate; struct FixedPointCoordinate;
struct NodeInfo;
struct ComputeAngle struct ComputeAngle
{ {
/* Get angle of line segment (A,C)->(C,B), atan2 magic, formerly cosine theorem*/ // Get angle of line segment (A,C)->(C,B)
static double OfThreeFixedPointCoordinates(const FixedPointCoordinate &A, // atan2 magic, formerly cosine theorem
const FixedPointCoordinate &C, static double OfThreeFixedPointCoordinates(const FixedPointCoordinate &first,
const FixedPointCoordinate &B); const FixedPointCoordinate &second,
const FixedPointCoordinate &third);
}; };
#endif // COMPUTE_ANGLE_HPP #endif // COMPUTE_ANGLE_HPP