This commit is contained in:
Kilian committed 2022-09-11 21:20:13 +02:00
commit 6027095c38
8 files changed
+58 -84

No files matched your search

+13
View File
@@ -77,6 +77,19 @@ namespace geodata
return 2.0 * EARTH_M * asin(sqrt(u * u + cos(lat1r) * cos(lat2r) * v * v));
}
// Input in degrees, Output in metres
static inline double distanceEarthP(point from, point to)
{
double lat1r, lon1r, lat2r, lon2r, u, v;
lat1r = toRadians(from.latitude);
lon1r = toRadians(from.longitude);
lat2r = toRadians(to.latitude);
lon2r = toRadians(to.longitude);
u = sin((lat2r - lat1r) / 2);
v = sin((lon2r - lon1r) / 2);
return 2.0 * EARTH_M * asin(sqrt(u * u + cos(lat1r) * cos(lat2r) * v * v));
}
// Input and Output in degrees
static inline struct point calculatePointDD(struct point coordinates,
double bearing,