C library for Geodesics  2.1
direct.c
Go to the documentation of this file.
1 /**
2  * @file direct.c
3  * @brief A test program for geod_direct()
4  **********************************************************************/
5 
6 #include <stdio.h>
7 #include "geodesic.h"
8 
9 #if defined(_MSC_VER)
10 /* Squelch warnings about scanf */
11 # pragma warning (disable: 4996)
12 #endif
13 
14 /**
15  * A simple program to solve the direct geodesic problem.
16  *
17  * This program reads in lines with lat1, lon1, azi1, s12 and prints out lines
18  * with lat2, lon2, azi2 (for the WGS84 ellipsoid).
19  **********************************************************************/
20 
21 int main() {
22  double a = 6378137, f = 1/298.257223563; /* WGS84 */
23  double lat1, lon1, azi1, lat2, lon2, azi2, s12;
24  struct geod_geodesic g;
25 
26  geod_init(&g, a, f);
27  while (scanf("%lf %lf %lf %lf", &lat1, &lon1, &azi1, &s12) == 4) {
28  geod_direct(&g, lat1, lon1, azi1, s12, &lat2, &lon2, &azi2);
29  printf("%.15f %.15f %.15f\n", lat2, lon2, azi2);
30  }
31  return 0;
32 }
int main()
Definition: direct.c:21
API for the geodesic routines in C.
void GEOD_DLL geod_init(struct geod_geodesic *g, double a, double f)
void GEOD_DLL geod_direct(const struct geod_geodesic *g, double lat1, double lon1, double azi1, double s12, double *plat2, double *plon2, double *pazi2)
double f
Definition: geodesic.h:88
double a
Definition: geodesic.h:87