diff options
| author | Charles Karney <charles@karney.com> | 2015-05-20 21:44:23 +0000 |
|---|---|---|
| committer | Charles Karney <charles@karney.com> | 2015-05-20 21:44:23 +0000 |
| commit | bc68930723d48f2669d6bd9ebe176614e9dd893d (patch) | |
| tree | 4bc211cc1c37ddf2b2dac39d9362fa1cdfda969f /src/geodesic.h | |
| parent | 338ea581218e4e3361c5dc52a8508a6020d2b27d (diff) | |
| download | PROJ-bc68930723d48f2669d6bd9ebe176614e9dd893d.tar.gz PROJ-bc68930723d48f2669d6bd9ebe176614e9dd893d.zip | |
Update to version 1.43 of the geodesic routines. This fixes two
relatively obscure problems. (1) The business of returning an unrolled
longitude with the solution to the direct problem was broken for
west-going geodesics. (2) For flattening > 1/100, a slight inaccurate
result was returned for a12 in the direct calculation.
git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2656 4e78687f-474d-0410-85f9-8d5e500ac6b2
Diffstat (limited to 'src/geodesic.h')
| -rw-r--r-- | src/geodesic.h | 67 |
1 files changed, 45 insertions, 22 deletions
diff --git a/src/geodesic.h b/src/geodesic.h index 6b2afc5a..1a1892a7 100644 --- a/src/geodesic.h +++ b/src/geodesic.h @@ -108,12 +108,12 @@ * twice about restructuring the internals of the C code since this may make * porting fixes from the C++ code more difficult. * - * Copyright (c) Charles Karney (2012-2014) <charles@karney.com> and licensed + * Copyright (c) Charles Karney (2012-2015) <charles@karney.com> and licensed * under the MIT/X11 License. For more information, see * http://geographiclib.sourceforge.net/ * * This library was distributed with - * <a href="../index.html">GeographicLib</a> 1.40. + * <a href="../index.html">GeographicLib</a> 1.43. **********************************************************************/ #if !defined(GEODESIC_H) @@ -128,13 +128,36 @@ * The minor version of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ -#define GEODESIC_VERSION_MINOR 40 +#define GEODESIC_VERSION_MINOR 43 /** * The patch level of the geodesic library. (This tracks the version of * GeographicLib.) **********************************************************************/ #define GEODESIC_VERSION_PATCH 0 +/** + * Pack the version components into a single integer. Users should not rely on + * this particular packing of the components of the version number; see the + * documentation for GEODESIC_VERSION, below. + **********************************************************************/ +#define GEODESIC_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c)) + +/** + * The version of the geodesic library as a single integer, packed as MMmmmmpp + * where MM is the major version, mmmm is the minor version, and pp is the + * patch level. Users should not rely on this particular packing of the + * components of the version number. Instead they should use a test such as + * \code + #if GEODESIC_VERSION >= GEODESIC_VERSION_NUM(1,40,0) + ... + #endif + * \endcode + **********************************************************************/ +#define GEODESIC_VERSION \ + GEODESIC_VERSION_NUM(GEODESIC_VERSION_MAJOR, \ + GEODESIC_VERSION_MINOR, \ + GEODESIC_VERSION_PATCH) + #if defined(__cplusplus) extern "C" { #endif @@ -383,8 +406,7 @@ extern "C" { * @param[in] azi1 azimuth at point 1 (degrees). * @param[in] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & - * GEOD_LONG_NOWRAP prevents the value of \e lon2 being wrapped into - * the range [−180°, 180°). + * GEOD_LONG_UNROLL "unrolls" \e lon2. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the distance * between point 1 and point 2 (meters); otherwise it is the arc length * between point 1 and point 2 (degrees); it can be negative. @@ -409,12 +431,12 @@ extern "C" { * "return" arguments \e plat2, etc., may be replaced by 0, if you do not * need some quantities computed. * - * With \e flags & GEOD_LONG_NOWRAP bit set, the quantity \e lon2 − - * \e lon1 indicates how many times the geodesic wrapped around the - * ellipsoid. Because \e lon2 might be outside the normal allowed range - * for longitudes, [−540°, 540°), be sure to normalize it, - * e.g., with fmod(\e lon2, 360.0) before using it in subsequent - * calculations + * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so + * that the quantity \e lon2 − \e lon1 indicates how many times and in + * what sense the geodesic encircles the ellipsoid. Because \e lon2 might be + * outside the normal allowed range for longitudes, [−540°, + * 540°), be sure to normalize it, e.g., with fmod(\e lon2, 360.0) before + * using it in subsequent calculations **********************************************************************/ double geod_gendirect(const struct geod_geodesic* g, double lat1, double lon1, double azi1, @@ -464,10 +486,8 @@ extern "C" { * geodesic line. * @param[in] flags bitor'ed combination of geod_flags(); \e flags & * GEOD_ARCMODE determines the meaning of \e s12_a12 and \e flags & - * GEOD_LONG_NOWRAP prevents the value of \e lon2 being wrapped into - * the range [−180°, 180°); if \e flags & GEOD_ARCMODE is - * 0, then \e l must have been initialized with \e caps |= - * GEOD_DISTANCE_IN. + * GEOD_LONG_UNROLL "unrolls" \e lon2; if \e flags & GEOD_ARCMODE is 0, + * then \e l must have been initialized with \e caps |= GEOD_DISTANCE_IN. * @param[in] s12_a12 if \e flags & GEOD_ARCMODE is 0, this is the * distance between point 1 and point 2 (meters); otherwise it is the * arc length between point 1 and point 2 (degrees); it can be @@ -499,12 +519,12 @@ extern "C" { * computed. Requesting a value which \e l is not capable of computing * is not an error; the corresponding argument will not be altered. * - * With \e flags & GEOD_LONG_NOWRAP bit set, the quantity \e lon2 − - * \e lon1 indicates how many times the geodesic wrapped around the - * ellipsoid. Because \e lon2 might be outside the normal allowed range - * for longitudes, [−540°, 540°), be sure to normalize it, - * e.g., with fmod(\e lon2, 360.0) before using it in subsequent - * calculations + * With \e flags & GEOD_LONG_UNROLL bit set, the longitude is "unrolled" so + * that the quantity \e lon2 − \e lon1 indicates how many times and in + * what sense the geodesic encircles the ellipsoid. Because \e lon2 might be + * outside the normal allowed range for longitudes, [−540°, + * 540°), be sure to normalize it, e.g., with fmod(\e lon2, 360.0) before + * using it in subsequent calculations * * Example, compute way points between JFK and Singapore Changi Airport * using geod_genposition(). In this example, the points are evenly space in @@ -771,7 +791,10 @@ extern "C" { enum geod_flags { GEOD_NOFLAGS = 0U, /**< No flags */ GEOD_ARCMODE = 1U<<0, /**< Position given in terms of arc distance */ - GEOD_LONG_NOWRAP = 1U<<15 /**< Don't wrap longitude */ + GEOD_LONG_UNROLL = 1U<<15, /**< Unroll the longitude */ + /**< @cond SKIP */ + GEOD_LONG_NOWRAP = GEOD_LONG_UNROLL /* For backward compatibility only */ + /**< @endcond */ }; #if defined(__cplusplus) |
