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
))));
15 QDebug
operator<<(QDebug dbg
, const Coordinates
&c
)
17 dbg
.nospace() << qSetRealNumberPrecision(10) << "Coordinates(" << c
.lon()
18 << ", " << c
.lat() << ")";