I can't find difference between haversine and one used in qgeocoordinate.
Haversine
Code:
R = earth’s radius (mean radius = 6,371km)
Δlat = lat2− lat1
Δlong = long2− long1
a = sin²(Δlat/2) + cos(lat1).cos(lat2).sin²(Δlong/2)
c = 2.atan2(√a, √(1−a))
d = R.c
Formula in qgeocoordinate
Code:
double dlat = qgeocoordinate_degToRad(other.d->lat - d->lat);
double dlon = qgeocoordinate_degToRad(other.d->lng - d->lng);
double y = sin(dlat / 2.0) * sin(dlat / 2.0)
+ cos(qgeocoordinate_degToRad(d->lat))
* cos(qgeocoordinate_degToRad(other.d->lat))
* sin(dlon / 2.0) * sin(dlon / 2.0);
double x = 2 * atan2(sqrt(y), sqrt(1 - y));
return qreal(x * qgeocoordinate_EARTH_MEAN_RADIUS * 1000);
But if there is a difference please enlighten me because I'm working with distanceTo() function also.