diff options
Diffstat (limited to 'src/geod_interface.c')
| -rw-r--r-- | src/geod_interface.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/geod_interface.c b/src/geod_interface.c index 63b16b1e..a30377ac 100644 --- a/src/geod_interface.c +++ b/src/geod_interface.c @@ -1,20 +1,14 @@ #include "projects.h" #include "geod_interface.h" -/* DEG_IN is a crock to work around the problem that dmstor.c uses the wrong - * value for pi/180 (namely .0174532925199433 which is an inaccurately - * truncated version of DEG_TO_RAD). - */ -#define DEG_IN .0174532925199433 -#define DEG_OUT DEG_TO_RAD; - void geod_ini(void) { geod_init(&GlobalGeodesic, geod_a, geod_f); } void geod_pre(void) { double - lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN, azi1 = al12 / DEG_IN; + lat1 = phi1 / DEG_TO_RAD, lon1 = lam1 / DEG_TO_RAD, + azi1 = al12 / DEG_TO_RAD; geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic, lat1, lon1, azi1, 0U); } @@ -23,17 +17,17 @@ void geod_for(void) { s12 = geod_S, lat2, lon2, azi2; geod_position(&GlobalGeodesicLine, s12, &lat2, &lon2, &azi2); azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */ - phi2 = lat2 * DEG_OUT; - lam2 = lon2 * DEG_OUT; - al21 = azi2 * DEG_OUT; + phi2 = lat2 * DEG_TO_RAD; + lam2 = lon2 * DEG_TO_RAD; + al21 = azi2 * DEG_TO_RAD; } void geod_inv(void) { double - lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN, - lat2 = phi2 / DEG_IN, lon2 = lam2 / DEG_IN, + lat1 = phi1 / DEG_TO_RAD, lon1 = lam1 / DEG_TO_RAD, + lat2 = phi2 / DEG_TO_RAD, lon2 = lam2 / DEG_TO_RAD, azi1, azi2, s12; geod_inverse(&GlobalGeodesic, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2); azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */ - al12 = azi1 * DEG_OUT; al21 = azi2 * DEG_OUT; geod_S = s12; + al12 = azi1 * DEG_TO_RAD; al21 = azi2 * DEG_TO_RAD; geod_S = s12; } |
