Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
232 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,39 @@ | ||
#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 | ||
degree = PI/180, | ||
lat1 = phi1 / degree, lon1 = lam1 /degree, azi1 = al12 / degree; | ||
geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic, | ||
lat1, lon1, azi1, 0U); | ||
lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN, azi1 = al12 / DEG_IN; | ||
geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic, lat1, lon1, azi1, 0U); | ||
} | ||
|
||
void geod_for(void) { | ||
double degree = PI/180, s12 = geod_S, lat2, lon2, azi2; | ||
double | ||
s12 = geod_S, lat2, lon2, azi2; | ||
geod_position(&GlobalGeodesicLine, s12, &lat2, &lon2, &azi2); | ||
azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */ | ||
phi2 = lat2 * degree; | ||
lam2 = lon2 * degree; | ||
al21 = azi2 * degree; | ||
phi2 = lat2 * DEG_OUT; | ||
lam2 = lon2 * DEG_OUT; | ||
al21 = azi2 * DEG_OUT; | ||
} | ||
|
||
void geod_inv(void) { | ||
double | ||
degree = PI / 180, | ||
lat1 = phi1 / degree, lon1 = lam1 / degree, | ||
lat2 = phi2 / degree, lon2 = lam2 / degree, | ||
lat1 = phi1 / DEG_IN, lon1 = lam1 / DEG_IN, | ||
lat2 = phi2 / DEG_IN, lon2 = lam2 / DEG_IN, | ||
azi1, azi2, s12; | ||
geod_inverse(&GlobalGeodesic, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2); | ||
azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */ | ||
al12 = azi1 * degree; al21 = azi2 * degree; geod_S = s12; | ||
al12 = azi1 * DEG_OUT; al21 = azi2 * DEG_OUT; geod_S = s12; | ||
} |
Oops, something went wrong.