diff options
| author | Charles Karney <ckarney@karney.com> | 2015-10-01 17:21:45 -0400 |
|---|---|---|
| committer | Charles Karney <ckarney@karney.com> | 2015-10-01 17:21:45 -0400 |
| commit | 7b30a05ab90cf122c5818c8eb04101687d4dd2f3 (patch) | |
| tree | bba4e9126a4f00496f6272fba0faaeb6ad0dec61 /src/geod_interface.c | |
| parent | ebeda639aef038bd70e7a2604133ec0d798fd5b4 (diff) | |
| download | PROJ-7b30a05ab90cf122c5818c8eb04101687d4dd2f3.tar.gz PROJ-7b30a05ab90cf122c5818c8eb04101687d4dd2f3.zip | |
Take 2 of the fix to dmstor.
I'm making this pull request soon after the release of 4.9.2. It will
cause the results that people get out of proj.4 to change very slightly.
If there are problems, we'll get a chance to iron them out well before
the next release.
The important change is to use DEG_TO_RAD for degree to radian
conversions in dmstor.c instead of the slightly inaccurate number used
earlier.
This necessitates a change to geod_interface.c (which previously had to
work aroung the previous bad behavior). PJ_aeqd.c now does conversions
in a compatible manner.
In src/proj_api.h, DEG_TO_RAD and RAD_TO_DEG are both given to 17
significant figures (this is just a cosmetic change).
I've "fixed" the testvarious tests so that they still pass (on my system
at least). Everyone should be suitably skeptical of my fixes.
(1) Minor changes to "Test bug 244" and only ask for nanometer (instead
of picometer) accuracy on positions.
(2) 2 lon_wrap tests now return 0dE instead of 360dE (now it's tight?)
(3) The results for the forward healpix projection of (-180, +90) and
(-180, -90) are now different. I have put the new values into
tv_out.dist. I'm fairly confident that the new values are OK, since
this projection has various cuts which meet at the poles. It would be
good if someone who knows about this projection can verify this.
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; } |
