AIRS Code Collection
Functions
distance.c File Reference

Calculate distance between to geolocations. More...

#include "jurassic.h"

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Detailed Description

Calculate distance between to geolocations.

Definition in file distance.c.

Function Documentation

◆ 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 /* Check arguments... */
35 if (argc < 5)
36 ERRMSG("Give parameters: <lon0> <lat0> <lon1> <lat1>");
37
38 /* Read geolocations... */
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 /* Write distance to stdout... */
45 geo2cart(0, lon0, lat0, x0);
46 geo2cart(0, lon1, lat1, x1);
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.
Definition: jurassic.c:3500
#define ERRMSG(...)
Print error message and quit program.
Definition: jurassic.h:237
#define DIST(a, b)
Compute Cartesian distance between two vectors.
Definition: jurassic.h:134
Here is the call graph for this function: