Config.h   Config.h 
#define GEOGRAPHICLIB_VERSION_MAJOR 1 #define GEOGRAPHICLIB_VERSION_MAJOR 1
#define GEOGRAPHICLIB_VERSION_MINOR 38 #define GEOGRAPHICLIB_VERSION_MINOR 39
#define GEOGRAPHICLIB_VERSION_PATCH 0 #define GEOGRAPHICLIB_VERSION_PATCH 0
#define GEOGRAPHICLIB_HAVE_LONG_DOUBLE 1 #define GEOGRAPHICLIB_HAVE_LONG_DOUBLE 1
#define GEOGRAPHICLIB_VERSION_STRING "1.38" #define GEOGRAPHICLIB_VERSION_STRING "1.39"
/* # undef GEOGRAPHICLIB_WORDS_BIGENDIAN */ /* # undef GEOGRAPHICLIB_WORDS_BIGENDIAN */
 End of changes. 2 change blocks. 
2 lines changed or deleted 2 lines changed or added


 Constants.hpp   Constants.hpp 
skipping to change at line 37 skipping to change at line 37
#define GEOGRAPHICLIB_VERSION \ #define GEOGRAPHICLIB_VERSION \
GEOGRAPHICLIB_VERSION_NUM(GEOGRAPHICLIB_VERSION_MAJOR, \ GEOGRAPHICLIB_VERSION_NUM(GEOGRAPHICLIB_VERSION_MAJOR, \
GEOGRAPHICLIB_VERSION_MINOR, \ GEOGRAPHICLIB_VERSION_MINOR, \
GEOGRAPHICLIB_VERSION_PATCH) GEOGRAPHICLIB_VERSION_PATCH)
/** /**
* @relates GeographicLib::Constants * @relates GeographicLib::Constants
* A compile-time assert. Use C++11 static_assert, if available. * A compile-time assert. Use C++11 static_assert, if available.
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_STATIC_ASSERT) #if !defined(GEOGRAPHICLIB_STATIC_ASSERT)
# if __cplusplus >= 201103 # if __cplusplus >= 201103 || defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GEOGRAPHICLIB_STATIC_ASSERT static_assert
# elif defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GEOGRAPHICLIB_STATIC_ASSERT static_assert # define GEOGRAPHICLIB_STATIC_ASSERT static_assert
# elif defined(_MSC_VER) && _MSC_VER >= 1600 # elif defined(_MSC_VER) && _MSC_VER >= 1600
// For reference, here is a table of Visual Studio and _MSC_VER // For reference, here is a table of Visual Studio and _MSC_VER
// correspondences: // correspondences:
// //
// _MSC_VER Visual Studio // _MSC_VER Visual Studio
// 1300 vc7 // 1300 vc7
// 1311 vc7.1 (2003) // 1311 vc7.1 (2003)
// 1400 vc8 (2005) // 1400 vc8 (2005)
// 1500 vc9 (2008) // 1500 vc9 (2008)
// 1600 vc10 (2010) // 1600 vc10 (2010)
// 1700 vc11 (2012) // 1700 vc11 (2012)
// 1800 vc12 (2013) // 1800 vc12 (2013)
// 1900 vc14
# define GEOGRAPHICLIB_STATIC_ASSERT static_assert # define GEOGRAPHICLIB_STATIC_ASSERT static_assert
# else # else
# define GEOGRAPHICLIB_STATIC_ASSERT(cond,reason) \ # define GEOGRAPHICLIB_STATIC_ASSERT(cond,reason) \
{ enum{ GEOGRAPHICLIB_STATIC_ASSERT_ENUM = 1/int(cond) }; } { enum{ GEOGRAPHICLIB_STATIC_ASSERT_ENUM = 1/int(cond) }; }
# endif # endif
#endif #endif
#if defined(_MSC_VER) && defined(GEOGRAPHICLIB_SHARED_LIB) && \ #if defined(_MSC_VER) && defined(GEOGRAPHICLIB_SHARED_LIB) && \
GEOGRAPHICLIB_SHARED_LIB GEOGRAPHICLIB_SHARED_LIB
# if GEOGRAPHICLIB_SHARED_LIB > 1 # if GEOGRAPHICLIB_SHARED_LIB > 1
 End of changes. 2 change blocks. 
3 lines changed or deleted 2 lines changed or added


 DMS.hpp   DMS.hpp 
skipping to change at line 153 skipping to change at line 153
* N-20d30'40.5", -20:30:40.5 * N-20d30'40.5", -20:30:40.5
* - 4d0'9, 4d9", 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0. 15, * - 4d0'9, 4d9", 4d9'', 4:0:9, 004:00:09, 4.0025, 4.0025d, 4d0. 15,
* 04:.15 * 04:.15
* - <i>ILLEGAL</i> (the exception thrown explains the problem) * - <i>ILLEGAL</i> (the exception thrown explains the problem)
* - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4: 60, * - 4d5&quot;4', 4::5, 4:5:, :4:5, 4d4.5'4&quot;, -N20.5, 1.8e2d, 4: 60,
* 4d-5' * 4d-5'
* *
* <b>NOTE:</b> At present, all the string handling in the C++ * <b>NOTE:</b> At present, all the string handling in the C++
* implementation %GeographicLib is with 8-bit characters. The support for * implementation %GeographicLib is with 8-bit characters. The support for
* unicode symbols for degrees, minutes, and seconds is therefore via t he * unicode symbols for degrees, minutes, and seconds is therefore via t he
* <a href="http://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoding. (T he * <a href="https://en.wikipedia.org/wiki/UTF-8">UTF-8</a> encoding. ( The
* JavaScript implementation of this class uses unicode natively, of * JavaScript implementation of this class uses unicode natively, of
* course.) * course.)
* *
* Here is the list of Unicode symbols supported for degrees, minutes, * Here is the list of Unicode symbols supported for degrees, minutes,
* seconds: * seconds:
* - degrees: * - degrees:
* - d, D lower and upper case letters * - d, D lower and upper case letters
* - U+00b0 degree symbol (&deg;) * - U+00b0 degree symbol (&deg;)
* - U+00ba masculine ordinal indicator * - U+00ba masculine ordinal indicator
* - U+2070 superscript zero * - U+2070 superscript zero
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Geodesic.hpp   Geodesic.hpp 
skipping to change at line 85 skipping to change at line 85
* relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 = \e * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 = \e
* s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an * s12. The ratio <i>s12</i>/\e m12 gives the azimuthal scale for an
* azimuthal equidistant projection. * azimuthal equidistant projection.
* - <i>geodesic scale</i>. Consider a reference geodesic and a second * - <i>geodesic scale</i>. Consider a reference geodesic and a second
* geodesic parallel to this one at point 1 and separated by a small * geodesic parallel to this one at point 1 and separated by a small
* distance \e dt. The separation of the two geodesics at point 2 is \ e * distance \e dt. The separation of the two geodesics at point 2 is \ e
* M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is * M12 \e dt where \e M12 is called the "geodesic scale". \e M21 is
* defined similarly (with the geodesics being parallel at point 2). O n a * defined similarly (with the geodesics being parallel at point 2). O n a
* flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gi ves * flat surface, we have \e M12 = \e M21 = 1. The quantity 1/\e M12 gi ves
* the scale of the Cassini-Soldner projection. * the scale of the Cassini-Soldner projection.
* - <i>area</i>. The area between the geodesic from point 1 to point 2 and * - <i>area</i>. The area between the geodesic from point 1 to point 2 and
* the equation is represented by \e S12; it is the area, measured * the equation is represented by \e S12; it is the area, measured
* counter-clockwise, of the geodesic quadrilateral with corners * counter-clockwise, of the geodesic quadrilateral with corners
* (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and * (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>), (0,<i>lon2</i>), and
* (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of an y * (<i>lat2</i>,<i>lon2</i>). It can be used to compute the area of an y
* simple geodesic polygon. * simple geodesic polygon.
* *
* Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and * Overloaded versions of Geodesic::Direct, Geodesic::ArcDirect, and
* Geodesic::Inverse allow these quantities to be returned. In addition * Geodesic::Inverse allow these quantities to be returned. In addition
* there are general functions Geodesic::GenDirect, and Geodesic::GenInve rse * there are general functions Geodesic::GenDirect, and Geodesic::GenInve rse
skipping to change at line 199 skipping to change at line 198
real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_; real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_;
enum captype { enum captype {
CAP_NONE = 0U, CAP_NONE = 0U,
CAP_C1 = 1U<<0, CAP_C1 = 1U<<0,
CAP_C1p = 1U<<1, CAP_C1p = 1U<<1,
CAP_C2 = 1U<<2, CAP_C2 = 1U<<2,
CAP_C3 = 1U<<3, CAP_C3 = 1U<<3,
CAP_C4 = 1U<<4, CAP_C4 = 1U<<4,
CAP_ALL = 0x1FU, CAP_ALL = 0x1FU,
CAP_MASK = CAP_ALL,
OUT_ALL = 0x7F80U, OUT_ALL = 0x7F80U,
OUT_MASK = 0xFF80U, // Includes LONG_NOWRAP
}; };
static real SinCosSeries(bool sinp, static real SinCosSeries(bool sinp,
real sinx, real cosx, const real c[], int n); real sinx, real cosx, const real c[], int n);
static inline real AngRound(real x) { static inline real AngRound(real x) {
// The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^ 57 // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^ 57
// for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi s // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi s
// is about 1000 times more resolution than we get with angles around 90 // is about 1000 times more resolution than we get with angles around 90
// degrees.) We use this to avoid having to deal with near singular // degrees.) We use this to avoid having to deal with near singular
// cases when x is non-zero but tiny (e.g., 1.0e-200). // cases when x is non-zero but tiny (e.g., 1.0e-200).
skipping to change at line 325 skipping to change at line 326
* Calculate geodesic scales \e M12 and \e M21. * Calculate geodesic scales \e M12 and \e M21.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2, GEODESICSCALE = 1U<<13 | CAP_C1 | CAP_C2,
/** /**
* Calculate area \e S12. * Calculate area \e S12.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
AREA = 1U<<14 | CAP_C4, AREA = 1U<<14 | CAP_C4,
/** /**
* All capabilities, calculate everything. * Do not wrap the \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = 1U<<15,
/**
* All capabilities, calculate everything. (LONG_NOWRAP is not
* included in this mask.)
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
ALL = OUT_ALL| CAP_ALL, ALL = OUT_ALL| CAP_ALL,
}; };
/** \name Constructor /** \name Constructor
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Constructor for a ellipsoid with * Constructor for a ellipsoid with
skipping to change at line 623 skipping to change at line 630
* The Geodesic::mask values possible for \e outmask are * The Geodesic::mask values possible for \e outmask are
* - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2; * - \e outmask |= Geodesic::LATITUDE for the latitude \e lat2;
* - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2; * - \e outmask |= Geodesic::LONGITUDE for the latitude \e lon2;
* - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2; * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2;
* - \e outmask |= Geodesic::DISTANCE for the distance \e s12; * - \e outmask |= Geodesic::DISTANCE for the distance \e s12;
* - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e
* m12; * m12;
* - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e
* M12 and \e M21; * M12 and \e M21;
* - \e outmask |= Geodesic::AREA for the area \e S12; * - \e outmask |= Geodesic::AREA for the area \e S12;
* - \e outmask |= Geodesic::ALL for all of the above. * - \e outmask |= Geodesic::ALL for all of the above;
* - \e outmask |= Geodesic::LONG_NOWRAP stops the returned value of \e
* lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
* . * .
* The function value \e a12 is always computed and returned and this * The function value \e a12 is always computed and returned and this
* equals \e s12_a12 is \e arcmode is true. If \e outmask includes * equals \e s12_a12 is \e arcmode is true. If \e outmask includes
* Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12 . * Geodesic::DISTANCE and \e arcmode is false, then \e s12 = \e s12_a12 .
* It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this * It is not necessary to include Geodesic::DISTANCE_IN in \e outmask; this
* is automatically included is \e arcmode is false. * is automatically included is \e arcmode is false.
*
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the geodesic wrapped around the ellipsoid.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
********************************************************************** / ********************************************************************** /
Math::real GenDirect(real lat1, real lon1, real azi1, Math::real GenDirect(real lat1, real lon1, real azi1,
bool arcmode, real s12_a12, unsigned outmask, bool arcmode, real s12_a12, unsigned outmask,
real& lat2, real& lon2, real& azi2, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21, real& s12, real& m12, real& M12, real& M21,
real& S12) const; real& S12) const;
///@} ///@}
/** \name Inverse geodesic problem. /** \name Inverse geodesic problem.
********************************************************************** / ********************************************************************** /
 End of changes. 6 change blocks. 
3 lines changed or deleted 20 lines changed or added


 GeodesicExact.hpp   GeodesicExact.hpp 
skipping to change at line 98 skipping to change at line 98
real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_; real tiny_, tol0_, tol1_, tol2_, tolb_, xthresh_;
enum captype { enum captype {
CAP_NONE = 0U, CAP_NONE = 0U,
CAP_E = 1U<<0, CAP_E = 1U<<0,
// Skip 1U<<1 for compatibility with Geodesic (not required) // Skip 1U<<1 for compatibility with Geodesic (not required)
CAP_D = 1U<<2, CAP_D = 1U<<2,
CAP_H = 1U<<3, CAP_H = 1U<<3,
CAP_C4 = 1U<<4, CAP_C4 = 1U<<4,
CAP_ALL = 0x1FU, CAP_ALL = 0x1FU,
CAP_MASK = CAP_ALL,
OUT_ALL = 0x7F80U, OUT_ALL = 0x7F80U,
OUT_MASK = 0xFF80U, // Includes LONG_NOWRAP
}; };
static real CosSeries(real sinx, real cosx, const real c[], int n); static real CosSeries(real sinx, real cosx, const real c[], int n);
static inline real AngRound(real x) { static inline real AngRound(real x) {
// The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^ 57 // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^ 57
// for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi s // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi s
// is about 1000 times more resolution than we get with angles around 90 // is about 1000 times more resolution than we get with angles around 90
// degrees.) We use this to avoid having to deal with near singular // degrees.) We use this to avoid having to deal with near singular
// cases when x is non-zero but tiny (e.g., 1.0e-200). // cases when x is non-zero but tiny (e.g., 1.0e-200).
using std::abs; using std::abs;
skipping to change at line 222 skipping to change at line 224
* Calculate geodesic scales \e M12 and \e M21. * Calculate geodesic scales \e M12 and \e M21.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
GEODESICSCALE = 1U<<13 | CAP_D, GEODESICSCALE = 1U<<13 | CAP_D,
/** /**
* Calculate area \e S12. * Calculate area \e S12.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
AREA = 1U<<14 | CAP_C4, AREA = 1U<<14 | CAP_C4,
/** /**
* All capabilities, calculate everything. * Do not wrap the \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = 1U<<15,
/**
* All capabilities, calculate everything. (LONG_NOWRAP is not
* included in this mask.)
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
ALL = OUT_ALL| CAP_ALL, ALL = OUT_ALL| CAP_ALL,
}; };
/** \name Constructor /** \name Constructor
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Constructor for a ellipsoid with * Constructor for a ellipsoid with
skipping to change at line 520 skipping to change at line 528
* The GeodesicExact::mask values possible for \e outmask are * The GeodesicExact::mask values possible for \e outmask are
* - \e outmask |= GeodesicExact::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicExact::LATITUDE for the latitude \e lat2;
* - \e outmask |= GeodesicExact::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicExact::LONGITUDE for the latitude \e lon2;
* - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicExact::AZIMUTH for the latitude \e azi2;
* - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicExact::DISTANCE for the distance \e s12;
* - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e * - \e outmask |= GeodesicExact::REDUCEDLENGTH for the reduced length \e
* m12; * m12;
* - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e * - \e outmask |= GeodesicExact::GEODESICSCALE for the geodesic scales \e
* M12 and \e M21; * M12 and \e M21;
* - \e outmask |= GeodesicExact::AREA for the area \e S12; * - \e outmask |= GeodesicExact::AREA for the area \e S12;
* - \e outmask |= GeodesicExact::ALL for all of the above. * - \e outmask |= GeodesicExact::ALL for all of the above;
* - \e outmask |= GeodesicExact::LONG_NOWRAP stops the returned value
of
* \e lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
* . * .
* The function value \e a12 is always computed and returned and this * The function value \e a12 is always computed and returned and this
* equals \e s12_a12 is \e arcmode is true. If \e outmask includes * equals \e s12_a12 is \e arcmode is true. If \e outmask includes
* GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e * GeodesicExact::DISTANCE and \e arcmode is false, then \e s12 = \e
* s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in * s12_a12. It is not necessary to include GeodesicExact::DISTANCE_IN in
* \e outmask; this is automatically included is \e arcmode is false. * \e outmask; this is automatically included is \e arcmode is false.
*
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the geodesic wrapped around the ellipsoid.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
********************************************************************** / ********************************************************************** /
Math::real GenDirect(real lat1, real lon1, real azi1, Math::real GenDirect(real lat1, real lon1, real azi1,
bool arcmode, real s12_a12, unsigned outmask, bool arcmode, real s12_a12, unsigned outmask,
real& lat2, real& lon2, real& azi2, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21, real& s12, real& m12, real& M12, real& M21,
real& S12) const; real& S12) const;
///@} ///@}
/** \name Inverse geodesic problem. /** \name Inverse geodesic problem.
********************************************************************** / ********************************************************************** /
 End of changes. 5 change blocks. 
2 lines changed or deleted 21 lines changed or added


 GeodesicLine.hpp   GeodesicLine.hpp 
/** /**
* \file GeodesicLine.hpp * \file GeodesicLine.hpp
* \brief Header for GeographicLib::GeodesicLine class * \brief Header for GeographicLib::GeodesicLine class
* *
* Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licens ed * Copyright (c) Charles Karney (2009-2014) <charles@karney.com> and licens ed
* under the MIT/X11 License. For more information, see * under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP)
#define GEOGRAPHICLIB_GEODESICLINE_HPP 1 #define GEOGRAPHICLIB_GEODESICLINE_HPP 1
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
skipping to change at line 87 skipping to change at line 87
unsigned _caps; unsigned _caps;
enum captype { enum captype {
CAP_NONE = Geodesic::CAP_NONE, CAP_NONE = Geodesic::CAP_NONE,
CAP_C1 = Geodesic::CAP_C1, CAP_C1 = Geodesic::CAP_C1,
CAP_C1p = Geodesic::CAP_C1p, CAP_C1p = Geodesic::CAP_C1p,
CAP_C2 = Geodesic::CAP_C2, CAP_C2 = Geodesic::CAP_C2,
CAP_C3 = Geodesic::CAP_C3, CAP_C3 = Geodesic::CAP_C3,
CAP_C4 = Geodesic::CAP_C4, CAP_C4 = Geodesic::CAP_C4,
CAP_ALL = Geodesic::CAP_ALL, CAP_ALL = Geodesic::CAP_ALL,
CAP_MASK = Geodesic::CAP_MASK,
OUT_ALL = Geodesic::OUT_ALL, OUT_ALL = Geodesic::OUT_ALL,
OUT_MASK = Geodesic::OUT_MASK,
}; };
public: public:
/** /**
* Bit masks for what calculations to do. They signify to the * Bit masks for what calculations to do. They signify to the
* GeodesicLine::GeodesicLine constructor and to Geodesic::Line what * GeodesicLine::GeodesicLine constructor and to Geodesic::Line what
* capabilities should be included in the GeodesicLine object. This is * capabilities should be included in the GeodesicLine object. This is
* merely a duplication of Geodesic::mask. * merely a duplication of Geodesic::mask.
********************************************************************** / ********************************************************************** /
enum mask { enum mask {
skipping to change at line 148 skipping to change at line 150
* Calculate geodesic scales \e M12 and \e M21. * Calculate geodesic scales \e M12 and \e M21.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
GEODESICSCALE = Geodesic::GEODESICSCALE, GEODESICSCALE = Geodesic::GEODESICSCALE,
/** /**
* Calculate area \e S12. * Calculate area \e S12.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
AREA = Geodesic::AREA, AREA = Geodesic::AREA,
/** /**
* All capabilities, calculate everything. * Do not wrap \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = Geodesic::LONG_NOWRAP,
/**
* All capabilities, calculate everything. (LONG_NOWRAP is not
* included in this mask.)
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
ALL = Geodesic::ALL, ALL = Geodesic::ALL,
}; };
/** \name Constructors /** \name Constructors
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
skipping to change at line 496 skipping to change at line 504
* The GeodesicLine::mask values possible for \e outmask are * The GeodesicLine::mask values possible for \e outmask are
* - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2; * - \e outmask |= GeodesicLine::LATITUDE for the latitude \e lat2;
* - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2; * - \e outmask |= GeodesicLine::LONGITUDE for the latitude \e lon2;
* - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicLine::AZIMUTH for the latitude \e azi2;
* - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicLine::DISTANCE for the distance \e s12;
* - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \ e * - \e outmask |= GeodesicLine::REDUCEDLENGTH for the reduced length \ e
* m12; * m12;
* - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e * - \e outmask |= GeodesicLine::GEODESICSCALE for the geodesic scales \e
* M12 and \e M21; * M12 and \e M21;
* - \e outmask |= GeodesicLine::AREA for the area \e S12; * - \e outmask |= GeodesicLine::AREA for the area \e S12;
* - \e outmask |= GeodesicLine::ALL for all of the above. * - \e outmask |= GeodesicLine::ALL for all of the above;
* - \e outmask |= GeodesicLine::LONG_NOWRAP stops the returned value o
f \e
* lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
* . * .
* Requesting a value which the GeodesicLine object is not capable of * Requesting a value which the GeodesicLine object is not capable of
* computing is not an error; the corresponding argument will not be * computing is not an error; the corresponding argument will not be
* altered. Note, however, that the arc length is always computed and * altered. Note, however, that the arc length is always computed and
* returned as the function value. * returned as the function value.
*
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the geodesic wrapped around the ellipsoid.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
********************************************************************** / ********************************************************************** /
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask,
real& lat2, real& lon2, real& azi2, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21, real& s12, real& m12, real& M12, real& M21,
real& S12) const; real& S12) const;
///@} ///@}
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
 End of changes. 6 change blocks. 
3 lines changed or deleted 22 lines changed or added


 GeodesicLineExact.hpp   GeodesicLineExact.hpp 
/** /**
* \file GeodesicLineExact.hpp * \file GeodesicLineExact.hpp
* \brief Header for GeographicLib::GeodesicLineExact class * \brief Header for GeographicLib::GeodesicLineExact class
* *
* Copyright (c) Charles Karney (2012) <charles@karney.com> and licensed un * Copyright (c) Charles Karney (2012-2014) <charles@karney.com> and licens
der ed
* the MIT/X11 License. For more information, see * under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GEODESICLINEEXACT_HPP) #if !defined(GEOGRAPHICLIB_GEODESICLINEEXACT_HPP)
#define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1 #define GEOGRAPHICLIB_GEODESICLINEEXACT_HPP 1
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/GeodesicExact.hpp> #include <GeographicLib/GeodesicExact.hpp>
#include <GeographicLib/EllipticFunction.hpp> #include <GeographicLib/EllipticFunction.hpp>
skipping to change at line 58 skipping to change at line 58
EllipticFunction _E; EllipticFunction _E;
unsigned _caps; unsigned _caps;
enum captype { enum captype {
CAP_NONE = GeodesicExact::CAP_NONE, CAP_NONE = GeodesicExact::CAP_NONE,
CAP_E = GeodesicExact::CAP_E, CAP_E = GeodesicExact::CAP_E,
CAP_D = GeodesicExact::CAP_D, CAP_D = GeodesicExact::CAP_D,
CAP_H = GeodesicExact::CAP_H, CAP_H = GeodesicExact::CAP_H,
CAP_C4 = GeodesicExact::CAP_C4, CAP_C4 = GeodesicExact::CAP_C4,
CAP_ALL = GeodesicExact::CAP_ALL, CAP_ALL = GeodesicExact::CAP_ALL,
CAP_MASK = GeodesicExact::CAP_MASK,
OUT_ALL = GeodesicExact::OUT_ALL, OUT_ALL = GeodesicExact::OUT_ALL,
OUT_MASK = GeodesicExact::OUT_MASK,
}; };
public: public:
/** /**
* Bit masks for what calculations to do. They signify to the * Bit masks for what calculations to do. They signify to the
* GeodesicLineExact::GeodesicLineExact constructor and to * GeodesicLineExact::GeodesicLineExact constructor and to
* GeodesicExact::Line what capabilities should be included in the * GeodesicExact::Line what capabilities should be included in the
* GeodesicLineExact object. This is merely a duplication of * GeodesicLineExact object. This is merely a duplication of
* GeodesicExact::mask. * GeodesicExact::mask.
********************************************************************** / ********************************************************************** /
skipping to change at line 120 skipping to change at line 122
* Calculate geodesic scales \e M12 and \e M21. * Calculate geodesic scales \e M12 and \e M21.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
GEODESICSCALE = GeodesicExact::GEODESICSCALE, GEODESICSCALE = GeodesicExact::GEODESICSCALE,
/** /**
* Calculate area \e S12. * Calculate area \e S12.
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
AREA = GeodesicExact::AREA, AREA = GeodesicExact::AREA,
/** /**
* All capabilities, calculate everything. * Do not wrap \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = GeodesicExact::LONG_NOWRAP,
/**
* All capabilities, calculate everything. (LONG_NOWRAP is not
* included in this mask.)
* @hideinitializer * @hideinitializer
******************************************************************** **/ ******************************************************************** **/
ALL = GeodesicExact::ALL, ALL = GeodesicExact::ALL,
}; };
/** \name Constructors /** \name Constructors
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
skipping to change at line 470 skipping to change at line 478
* The GeodesicLineExact::mask values possible for \e outmask are * The GeodesicLineExact::mask values possible for \e outmask are
* - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2 ; * - \e outmask |= GeodesicLineExact::LATITUDE for the latitude \e lat2 ;
* - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon 2; * - \e outmask |= GeodesicLineExact::LONGITUDE for the latitude \e lon 2;
* - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2; * - \e outmask |= GeodesicLineExact::AZIMUTH for the latitude \e azi2;
* - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12; * - \e outmask |= GeodesicLineExact::DISTANCE for the distance \e s12;
* - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced len gth * - \e outmask |= GeodesicLineExact::REDUCEDLENGTH for the reduced len gth
* \e m12; * \e m12;
* - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic sc ales * - \e outmask |= GeodesicLineExact::GEODESICSCALE for the geodesic sc ales
* \e M12 and \e M21; * \e M12 and \e M21;
* - \e outmask |= GeodesicLineExact::AREA for the area \e S12; * - \e outmask |= GeodesicLineExact::AREA for the area \e S12;
* - \e outmask |= GeodesicLine::ALL for all of the above. * - \e outmask |= GeodesicLineExact::ALL for all of the above;
* - \e outmask |= GeodesicLineExact::LONG_NOWRAP stops the returned va
lue
* of \e lon2 being wrapped into the range [&minus;180&deg;, 180&deg;
).
* . * .
* Requesting a value which the GeodesicLineExact object is not capable of * Requesting a value which the GeodesicLineExact object is not capable of
* computing is not an error; the corresponding argument will not be * computing is not an error; the corresponding argument will not be
* altered. Note, however, that the arc length is always computed and * altered. Note, however, that the arc length is always computed and
* returned as the function value. * returned as the function value.
*
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the geodesic wrapped around the ellipsoid.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
********************************************************************** / ********************************************************************** /
Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask, Math::real GenPosition(bool arcmode, real s12_a12, unsigned outmask,
real& lat2, real& lon2, real& azi2, real& lat2, real& lon2, real& azi2,
real& s12, real& m12, real& M12, real& M21, real& s12, real& m12, real& M12, real& M21,
real& S12) const; real& S12) const;
///@} ///@}
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
 End of changes. 6 change blocks. 
5 lines changed or deleted 25 lines changed or added


 Geohash.hpp   Geohash.hpp 
skipping to change at line 27 skipping to change at line 27
# pragma warning (push) # pragma warning (push)
# pragma warning (disable: 4251) # pragma warning (disable: 4251)
#endif #endif
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Conversions for geohashes * \brief Conversions for geohashes
* *
* Geohashes are described in * Geohashes are described in
* - http://en.wikipedia.org/wiki/Geohash * - https://en.wikipedia.org/wiki/Geohash
* - http://geohash.org/ * - http://geohash.org/
* . * .
* They provide a compact string representation of a particular geographi c * They provide a compact string representation of a particular geographi c
* location (expressed as latitude and longitude), with the property that if * location (expressed as latitude and longitude), with the property that if
* trailing characters are dropped from the string the geographic locatio n * trailing characters are dropped from the string the geographic locatio n
* remains nearby. * remains nearby.
* *
* Example of use: * Example of use:
* \include example-Geohash.cpp * \include example-Geohash.cpp
**********************************************************************/ **********************************************************************/
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 Geoid.hpp   Geoid.hpp 
/** /**
* \file Geoid.hpp * \file Geoid.hpp
* \brief Header for GeographicLib::Geoid class * \brief Header for GeographicLib::Geoid class
* *
* Copyright (c) Charles Karney (2009-2012) <charles@karney.com> and licens ed * Copyright (c) Charles Karney (2009-2014) <charles@karney.com> and licens ed
* under the MIT/X11 License. For more information, see * under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GEOID_HPP) #if !defined(GEOGRAPHICLIB_GEOID_HPP)
#define GEOGRAPHICLIB_GEOID_HPP 1 #define GEOGRAPHICLIB_GEOID_HPP 1
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
skipping to change at line 54 skipping to change at line 54
* - EGM96: * - EGM96:
* http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html * http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm96/egm96.html
* - EGM2008: * - EGM2008:
* http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008 * http://earth-info.nga.mil/GandG/wgs84/gravitymod/egm2008
* *
* The geoids are defined in terms of spherical harmonics. However in or der * The geoids are defined in terms of spherical harmonics. However in or der
* to provide a quick and flexible method of evaluating the geoid heights , * to provide a quick and flexible method of evaluating the geoid heights ,
* this class evaluates the height by interpolation into a grid of * this class evaluates the height by interpolation into a grid of
* precomputed values. * precomputed values.
* *
* The geoid height, \e N, can be used to convert a height above the
* ellipsoid, \e h, to the corresponding height above the geoid (roughly
the
* height above mean sea level), \e H, using the relations
*
* &nbsp;&nbsp;&nbsp;\e h = \e N + \e H;
* &nbsp;&nbsp;\e H = &minus;\e N + \e h.
*
* See \ref geoid for details of how to install the data sets, the data * See \ref geoid for details of how to install the data sets, the data
* format, estimates of the interpolation errors, and how to use caching. * format, estimates of the interpolation errors, and how to use caching.
* *
* In addition to returning the geoid height, the gradient of the geoid c an * In addition to returning the geoid height, the gradient of the geoid c an
* be calculated. The gradient is defined as the rate of change of the g eoid * be calculated. The gradient is defined as the rate of change of the g eoid
* as a function of position on the ellipsoid. This uses the parameters for * as a function of position on the ellipsoid. This uses the parameters for
* the WGS84 ellipsoid. The gradient defined in terms of the interpolate d * the WGS84 ellipsoid. The gradient defined in terms of the interpolate d
* heights. As a result of the way that the geoid data is stored, the * heights. As a result of the way that the geoid data is stored, the
* calculation of gradients can result in large quantization errors. Thi s is * calculation of gradients can result in large quantization errors. Thi s is
* particularly acute for fine grids, at high latitudes, and for the east erly * particularly acute for fine grids, at high latitudes, and for the east erly
 End of changes. 2 change blocks. 
1 lines changed or deleted 9 lines changed or added


 GravityCircle.hpp   GravityCircle.hpp 
skipping to change at line 290 skipping to change at line 290
Math::real Height() const Math::real Height() const
{ return Init() ? _h : Math::NaN(); } { return Init() ? _h : Math::NaN(); }
/** /**
* @return \e caps the computational capabilities that this object was * @return \e caps the computational capabilities that this object was
* constructed with. * constructed with.
********************************************************************** / ********************************************************************** /
unsigned Capabilities() const { return _caps; } unsigned Capabilities() const { return _caps; }
/** /**
* @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @param[in] testcaps a set of bitor'ed GravityModel::mask values.
* @return true if the GeodesicLine object has all these capabilities. * @return true if the GravityCircle object has all these capabilities.
********************************************************************** / ********************************************************************** /
bool Capabilities(unsigned testcaps) const { bool Capabilities(unsigned testcaps) const {
return (_caps & testcaps) == testcaps; return (_caps & testcaps) == testcaps;
} }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_GRAVITYCIRCLE_HPP #endif // GEOGRAPHICLIB_GRAVITYCIRCLE_HPP
 End of changes. 1 change blocks. 
2 lines changed or deleted 2 lines changed or added


 LambertConformalConic.hpp   LambertConformalConic.hpp 
skipping to change at line 99 skipping to change at line 99
static inline real Dhyp(real x, real y, real hx, real hy) static inline real Dhyp(real x, real y, real hx, real hy)
// hx = hyp(x) // hx = hyp(x)
{ return (x + y) / (hx + hy); } { return (x + y) / (hx + hy); }
// sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^ 2)) // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^ 2))
static inline real Dsn(real x, real y, real sx, real sy) { static inline real Dsn(real x, real y, real sx, real sy) {
// sx = x/hyp(x) // sx = x/hyp(x)
real t = x * y; real t = x * y;
return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) : return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) :
(x - y != 0 ? (sx - sy) / (x - y) : 1); (x - y != 0 ? (sx - sy) / (x - y) : 1);
} }
// Dlog1p(x,y) = log1p((x-y)/(1+y)/(x-y) // Dlog1p(x,y) = log1p((x-y)/(1+y))/(x-y)
static inline real Dlog1p(real x, real y) { static inline real Dlog1p(real x, real y) {
real t = x - y; if (t < 0) { t = -t; y = x; } real t = x - y; if (t < 0) { t = -t; y = x; }
return t ? Math::log1p(t / (1 + y)) / t : 1 / (1 + x); return t ? Math::log1p(t / (1 + y)) / t : 1 / (1 + x);
} }
// Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y) // Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y)
static inline real Dexp(real x, real y) { static inline real Dexp(real x, real y) {
using std::sinh; using std::exp; using std::sinh; using std::exp;
real t = (x - y)/2; real t = (x - y)/2;
return (t ? sinh(t)/t : 1) * exp((x + y)/2); return (t ? sinh(t)/t : 1) * exp((x + y)/2);
} }
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added


 PolygonArea.hpp   PolygonArea.hpp 
/** /**
* \file PolygonArea.hpp * \file PolygonArea.hpp
* \brief Header for GeographicLib::PolygonArea class * \brief Header for GeographicLib::PolygonAreaT class
* *
* Copyright (c) Charles Karney (2010-2014) <charles@karney.com> and licens ed * Copyright (c) Charles Karney (2010-2014) <charles@karney.com> and licens ed
* under the MIT/X11 License. For more information, see * under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP)
#define GEOGRAPHICLIB_POLYGONAREA_HPP 1 #define GEOGRAPHICLIB_POLYGONAREA_HPP 1
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicExact.hpp> #include <GeographicLib/GeodesicExact.hpp>
#include <GeographicLib/Rhumb.hpp>
#include <GeographicLib/Accumulator.hpp> #include <GeographicLib/Accumulator.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Polygon areas * \brief Polygon areas
* *
* This computes the area of a polygon whose edges are geodesics using th e * This computes the area of a polygon whose edges are geodesics using th e
* method given in Section 6 of * method given in Section 6 of
* - C. F. F. Karney, * - C. F. F. Karney,
skipping to change at line 42 skipping to change at line 43
* *
* This class lets you add vertices and edges one at a time to the polygo n. * This class lets you add vertices and edges one at a time to the polygo n.
* The sequence must start with a vertex and thereafter vertices and edge s * The sequence must start with a vertex and thereafter vertices and edge s
* can be added in any order. Any vertex after the first creates a new e dge * can be added in any order. Any vertex after the first creates a new e dge
* which is the ''shortest'' geodesic from the previous vertex. In some * which is the ''shortest'' geodesic from the previous vertex. In some
* cases there may be two or many such shortest geodesics and the area is * cases there may be two or many such shortest geodesics and the area is
* then not uniquely defined. In this case, either add an intermediate * then not uniquely defined. In this case, either add an intermediate
* vertex or add the edge ''as'' an edge (by defining its direction and * vertex or add the edge ''as'' an edge (by defining its direction and
* length). * length).
* *
* The area and perimeter are accumulated in two times the standard float ing * The area and perimeter are accumulated at two times the standard float ing
* point precision to guard against the loss of accuracy with many-sided * point precision to guard against the loss of accuracy with many-sided
* polygons. At any point you can ask for the perimeter and area so far. * polygons. At any point you can ask for the perimeter and area so far.
* There's an option to treat the points as defining a polyline instead o f a * There's an option to treat the points as defining a polyline instead o f a
* polygon; in that case, only the perimeter is computed. * polygon; in that case, only the perimeter is computed.
* *
* This is a templated class to allow it to be used with either Geodesic * This is a templated class to allow it to be used with Geodesic,
and * GeodesicExact, and Rhumb. GeographicLib::PolygonArea,
* GeodesicExact. GeographicLib::PolygonArea and * GeographicLib::PolygonAreaExact, and GeographicLib::PolygonAreaRhumb a
* GeographicLib::PolygonAreaExact are typedefs for these two cases. re
* typedefs for these cases.
* *
* @tparam GeodType the geodesic class to use. * @tparam GeodType the geodesic class to use.
* *
* Example of use: * Example of use:
* \include example-PolygonArea.cpp * \include example-PolygonArea.cpp
* *
* <a href="Planimeter.1.html">Planimeter</a> is a command-line utility * <a href="Planimeter.1.html">Planimeter</a> is a command-line utility
* providing access to the functionality of PolygonArea. * providing access to the functionality of PolygonAreaT.
**********************************************************************/ **********************************************************************/
template <class GeodType = Geodesic> template <class GeodType = Geodesic>
class PolygonAreaT { class PolygonAreaT {
private: private:
typedef Math::real real; typedef Math::real real;
GeodType _earth; GeodType _earth;
real _area0; // Full ellipsoid area real _area0; // Full ellipsoid area
bool _polyline; // Assume polyline (don't close and skip ar ea) bool _polyline; // Assume polyline (don't close and skip ar ea)
unsigned _mask; unsigned _mask;
skipping to change at line 85 skipping to change at line 87
// Otherwise return zero. // Otherwise return zero.
// Compute lon12 the same way as Geodesic::Inverse. // Compute lon12 the same way as Geodesic::Inverse.
lon1 = Math::AngNormalize(lon1); lon1 = Math::AngNormalize(lon1);
lon2 = Math::AngNormalize(lon2); lon2 = Math::AngNormalize(lon2);
real lon12 = Math::AngDiff(lon1, lon2); real lon12 = Math::AngDiff(lon1, lon2);
int cross = int cross =
lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 : lon1 < 0 && lon2 >= 0 && lon12 > 0 ? 1 :
(lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0); (lon2 < 0 && lon1 >= 0 && lon12 < 0 ? -1 : 0);
return cross; return cross;
} }
// an alternate version of transit to deal with longitudes in the direc
t
// problem.
static inline int transitdirect(real lon1, real lon2) {
using std::fmod;
// We want to compute exactly
// int(floor(lon2 / 360)) - int(floor(lon1 / 360))
// Since we only need the parity of the result we can use std::remquo
but
// this is buggy with g++ 4.8.3 and requires C++11. So instead we do
lon1 = fmod(lon1, real(720)); lon2 = fmod(lon2, real(720));
return ( ((lon2 >= 0 && lon2 < 360) || lon2 < -360 ? 0 : 1) -
((lon1 >= 0 && lon1 < 360) || lon1 < -360 ? 0 : 1) );
}
public: public:
/** /**
* Constructor for PolygonAreaT. * Constructor for PolygonAreaT.
* *
* @param[in] earth the Geodesic object to use for geodesic calculation s. * @param[in] earth the Geodesic object to use for geodesic calculation s.
* @param[in] polyline if true that treat the points as defining a poly line * @param[in] polyline if true that treat the points as defining a poly line
* instead of a polygon (default = false). * instead of a polygon (default = false).
********************************************************************** / ********************************************************************** /
PolygonAreaT(const GeodType& earth, bool polyline = false) PolygonAreaT(const GeodType& earth, bool polyline = false)
: _earth(earth) : _earth(earth)
, _area0(_earth.EllipsoidArea()) , _area0(_earth.EllipsoidArea())
, _polyline(polyline) , _polyline(polyline)
, _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE | , _mask(GeodType::LATITUDE | GeodType::LONGITUDE | GeodType::DISTANCE |
(_polyline ? GeodType::NONE : GeodType::AREA)) (_polyline ? GeodType::NONE :
GeodType::AREA | GeodType::LONG_NOWRAP))
{ Clear(); } { Clear(); }
/** /**
* Clear PolygonAreaT, allowing a new polygon to be started. * Clear PolygonAreaT, allowing a new polygon to be started.
********************************************************************** / ********************************************************************** /
void Clear() { void Clear() {
_num = 0; _num = 0;
_crossings = 0; _crossings = 0;
_areasum = 0; _areasum = 0;
_perimetersum = 0; _perimetersum = 0;
skipping to change at line 268 skipping to change at line 283
/** /**
* @relates PolygonAreaT * @relates PolygonAreaT
* *
* Polygon areas using GeodesicExact. (But note that the implementation of * Polygon areas using GeodesicExact. (But note that the implementation of
* areas in GeodesicExact uses a high order series and this is only accur ate * areas in GeodesicExact uses a high order series and this is only accur ate
* for modest flattenings.) * for modest flattenings.)
**********************************************************************/ **********************************************************************/
typedef PolygonAreaT<GeodesicExact> PolygonAreaExact; typedef PolygonAreaT<GeodesicExact> PolygonAreaExact;
/**
* @relates PolygonAreaT
*
* Polygon areas using Rhumb.
**********************************************************************/
typedef PolygonAreaT<Rhumb> PolygonAreaRhumb;
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_POLYGONAREA_HPP #endif // GEOGRAPHICLIB_POLYGONAREA_HPP
 End of changes. 8 change blocks. 
8 lines changed or deleted 32 lines changed or added


 Rhumb.hpp   Rhumb.hpp 
skipping to change at line 16 skipping to change at line 16
* the MIT/X11 License. For more information, see * the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_RHUMB_HPP) #if !defined(GEOGRAPHICLIB_RHUMB_HPP)
#define GEOGRAPHICLIB_RHUMB_HPP 1 #define GEOGRAPHICLIB_RHUMB_HPP 1
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/Ellipsoid.hpp> #include <GeographicLib/Ellipsoid.hpp>
#if !defined(GEOGRAPHICLIB_RHUMBAREA_ORDER)
/**
* The order of the series approximation used in rhumb area calculations.
* GEOGRAPHICLIB_RHUMBAREA_ORDER can be set to any integer in [4, 8].
**********************************************************************/
# define GEOGRAPHICLIB_RHUMBAREA_ORDER \
(GEOGRAPHICLIB_PRECISION == 2 ? 6 : \
(GEOGRAPHICLIB_PRECISION == 1 ? 4 : 8))
#endif
namespace GeographicLib { namespace GeographicLib {
class RhumbLine; class RhumbLine;
template <class T> class PolygonAreaT;
/** /**
* \brief Solve of the direct and inverse rhumb problems. * \brief Solve of the direct and inverse rhumb problems.
* *
* The path of constant azimuth between two points on a ellipsoid at (\e * The path of constant azimuth between two points on a ellipsoid at (\e
* lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also * lat1, \e lon1) and (\e lat2, \e lon2) is called the rhumb line (also
* called the loxodrome). Its length is \e s12 and its azimuth is \e azi * called the loxodrome). Its length is \e s12 and its azimuth is \e azi
12 12.
* and \e azi2. (The azimuth is the heading measured clockwise from nort * (The azimuth is the heading measured clockwise from north.)
h.)
* *
* Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2 , * Given \e lat1, \e lon1, \e azi12, and \e s12, we can determine \e lat2 ,
* and \e lon2. This is the \e direct rhumb problem and its solution is * and \e lon2. This is the \e direct rhumb problem and its solution is
* given by the function Rhumb::Direct. * given by the function Rhumb::Direct.
* *
* Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1 2 * Given \e lat1, \e lon1, \e lat2, and \e lon2, we can determine \e azi1 2
* and \e s12. This is the \e inverse rhumb problem, whose solution is * and \e s12. This is the \e inverse rhumb problem, whose solution is g
* given by Rhumb::Inverse. This finds the shortest such rhumb line, i.e iven
., * by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the
* the one that wraps no more than half way around the earth . one
* that wraps no more than half way around the earth. If the end points
are
* on opposite meridians, there are two shortest rhumb lines and the
* east-going one is chosen.
*
* These routines also optionally calculate the area under the rhumb line
, \e
* S12. This is the area, measured counter-clockwise, of the rhumb line
* quadrilateral with corners (<i>lat1</i>,<i>lon1</i>), (0,<i>lon1</i>),
* (0,<i>lon2</i>), and (<i>lat2</i>,<i>lon2</i>).
* *
* Note that rhumb lines may be appreciably longer (up to 50%) than the * Note that rhumb lines may be appreciably longer (up to 50%) than the
* corresponding Geodesic. For example the distance between London Heath row * corresponding Geodesic. For example the distance between London Heath row
* and Tokyo Narita via the rhumb line is 11400 km which is 18% longer th an * and Tokyo Narita via the rhumb line is 11400 km which is 18% longer th an
* the geodesic distance 9600 km. * the geodesic distance 9600 km.
* *
* For more information on rhumb lines see \ref rhumb. * For more information on rhumb lines see \ref rhumb.
* *
* Example of use: * Example of use:
* \include example-Rhumb.cpp * \include example-Rhumb.cpp
**********************************************************************/ **********************************************************************/
class GEOGRAPHICLIB_EXPORT Rhumb { class GEOGRAPHICLIB_EXPORT Rhumb {
private: private:
typedef Math::real real; typedef Math::real real;
friend class RhumbLine; friend class RhumbLine;
template <class T> friend class PolygonAreaT;
Ellipsoid _ell; Ellipsoid _ell;
bool _exact; bool _exact;
real _c2;
static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER; static const int tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER;
static const int maxpow_ = GEOGRAPHICLIB_RHUMBAREA_ORDER;
// _R[0] unused
real _R[maxpow_ + 1];
static inline real overflow() { static inline real overflow() {
// Overflow value s.t. atan(overflow_) = pi/2 // Overflow value s.t. atan(overflow_) = pi/2
static const real static const real
overflow = 1 / Math::sq(std::numeric_limits<real>::epsilon()); overflow = 1 / Math::sq(std::numeric_limits<real>::epsilon());
return overflow; return overflow;
} }
static inline real tano(real x) { static inline real tano(real x) {
using std::abs; using std::tan; using std::abs; using std::tan;
return return
2 * abs(x) == Math::pi() ? (x < 0 ? - overflow() : overflow()) : 2 * abs(x) == Math::pi() ? (x < 0 ? - overflow() : overflow()) :
skipping to change at line 81 skipping to change at line 104
// accurately // accurately
// //
// Definition: Df(x,y,d) = (f(x) - f(y)) / (x - y) // Definition: Df(x,y,d) = (f(x) - f(y)) / (x - y)
// See: // See:
// W. M. Kahan and R. J. Fateman, // W. M. Kahan and R. J. Fateman,
// Symbolic computation of divided differences, // Symbolic computation of divided differences,
// SIGSAM Bull. 33(3), 7-28 (1999) // SIGSAM Bull. 33(3), 7-28 (1999)
// http://dx.doi.org/10.1145/334714.334716 // http://dx.doi.org/10.1145/334714.334716
// http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
static inline real Dlog(real x, real y) {
real t = x - y;
return t ? 2 * Math::atanh(t / (x + y)) / t : 1 / x;
}
static inline real Dtan(real x, real y) { static inline real Dtan(real x, real y) {
real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty; real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty;
return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d : return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d :
1 + txy; 1 + txy;
} }
static inline real Datan(real x, real y) { static inline real Datan(real x, real y) {
using std::atan; using std::atan;
real d = x - y, xy = x * y; real d = x - y, xy = x * y;
return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d : return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d :
1 / (1 + xy); 1 / (1 + xy);
} }
static inline real Dsin(real x, real y) { static inline real Dsin(real x, real y) {
using std::sin; using std::cos; using std::sin; using std::cos;
real d = (x - y)/2; real d = (x - y) / 2;
return cos((x + y)/2) * (d ? sin(d) / d : 1); return cos((x + y)/2) * (d ? sin(d) / d : 1);
} }
static inline real Dsinh(real x, real y) { static inline real Dsinh(real x, real y) {
using std::sinh; using std::cosh; using std::sinh; using std::cosh;
real d = (x - y)/2; real d = (x - y) / 2;
return cosh((x + y)/2) * (d ? sinh(d) / d : 1); return cosh((x + y) / 2) * (d ? sinh(d) / d : 1);
}
static inline real Dcosh(real x, real y) {
using std::sinh;
real d = (x - y) / 2;
return sinh((x + y) / 2) * (d ? sinh(d) / d : 1);
} }
static inline real Dasinh(real x, real y) { static inline real Dasinh(real x, real y) {
real d = x - y, real d = x - y,
hx = Math::hypot(real(1), x), hy = Math::hypot(real(1), y); hx = Math::hypot(real(1), x), hy = Math::hypot(real(1), y);
return d ? Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) : return d ? Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) :
x*hy - y*hx) / d : x*hy - y*hx) / d :
1 / hx; 1 / hx;
} }
static inline real Dgd(real x, real y) { static inline real Dgd(real x, real y) {
using std::sinh; using std::sinh;
skipping to change at line 138 skipping to change at line 170
return t ? eatanhe(t / d) / t : _ell._e2 / d; return t ? eatanhe(t / d) / t : _ell._e2 / d;
} }
// (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd k ind // (E(x) - E(y)) / (x - y) -- E = incomplete elliptic integral of 2nd k ind
real DE(real x, real y) const; real DE(real x, real y) const;
// (mux - muy) / (phix - phiy) using elliptic integrals // (mux - muy) / (phix - phiy) using elliptic integrals
real DRectifying(real latx, real laty) const; real DRectifying(real latx, real laty) const;
// (psix - psiy) / (phix - phiy) // (psix - psiy) / (phix - phiy)
real DIsometric(real latx, real laty) const; real DIsometric(real latx, real laty) const;
// (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y ) // (sum(c[j]*sin(2*j*x),j=1..n) - sum(c[j]*sin(2*j*x),j=1..n)) / (x - y )
static real SinSeries(real x, real y, const real c[], int n); static real SinCosSeries(bool sinp,
real x, real y, const real c[], int n);
// (mux - muy) / (chix - chiy) using Krueger's series // (mux - muy) / (chix - chiy) using Krueger's series
real DConformalToRectifying(real chix, real chiy) const; real DConformalToRectifying(real chix, real chiy) const;
// (chix - chiy) / (mux - muy) using Krueger's series // (chix - chiy) / (mux - muy) using Krueger's series
real DRectifyingToConformal(real mux, real muy) const; real DRectifyingToConformal(real mux, real muy) const;
// (mux - muy) / (psix - psiy) // (mux - muy) / (psix - psiy)
real DIsometricToRectifying(real psix, real psiy) const; real DIsometricToRectifying(real psix, real psiy) const;
// (psix - psiy) / (mux - muy) // (psix - psiy) / (mux - muy)
real DRectifyingToIsometric(real mux, real muy) const; real DRectifyingToIsometric(real mux, real muy) const;
real MeanSinXi(real psi1, real psi2) const;
// The following two functions (with lots of ignored arguments) mimic t
he
// interface to the corresponding Geodesic function. These are needed
by
// PolygonAreaT.
void GenDirect(real lat1, real lon1, real azi12,
bool, real s12, unsigned outmask,
real& lat2, real& lon2, real&, real&, real&, real&, real
&,
real& S12) const {
GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12);
}
void GenInverse(real lat1, real lon1, real lat2, real lon2,
unsigned outmask, real& s12, real& azi12,
real&, real& , real& , real& , real& S12) const {
GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12);
}
public: public:
/** /**
* Bit masks for what calculations to do. They specify which results t
o
* return in the general routines Rhumb::GenDirect and Rhumb::GenInvers
e
* routines. RhumbLine::mask is a duplication of this enum.
**********************************************************************
/
enum mask {
/**
* No output.
* @hideinitializer
********************************************************************
**/
NONE = 0U,
/**
* Calculate latitude \e lat2.
* @hideinitializer
********************************************************************
**/
LATITUDE = 1U<<7,
/**
* Calculate longitude \e lon2.
* @hideinitializer
********************************************************************
**/
LONGITUDE = 1U<<8,
/**
* Calculate azimuth \e azi12.
* @hideinitializer
********************************************************************
**/
AZIMUTH = 1U<<9,
/**
* Calculate distance \e s12.
* @hideinitializer
********************************************************************
**/
DISTANCE = 1U<<10,
/**
* Calculate area \e S12.
* @hideinitializer
********************************************************************
**/
AREA = 1U<<14,
/**
* Do not wrap the \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = 1U<<15,
/**
* Calculate everything. (LONG_NOWRAP is not included in this mask.)
* @hideinitializer
********************************************************************
**/
ALL = 0x7F80U,
};
/**
* Constructor for a ellipsoid with * Constructor for a ellipsoid with
* *
* @param[in] a equatorial radius (meters). * @param[in] a equatorial radius (meters).
* @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe re. * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe re.
* Negative \e f gives a prolate ellipsoid. If \e f &gt; 1, set * Negative \e f gives a prolate ellipsoid. If \e f &gt; 1, set
* flattening to 1/\e f. * flattening to 1/\e f.
* @param[in] exact if true (the default) use an addition theorem for * @param[in] exact if true (the default) use an addition theorem for
* elliptic integrals to compute divided differences; otherwise use * elliptic integrals to compute divided differences; otherwise use
* series expansion (accurate for |<i>f</i>| < 0.01). * series expansion (accurate for |<i>f</i>| < 0.01).
* @exception GeographicErr if \e a or (1 &minus; \e f) \e a is not * @exception GeographicErr if \e a or (1 &minus; \e f) \e a is not
* positive. * positive.
* *
* See \ref rhumb, for a detailed description of the \e exact parameter . * See \ref rhumb, for a detailed description of the \e exact parameter .
********************************************************************** / ********************************************************************** /
Rhumb(real a, real f, bool exact = true) : _ell(a, f), _exact(exact) {} Rhumb(real a, real f, bool exact = true);
/** /**
* Solve the direct rhumb problem. * Solve the direct rhumb problem returning also the area.
* *
* @param[in] lat1 latitude of point 1 (degrees). * @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees).
* @param[in] azi12 azimuth of the rhumb line (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees).
* @param[in] s12 distance between point 1 and point 2 (meters); it can be * @param[in] s12 distance between point 1 and point 2 (meters); it can be
* negative. * negative.
* @param[out] lat2 latitude of point 2 (degrees). * @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
* *
* \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 an d \e * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 an d \e
* azi1 should be in the range [&minus;540&deg;, 540&deg;). The values * azi12 should be in the range [&minus;540&deg;, 540&deg;). The value
of of
* \e lon2 and \e azi2 returned are in the range [&minus;180&deg;, * \e lon2 returned is in the range [&minus;180&deg;, 180&deg;).
* 180&deg;).
* *
* If point 1 is a pole, the cosine of its latitude is taken to be * If point 1 is a pole, the cosine of its latitude is taken to be
* 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
* position, which is extremely close to the actual pole, allows the * position, which is extremely close to the actual pole, allows the
* calculation to be carried out in finite terms. If \e s12 is large * calculation to be carried out in finite terms. If \e s12 is large
* enough that the rhumb line crosses a pole, the longitude of point 2 * enough that the rhumb line crosses a pole, the longitude of point 2
* is indeterminate (a NaN is returned for \e lon2). * is indeterminate (a NaN is returned for \e lon2 and \e S12).
********************************************************************** / ********************************************************************** /
void Direct(real lat1, real lon1, real azi12, real s12, void Direct(real lat1, real lon1, real azi12, real s12,
real& lat2, real& lon2) const; real& lat2, real& lon2, real& S12) const {
GenDirect(lat1, lon1, azi12, s12,
LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
}
/** /**
* Solve the inverse rhumb problem. * Solve the direct rhumb problem without the area.
**********************************************************************
/
void Direct(real lat1, real lon1, real azi12, real s12,
real& lat2, real& lon2) const {
real t;
GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t
);
}
/**
* The general direct rhumb problem. Rhumb::Direct is defined in terms
* of this function.
*
* @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees).
* @param[in] azi12 azimuth of the rhumb line (degrees).
* @param[in] s12 distance between point 1 and point 2 (meters); it can
be
* negative.
* @param[in] outmask a bitor'ed combination of Rhumb::mask values
* specifying which of the following parameters should be set.
* @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
*
* The Rhumb::mask values possible for \e outmask are
* - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2;
* - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2;
* - \e outmask |= Rhumb::AREA for the area \e S12;
* - \e outmask |= Rhumb::ALL for all of the above;
* - \e outmask |= Rhumb::LONG_NOWRAP stops the returned value of \e
* lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
* .
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the rhumb line wrapped around the ellipsoid
.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
**********************************************************************
/
void GenDirect(real lat1, real lon1, real azi12, real s12, unsigned out
mask,
real& lat2, real& lon2, real& S12) const;
/**
* Solve the inverse rhumb problem returning also the area.
* *
* @param[in] lat1 latitude of point 1 (degrees). * @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees).
* @param[in] lat2 latitude of point 2 (degrees). * @param[in] lat2 latitude of point 2 (degrees).
* @param[in] lon2 longitude of point 2 (degrees). * @param[in] lon2 longitude of point 2 (degrees).
* @param[out] s12 rhumb distance between point 1 and point 2 (meters). * @param[out] s12 rhumb distance between point 1 and point 2 (meters).
* @param[out] azi12 azimuth of the rhumb line (degrees). * @param[out] azi12 azimuth of the rhumb line (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
* *
* The shortest rhumb line is found. \e lat1 and \e lat2 should be in * The shortest rhumb line is found. If the end points are on opposite
the * meridians, there are two shortest rhumb lines and the east-going one
* range [&minus;90&deg;, 90&deg;]; \e lon1 and \e lon2 should be in th is
e * chosen. \e lat1 and \e lat2 should be in the range [&minus;90&deg;,
* range [&minus;540&deg;, 540&deg;). The value of \e azi12 returned i * 90&deg;]; \e lon1 and \e lon2 should be in the range [&minus;540&deg
s in ;,
* the range [&minus;180&deg;, 180&deg;). * 540&deg;). The value of \e azi12 returned is in the range
* [&minus;180&deg;, 180&deg;).
* *
* If either point is a pole, the cosine of its latitude is taken to be * If either point is a pole, the cosine of its latitude is taken to be
* 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This * 1/&epsilon;<sup>2</sup> (where &epsilon; is 2<sup>-52</sup>). This
* position, which is extremely close to the actual pole, allows the * position, which is extremely close to the actual pole, allows the
* calculation to be carried out in finite terms. * calculation to be carried out in finite terms.
********************************************************************** / ********************************************************************** /
void Inverse(real lat1, real lon1, real lat2, real lon2, void Inverse(real lat1, real lon1, real lat2, real lon2,
real& s12, real& azi12) const; real& s12, real& azi12, real& S12) const {
GenInverse(lat1, lon1, lat2, lon2,
DISTANCE | AZIMUTH | AREA, s12, azi12, S12);
}
/**
* Solve the inverse rhumb problem without the area.
**********************************************************************
/
void Inverse(real lat1, real lon1, real lat2, real lon2,
real& s12, real& azi12) const {
real t;
GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t)
;
}
/**
* The general inverse rhumb problem. Rhumb::Inverse is defined in ter
ms
* of this function.
*
* @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees).
* @param[in] lat2 latitude of point 2 (degrees).
* @param[in] lon2 longitude of point 2 (degrees).
* @param[in] outmask a bitor'ed combination of Rhumb::mask values
* specifying which of the following parameters should be set.
* @param[out] s12 rhumb distance between point 1 and point 2 (meters).
* @param[out] azi12 azimuth of the rhumb line (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
*
* The Rhumb::mask values possible for \e outmask are
* - \e outmask |= Rhumb::DISTANCE for the latitude \e s12;
* - \e outmask |= Rhumb::AZIMUTH for the latitude \e azi12;
* - \e outmask |= Rhumb::AREA for the area \e S12;
* - \e outmask |= Rhumb::ALL for all of the above;
**********************************************************************
/
void GenInverse(real lat1, real lon1, real lat2, real lon2,
unsigned outmask,
real& s12, real& azi12, real& S12) const;
/** /**
* Set up to compute several points on a single rhumb line. * Set up to compute several points on a single rhumb line.
* *
* @param[in] lat1 latitude of point 1 (degrees). * @param[in] lat1 latitude of point 1 (degrees).
* @param[in] lon1 longitude of point 1 (degrees). * @param[in] lon1 longitude of point 1 (degrees).
* @param[in] azi12 azimuth of the rhumb line (degrees). * @param[in] azi12 azimuth of the rhumb line (degrees).
* @return a RhumbLine object. * @return a RhumbLine object.
* *
* \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 an d \e * \e lat1 should be in the range [&minus;90&deg;, 90&deg;]; \e lon1 an d \e
skipping to change at line 251 skipping to change at line 431
* the value used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const { return _ell.MajorRadius(); } Math::real MajorRadius() const { return _ell.MajorRadius(); }
/** /**
* @return \e f the flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the
* value used in the constructor. * value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real Flattening() const { return _ell.Flattening(); } Math::real Flattening() const { return _ell.Flattening(); }
Math::real EllipsoidArea() const { return _ell.Area(); }
/** /**
* A global instantiation of Rhumb with the parameters for the WGS84 * A global instantiation of Rhumb with the parameters for the WGS84
* ellipsoid. * ellipsoid.
********************************************************************** / ********************************************************************** /
static const Rhumb& WGS84(); static const Rhumb& WGS84();
}; };
/** /**
* \brief Find a sequence of points on a single rhumb line. * \brief Find a sequence of points on a single rhumb line.
* *
* RhumbLine facilitates the determination of a series of points on a sin gle * RhumbLine facilitates the determination of a series of points on a sin gle
* rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e * rhumb line. The starting point (\e lat1, \e lon1) and the azimuth \e
* azi12 are specified in the call to Rhumb::Line which returns a RhumbLi ne * azi12 are specified in the call to Rhumb::Line which returns a RhumbLi ne
* object. RhumbLine.Position returns the location of point 2 a distance * object. RhumbLine.Position returns the location of point 2 (and,
\e * optionally, the corresponding area, \e S12) a distance \e s12 along th
* s12 along the rhumb line. e
* rhumb line.
*
* There is no public constructor for this class. (Use Rhumb::Line to cr eate * There is no public constructor for this class. (Use Rhumb::Line to cr eate
* an instance.) The Rhumb object used to create a RhumbLine must stay i n * an instance.) The Rhumb object used to create a RhumbLine must stay i n
* scope as long as the RhumbLine. * scope as long as the RhumbLine.
* *
* Example of use: * Example of use:
* \include example-RhumbLine.cpp * \include example-RhumbLine.cpp
**********************************************************************/ **********************************************************************/
class GEOGRAPHICLIB_EXPORT RhumbLine { class GEOGRAPHICLIB_EXPORT RhumbLine {
private: private:
typedef Math::real real; typedef Math::real real;
friend class Rhumb; friend class Rhumb;
const Rhumb& _rh; const Rhumb& _rh;
bool _exact; bool _exact;
real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1; real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed RhumbLine& operator=(const RhumbLine&); // copy assignment not allowed
RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12, RhumbLine(const Rhumb& rh, real lat1, real lon1, real azi12,
bool exact); bool exact);
public: public:
enum mask {
/**
* No output.
* @hideinitializer
********************************************************************
**/
NONE = Rhumb::NONE,
/**
* Calculate latitude \e lat2.
* @hideinitializer
********************************************************************
**/
LATITUDE = Rhumb::LATITUDE,
/**
* Calculate longitude \e lon2.
* @hideinitializer
********************************************************************
**/
LONGITUDE = Rhumb::LONGITUDE,
/**
* Calculate azimuth \e azi12.
* @hideinitializer
********************************************************************
**/
AZIMUTH = Rhumb::AZIMUTH,
/**
* Calculate distance \e s12.
* @hideinitializer
********************************************************************
**/
DISTANCE = Rhumb::DISTANCE,
/**
* Calculate area \e S12.
* @hideinitializer
********************************************************************
**/
AREA = Rhumb::AREA,
/**
* Do wrap the \e lon2 in the direct calculation.
* @hideinitializer
********************************************************************
**/
LONG_NOWRAP = Rhumb::LONG_NOWRAP,
/**
* Calculate everything. (LONG_NOWRAP is not included in this mask.)
* @hideinitializer
********************************************************************
**/
ALL = Rhumb::ALL,
};
/** /**
* Compute the position of point 2 which is a distance \e s12 (meters) from * Compute the position of point 2 which is a distance \e s12 (meters) from
* point 1. * point 1. The area is also computed.
* *
* @param[in] s12 distance between point 1 and point 2 (meters); it can be * @param[in] s12 distance between point 1 and point 2 (meters); it can be
* negative. * negative.
* @param[out] lat2 latitude of point 2 (degrees). * @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
* *
* The values of \e lon2 and \e azi2 returned are in the range * The value of \e lon2 returned is in the range [&minus;180&deg;,
* [&minus;180&deg;, 180&deg;). * 180&deg;).
*
* If \e s12 is large enough that the rhumb line crosses a pole, the
* longitude of point 2 is indeterminate (a NaN is returned for \e lon2
and
* \e S12).
**********************************************************************
/
void Position(real s12, real& lat2, real& lon2, real& S12) const {
GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
}
/**
* Compute the position of point 2 which is a distance \e s12 (meters)
from
* point 1. The area is not computed.
**********************************************************************
/
void Position(real s12, real& lat2, real& lon2) const {
real t;
GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t);
}
/**
* The general position routine. RhumbLine::Position is defined in ter
m so
* this function.
*
* @param[in] s12 distance between point 1 and point 2 (meters); it can
be
* negative.
* @param[in] outmask a bitor'ed combination of Rhumb::mask values
* specifying which of the following parameters should be set.
* @param[out] lat2 latitude of point 2 (degrees).
* @param[out] lon2 longitude of point 2 (degrees).
* @param[out] S12 area under the rhumb line (meters<sup>2</sup>).
*
* The Rhumb::mask values possible for \e outmask are
* - \e outmask |= Rhumb::LATITUDE for the latitude \e lat2;
* - \e outmask |= Rhumb::LONGITUDE for the latitude \e lon2;
* - \e outmask |= Rhumb::AREA for the area \e S12;
* - \e outmask |= Rhumb::ALL for all of the above;
* - \e outmask |= Rhumb::LONG_NOWRAP stops the returned value of \e
* lon2 being wrapped into the range [&minus;180&deg;, 180&deg;).
* .
* With the LONG_NOWRAP bit set, the quantity \e lon2 &minus; \e lon1
* indicates how many times the rhumb line wrapped around the ellipsoid
.
* Because \e lon2 might be outside the normal allowed range for
* longitudes, [&minus;540&deg;, 540&deg;), be sure to normalize it wit
h
* Math::AngNormalize2 before using it in other GeographicLib calls.
* *
* If \e s12 is large enough that the rhumb line crosses a pole, the * If \e s12 is large enough that the rhumb line crosses a pole, the
* longitude of point 2 is indeterminate (a NaN is returned for \e lon2 * longitude of point 2 is indeterminate (a NaN is returned for \e lon2
). and
* \e S12).
********************************************************************** / ********************************************************************** /
void Position(real s12, real& lat2, real& lon2) const; void GenPosition(real s12, unsigned outmask,
real& lat2, real& lon2, real& S12) const;
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @return \e lat1 the latitude of point 1 (degrees). * @return \e lat1 the latitude of point 1 (degrees).
********************************************************************** / ********************************************************************** /
Math::real Latitude() const { return _lat1; } Math::real Latitude() const { return _lat1; }
 End of changes. 31 change blocks. 
39 lines changed or deleted 354 lines changed or added


 Utility.hpp   Utility.hpp 
/** /**
* \file Utility.hpp * \file Utility.hpp
* \brief Header for GeographicLib::Utility class * \brief Header for GeographicLib::Utility class
* *
* Copyright (c) Charles Karney (2011-2012) <charles@karney.com> and licens ed * Copyright (c) Charles Karney (2011-2014) <charles@karney.com> and licens ed
* under the MIT/X11 License. For more information, see * under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_UTILITY_HPP) #if !defined(GEOGRAPHICLIB_UTILITY_HPP)
#define GEOGRAPHICLIB_UTILITY_HPP 1 #define GEOGRAPHICLIB_UTILITY_HPP 1
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <iomanip> #include <iomanip>
#include <vector> #include <vector>
#include <sstream> #include <sstream>
#include <cctype> #include <cctype>
#include <ctime>
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Squelch warnings about constant conditional expressions // Squelch warnings about constant conditional expressions and unsafe gmtim e
# pragma warning (push) # pragma warning (push)
# pragma warning (disable: 4127) # pragma warning (disable: 4127 4996)
#endif #endif
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Some utility routines for %GeographicLib * \brief Some utility routines for %GeographicLib
* *
* Example of use: * Example of use:
* \include example-Utility.cpp * \include example-Utility.cpp
**********************************************************************/ **********************************************************************/
skipping to change at line 168 skipping to change at line 169
m = (5 * s + 2) / 153; // Determine the month m = (5 * s + 2) / 153; // Determine the month
s -= (153 * m + 2) / 5; // s = 0 at beginning of month s -= (153 * m + 2) / 5; // s = 0 at beginning of month
d = s + 1; // Determine day of month d = s + 1; // Determine day of month
y += (m + 2) / 12; // Move Jan and Feb back to original year y += (m + 2) / 12; // Move Jan and Feb back to original year
m = (m + 2) % 12 + 1; // Renumber the months so January = 1 m = (m + 2) % 12 + 1; // Renumber the months so January = 1
} }
/** /**
* Given a date as a string in the format yyyy, yyyy-mm, or yyyy-mm-dd, * Given a date as a string in the format yyyy, yyyy-mm, or yyyy-mm-dd,
* return the numeric values for the year, month, and day. No checking is * return the numeric values for the year, month, and day. No checking is
* done on these values. * done on these values. The string "now" is interpreted as the presen
t
* date (in UTC).
* *
* @param[in] s the date in string format. * @param[in] s the date in string format.
* @param[out] y the year. * @param[out] y the year.
* @param[out] m the month, Jan = 1, etc. * @param[out] m the month, Jan = 1, etc.
* @param[out] d the day of the month. * @param[out] d the day of the month.
* @exception GeographicErr is \e s is malformed. * @exception GeographicErr is \e s is malformed.
********************************************************************** / ********************************************************************** /
static void date(const std::string& s, int& y, int& m, int& d) { static void date(const std::string& s, int& y, int& m, int& d) {
if (s == "now") {
std::time_t t = std::time(0);
struct tm* now = gmtime(&t);
y = now->tm_year + 1900;
m = now->tm_mon + 1;
d = now->tm_mday;
return;
}
int y1, m1 = 1, d1 = 1; int y1, m1 = 1, d1 = 1;
const char* digits = "0123456789"; const char* digits = "0123456789";
std::string::size_type p1 = s.find_first_not_of(digits); std::string::size_type p1 = s.find_first_not_of(digits);
if (p1 == std::string::npos) if (p1 == std::string::npos)
y1 = num<int>(s); y1 = num<int>(s);
else if (s[p1] != '-') else if (s[p1] != '-')
throw GeographicErr("Delimiter not hyphen in date " + s); throw GeographicErr("Delimiter not hyphen in date " + s);
else if (p1 == 0) else if (p1 == 0)
throw GeographicErr("Empty year field in date " + s); throw GeographicErr("Empty year field in date " + s);
else { else {
 End of changes. 6 change blocks. 
4 lines changed or deleted 15 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/