Calculate distance between to geolocations.
More...
Go to the source code of this file.
|
int | main (int argc, char *argv[]) |
|
Calculate distance between to geolocations.
Definition in file distance.c.
◆ main()
int main |
( |
int |
argc, |
|
|
char * |
argv[] |
|
) |
| |
Definition at line 28 of file distance.c.
30 {
31
32 double x0[3], x1[3];
33
34
35 if (argc < 5)
36 ERRMSG(
"Give parameters: <lon0> <lat0> <lon1> <lat1>");
37
38
39 const double lon0 = atof(argv[1]);
40 const double lat0 = atof(argv[2]);
41 const double lon1 = atof(argv[3]);
42 const double lat1 = atof(argv[4]);
43
44
47 printf(
"%g\n",
DIST(x0, x1));
48
49 return EXIT_SUCCESS;
50}
void geo2cart(const double z, const double lon, const double lat, double *x)
Convert geolocation to Cartesian coordinates.
#define ERRMSG(...)
Print error message and quit program.
#define DIST(a, b)
Compute Cartesian distance between two vectors.