The codec is always set when reading the GPI header
[GPXSee.git] / src / common / coordinates.cpp
blob8e065d3f1c7e5e29fb6578e64249061e0d65356d
1 #include "wgs84.h"
2 #include "coordinates.h"
4 double Coordinates::distanceTo(const Coordinates &c) const
6 double dLat = deg2rad(c.lat() - _lat);
7 double dLon = deg2rad(c.lon() - _lon);
8 double a = pow(sin(dLat / 2.0), 2.0)
9 + cos(deg2rad(_lat)) * cos(deg2rad(c.lat())) * pow(sin(dLon / 2.0), 2.0);
11 return (WGS84_RADIUS * (2.0 * atan2(sqrt(a), sqrt(1.0 - a))));
14 #ifndef QT_NO_DEBUG
15 QDebug operator<<(QDebug dbg, const Coordinates &c)
17 dbg.nospace() << qSetRealNumberPrecision(10) << "Coordinates(" << c.lon()
18 << ", " << c.lat() << ")";
19 return dbg.space();
21 #endif // QT_NO_DEBUG