Accumulator.hpp   Accumulator.hpp 
/** /**
* \file Accumulator.hpp * \file Accumulator.hpp
* \brief Header for GeographicLib::Accumulator class * \brief Header for GeographicLib::Accumulator class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
m> sed
* and licensed 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_ACCUMULATOR_HPP) #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP)
#define GEOGRAPHICLIB_ACCUMULATOR_HPP "$Id: a33a908abf92c801d781b41a4e175bb 50b3f8680 $" #define GEOGRAPHICLIB_ACCUMULATOR_HPP "$Id: d84e4e2bc5c07f7956205da62656e9b bb3765968 $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief An accumulator for sums. * \brief An accumulator for sums.
* *
* This allow many numbers of floating point type \e T to be added togeth er * This allow many numbers of floating point type \e T to be added togeth er
* with twice the normal precision. Thus if \e T is double, the effectiv e * with twice the normal precision. Thus if \e T is double, the effectiv e
 End of changes. 2 change blocks. 
4 lines changed or deleted 4 lines changed or added


 Config.h   Config.h 
#define HAVE_LONG_DOUBLE 1 #define HAVE_LONG_DOUBLE 1
#define GEOGRAPHICLIB_VERSION_STRING "1.14" #define GEOGRAPHICLIB_VERSION_STRING "1.15"
/* # undef WORDS_BIGENDIAN */
 End of changes. 1 change blocks. 
0 lines changed or deleted 0 lines changed or added


 Constants.hpp   Constants.hpp 
/** /**
* \file Constants.hpp * \file Constants.hpp
* \brief Header for GeographicLib::Constants class * \brief Header for GeographicLib::Constants class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP)
#define GEOGRAPHICLIB_CONSTANTS_HPP "$Id: 199f3b1a85b240770f47ab44ded6f87b3 f69f28e $" #define GEOGRAPHICLIB_CONSTANTS_HPP "$Id: 6201f1cbf92bd8bf866f879fdd95a3cbf 5e3780f $"
#include <GeographicLib/Config.h> #include <GeographicLib/Config.h>
/** /**
* A compile-time assert. Use C++0X static_assert, if available. * A compile-time assert. Use C++0X static_assert, if available.
**********************************************************************/ **********************************************************************/
#if !defined(STATIC_ASSERT) #if !defined(STATIC_ASSERT)
# if defined(__GXX_EXPERIMENTAL_CXX0X__) # if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define STATIC_ASSERT static_assert # define STATIC_ASSERT static_assert
# elif defined(_MSC_VER) && _MSC_VER >= 1600 # elif defined(_MSC_VER) && _MSC_VER >= 1600
skipping to change at line 93 skipping to change at line 93
/** /**
* @return the number of radians in an arcsecond. * @return the number of radians in an arcsecond.
********************************************************************** / ********************************************************************** /
static inline Math::real arcsecond() throw() static inline Math::real arcsecond() throw()
{ return Math::degree<real>() / 3600; } { return Math::degree<real>() / 3600; }
/** \name Ellipsoid parameters /** \name Ellipsoid parameters
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @tparam T the type of the returned value.
* @return the equatorial radius of WGS84 ellipsoid (6378137 m). * @return the equatorial radius of WGS84 ellipsoid (6378137 m).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T WGS84_a() throw() { return T(6378137) * meter<T>(); } static inline T WGS84_a() throw() { return T(6378137) * meter<T>(); }
/** /**
* A synonym for WGS84_a<real>(). * A synonym for WGS84_a<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real WGS84_a() throw() { return WGS84_a<real>(); } static inline Math::real WGS84_a() throw() { return WGS84_a<real>(); }
/** /**
* @tparam T the type of the returned value.
* @return the flattening of WGS84 ellipsoid (1/298.257223563). * @return the flattening of WGS84 ellipsoid (1/298.257223563).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T WGS84_f() throw() { static inline T WGS84_f() throw() {
return T(1) / ( T(298) + T(257223563) / T(1000000000) ); return T(1) / ( T(298) + T(257223563) / T(1000000000) );
} }
/** /**
* A synonym for WGS84_f<real>(). * A synonym for WGS84_f<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real WGS84_f() throw() { return WGS84_f<real>(); } static inline Math::real WGS84_f() throw() { return WGS84_f<real>(); }
skipping to change at line 124 skipping to change at line 126
* @return the reciprocal flattening of WGS84 ellipsoid. * @return the reciprocal flattening of WGS84 ellipsoid.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T WGS84_r() throw() { return 1/WGS84_f<T>(); } static inline T WGS84_r() throw() { return 1/WGS84_f<T>(); }
/** /**
* <b>DEPRECATED</b> * <b>DEPRECATED</b>
* A synonym for WGS84_r<real>(). * A synonym for WGS84_r<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real WGS84_r() throw() { return WGS84_r<real>(); } static inline Math::real WGS84_r() throw() { return WGS84_r<real>(); }
/** /**
* @tparam T the type of the returned value.
* @return the central scale factor for UTM (0.9996). * @return the central scale factor for UTM (0.9996).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T UTM_k0() throw() {return T(9996) / T(10000); } static inline T UTM_k0() throw() {return T(9996) / T(10000); }
/** /**
* A synonym for UTM_k0<real>(). * A synonym for UTM_k0<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real UTM_k0() throw() { return UTM_k0<real>(); } static inline Math::real UTM_k0() throw() { return UTM_k0<real>(); }
/** /**
* @tparam T the type of the returned value.
* @return the central scale factor for UPS (0.994). * @return the central scale factor for UPS (0.994).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T UPS_k0() throw() { return T(994) / T(1000); } static inline T UPS_k0() throw() { return T(994) / T(1000); }
/** /**
* A synonym for UPS_k0<real>(). * A synonym for UPS_k0<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real UPS_k0() throw() { return UPS_k0<real>(); } static inline Math::real UPS_k0() throw() { return UPS_k0<real>(); }
///@} ///@}
/** \name SI units /** \name SI units
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @tparam T the type of the returned value.
* @return the number of meters in a meter. * @return the number of meters in a meter.
* *
* This is unity, but this lets the internal system of units be changed if * This is unity, but this lets the internal system of units be changed if
* necessary. * necessary.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T meter() throw() { return T(1); } static inline T meter() throw() { return T(1); }
/** /**
* A synonym for meter<real>(). * A synonym for meter<real>().
********************************************************************** / ********************************************************************** /
skipping to change at line 171 skipping to change at line 176
static inline Math::real kilometer() throw() static inline Math::real kilometer() throw()
{ return 1000 * meter<real>(); } { return 1000 * meter<real>(); }
/** /**
* @return the number of meters in a nautical mile (approximately 1 arc * @return the number of meters in a nautical mile (approximately 1 arc
* minute) * minute)
********************************************************************** / ********************************************************************** /
static inline Math::real nauticalmile() throw() static inline Math::real nauticalmile() throw()
{ return 1852 * meter<real>(); } { return 1852 * meter<real>(); }
/** /**
* @tparam T the type of the returned value.
* @return the number of square meters in a square meter. * @return the number of square meters in a square meter.
* *
* This is unity, but this lets the internal system of units be changed if * This is unity, but this lets the internal system of units be changed if
* necessary. * necessary.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T square_meter() throw() static inline T square_meter() throw()
{ return meter<real>() * meter<real>(); } { return meter<real>() * meter<real>(); }
/** /**
* A synonym for square_meter<real>(). * A synonym for square_meter<real>().
 End of changes. 7 change blocks. 
1 lines changed or deleted 7 lines changed or added


 DMS.hpp   DMS.hpp 
/** /**
* \file DMS.hpp * \file DMS.hpp
* \brief Header for GeographicLib::DMS class * \brief Header for GeographicLib::DMS class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_DMS_HPP) #if !defined(GEOGRAPHICLIB_DMS_HPP)
#define GEOGRAPHICLIB_DMS_HPP "$Id: 6fd4aeaf5388bb95ff1c45bece948f4dea2e1d5 e $" #define GEOGRAPHICLIB_DMS_HPP "$Id: bc4a072cb427ec5f1648616fdceea58c6fccae7 a $"
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/Utility.hpp>
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Squelch warnings about dll vs string // Squelch warnings about dll vs string
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4251) #pragma warning (disable: 4251)
#endif #endif
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Convert between degrees and %DMS representation. * \brief Convert between degrees and %DMS representation.
* *
* Parse a string representing degree, minutes, and seconds and return th e * Parse a string representing degree, minutes, and seconds and return th e
* angle in degrees and format an angle in degrees as degree, minutes, an d * angle in degrees and format an angle in degrees as degree, minutes, an d
* seconds. In addition, handle NANs and infinities on input and output. * seconds. In addition, handle NANs and infinities on input and output.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT DMS { class GEOGRAPHIC_EXPORT DMS {
private: private:
typedef Math::real real; typedef Math::real real;
static int lookup(const std::string& s, char c) throw() {
std::string::size_type r = s.find(toupper(c));
return r == std::string::npos ? -1 : int(r);
}
template<typename T> static std::string str(T x) {
std::ostringstream s; s << x; return s.str();
}
// Replace all occurrences of pat by c // Replace all occurrences of pat by c
static void replace(std::string& s, const std::string& pat, char c) { static void replace(std::string& s, const std::string& pat, char c) {
std::string::size_type p = 0; std::string::size_type p = 0;
while (true) { while (true) {
p = s.find(pat, p); p = s.find(pat, p);
if (p == std::string::npos) if (p == std::string::npos)
break; break;
s.replace(p, pat.length(), 1, c); s.replace(p, pat.length(), 1, c);
} }
} }
skipping to change at line 198 skipping to change at line 192
* @return angle (degrees) * @return angle (degrees)
* *
* This does not propagate the sign on \e d to the other components, so * This does not propagate the sign on \e d to the other components, so
* -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or * -3d20' would need to be represented as - DMS::Decode(3.0, 20.0) or
* DMS::Decode(-3.0, -20.0). * DMS::Decode(-3.0, -20.0).
********************************************************************** / ********************************************************************** /
static Math::real Decode(real d, real m = 0, real s = 0) throw() static Math::real Decode(real d, real m = 0, real s = 0) throw()
{ return d + (m + s/real(60))/real(60); } { return d + (m + s/real(60))/real(60); }
/** /**
* <b>DEPRECATED</b> (use Utility::num, instead).
* Convert a string to a real number. * Convert a string to a real number.
* *
* @param[in] str string input. * @param[in] str string input.
* @return decoded number. * @return decoded number.
********************************************************************** / ********************************************************************** /
static Math::real Decode(const std::string& str); static Math::real Decode(const std::string& str) {
return Utility::num<real>(str);
}
/** /**
* <b>DEPRECATED</b> (use Utility::fract, instead).
* Convert a string to a real number treating the case where the string is * Convert a string to a real number treating the case where the string is
* a simple fraction. * a simple fraction.
* *
* @param[in] str string input. * @param[in] str string input.
* @return decoded number. * @return decoded number.
********************************************************************** / ********************************************************************** /
static Math::real DecodeFraction(const std::string& str); static Math::real DecodeFraction(const std::string& str) {
return Utility::fract<real>(str);
}
/** /**
* Convert a pair of strings to latitude and longitude. * Convert a pair of strings to latitude and longitude.
* *
* @param[in] dmsa first string. * @param[in] dmsa first string.
* @param[in] dmsb second string. * @param[in] dmsb second string.
* @param[out] lat latitude. * @param[out] lat latitude.
* @param[out] lon longitude. * @param[out] lon longitude.
* @param[in] swaplatlong if true assume longitude is given before lati tude * @param[in] swaplatlong if true assume longitude is given before lati tude
* in the absence of hemisphere designators (default false). * in the absence of hemisphere designators (default false).
skipping to change at line 299 skipping to change at line 299
* trailing component based on the precision. * trailing component based on the precision.
* *
* @param[in] angle input angle (degrees) * @param[in] angle input angle (degrees)
* @param[in] prec the precision relative to 1 degree. * @param[in] prec the precision relative to 1 degree.
* @param[in] ind DMS::flag value indicated additional formatting. * @param[in] ind DMS::flag value indicated additional formatting.
* @return formatted string * @return formatted string
* *
* \e prec indicates the precision relative to 1 degree, e.g., \e prec = 3 * \e prec indicates the precision relative to 1 degree, e.g., \e prec = 3
* gives a result accurate to 0.1' and \e prec = 4 gives a result accur ate * gives a result accurate to 0.1' and \e prec = 4 gives a result accur ate
* to 1&quot;. \e ind is interpreted as in DMS::Encode with the additi onal * to 1&quot;. \e ind is interpreted as in DMS::Encode with the additi onal
* facility at DMS::NUMBER treats \e angle a number in fixed format wit * facility that DMS::NUMBER represents \e angle as a number in fixed
h * format with precision \e prec.
* precision \e prec.
********************************************************************** / ********************************************************************** /
static std::string Encode(real angle, unsigned prec, flag ind = NONE) { static std::string Encode(real angle, unsigned prec, flag ind = NONE) {
if (ind == NUMBER) { return ind == NUMBER ? Utility::str<real>(angle, int(prec)) :
if (!Math::isfinite(angle)) Encode(angle,
return angle < 0 ? std::string("-inf") : prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND),
(angle > 0 ? std::string("inf") : std::string("nan")); prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4),
std::ostringstream s; ind);
s << std::fixed << std::setprecision(prec) << angle;
return s.str();
} else
return Encode(angle,
prec < 2 ? DEGREE : (prec < 4 ? MINUTE : SECOND),
prec < 2 ? prec : (prec < 4 ? prec - 2 : prec - 4),
ind);
} }
/** /**
* Split angle into degrees and mintues * Split angle into degrees and mintues
* *
* @param[in] ang angle (degrees) * @param[in] ang angle (degrees)
* @param[out] d degrees (an integer returned as a real) * @param[out] d degrees (an integer returned as a real)
* @param[out] m arc minutes. * @param[out] m arc minutes.
********************************************************************** / ********************************************************************** /
static void Encode(real ang, real& d, real& m) throw() { static void Encode(real ang, real& d, real& m) throw() {
 End of changes. 9 change blocks. 
25 lines changed or deleted 17 lines changed or added


 Geocentric.hpp   Geocentric.hpp 
/** /**
* \file Geocentric.hpp * \file Geocentric.hpp
* \brief Header for GeographicLib::Geocentric class * \brief Header for GeographicLib::Geocentric class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP)
#define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: be669ce9c6549259c44bc2047e890d36 8c09377f $" #define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: 5e13a145df558737b41cb38be92d4e01 03120e6d $"
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief %Geocentric coordinates * \brief %Geocentric coordinates
* *
skipping to change at line 59 skipping to change at line 59
* The errors in these routines are close to round-off. Specifically, fo r * The errors in these routines are close to round-off. Specifically, fo r
* points within 5000 km of the surface of the ellipsoid (either inside o r * points within 5000 km of the surface of the ellipsoid (either inside o r
* outside the ellipsoid), the error is bounded by 7 nm for the WGS84 * outside the ellipsoid), the error is bounded by 7 nm for the WGS84
* ellipsoid. See \ref geocentric for further information on the errors. * ellipsoid. See \ref geocentric for further information on the errors.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT Geocentric { class GEOGRAPHIC_EXPORT Geocentric {
private: private:
typedef Math::real real; typedef Math::real real;
friend class LocalCartesian; friend class LocalCartesian;
friend class MagneticCircle; // MagneticCircle uses Rotation
friend class MagneticModel; // MagneticModel uses IntForward
static const size_t dim_ = 3; static const size_t dim_ = 3;
static const size_t dim2_ = dim_ * dim_; static const size_t dim2_ = dim_ * dim_;
real _a, _f, _e2, _e2m, _e2a, _e4a, _maxrad; real _a, _f, _e2, _e2m, _e2a, _e4a, _maxrad;
// Actually this can be static because it doesn't depend on the ellipso static void Rotation(real sphi, real cphi, real slam, real clam,
id. real M[dim2_]) throw();
// But let's be more general than that.
void Rotation(real sphi, real cphi, real slam, real clam,
real M[dim2_]) const throw();
void IntForward(real lat, real lon, real h, real& x, real& y, real& z, void IntForward(real lat, real lon, real h, real& x, real& y, real& z,
real M[dim2_]) const throw(); real M[dim2_]) const throw();
void IntReverse(real x, real y, real z, real& lat, real& lon, real& h, void IntReverse(real x, real y, real z, real& lat, real& lon, real& h,
real M[dim2_]) const throw(); real M[dim2_]) const throw();
public: public:
/** /**
* 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 > 1, set flatten ing * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten ing
* to 1/\e f. * to 1/\e f.
* *
 End of changes. 4 change blocks. 
6 lines changed or deleted 6 lines changed or added


 Geodesic.hpp   Geodesic.hpp 
/** /**
* \file Geodesic.hpp * \file Geodesic.hpp
* \brief Header for GeographicLib::Geodesic class * \brief Header for GeographicLib::Geodesic class
* *
* Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GEODESIC_HPP) #if !defined(GEOGRAPHICLIB_GEODESIC_HPP)
#define GEOGRAPHICLIB_GEODESIC_HPP "$Id: a4c92fd805c0be70dd88e77bb8508c1a62 bc7804 $" #define GEOGRAPHICLIB_GEODESIC_HPP "$Id: e8ec844ee6192e0fd4e0e4105664cc5362 a1660b $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#if !defined(GEOD_ORD) #if !defined(GEOD_ORD)
/** /**
* The order of the expansions used by Geodesic. * The order of the expansions used by Geodesic.
**********************************************************************/ **********************************************************************/
#define GEOD_ORD \ #define GEOD_ORD \
(GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7)) (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7))
#endif #endif
skipping to change at line 325 skipping to change at line 325
* @param[out] lon2 longitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees).
* @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] m12 reduced length of geodesic (meters). * @param[out] m12 reduced length of geodesic (meters).
* @param[out] M12 geodesic scale of point 2 relative to point 1 * @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless). * (dimensionless).
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless). * (dimensionless).
* @param[out] S12 area under the geodesic (meters<sup>2</sup>). * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
* @return \e a12 arc length of between point 1 and point 2 (degrees). * @return \e a12 arc length of between point 1 and point 2 (degrees).
* *
* \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should
be
* in the range [-180, 360]. The values of \e lon2 and \e azi2 returne
d
* are in the range [-180, 180).
*
* If either point is at a pole, the azimuth is defined by keeping the * If either point is at a pole, the azimuth is defined by keeping the
* longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
* taking the limit \e eps -> 0 from above. An arc length greater that 180 * taking the limit \e eps -> 0 from above. An arc length greater that 180
* degrees signifies a geodesic which is not a shortest path. (For a * degrees signifies a geodesic which is not a shortest path. (For a
* prolate ellipsoid, an additional condition is necessary for a shorte st * prolate ellipsoid, an additional condition is necessary for a shorte st
* path: the longitudinal extent must not exceed of 180 degrees.) * path: the longitudinal extent must not exceed of 180 degrees.)
* *
* The following functions are overloaded versions of Geodesic::Direct * The following functions are overloaded versions of Geodesic::Direct
* which omit some of the output parameters. Note, however, that the a rc * which omit some of the output parameters. Note, however, that the a rc
* length is always computed and returned as the function value. * length is always computed and returned as the function value.
skipping to change at line 434 skipping to change at line 438
* @param[out] lon2 longitude of point 2 (degrees). * @param[out] lon2 longitude of point 2 (degrees).
* @param[out] azi2 (forward) azimuth at point 2 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] s12 distance between point 1 and point 2 (meters).
* @param[out] m12 reduced length of geodesic (meters). * @param[out] m12 reduced length of geodesic (meters).
* @param[out] M12 geodesic scale of point 2 relative to point 1 * @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless). * (dimensionless).
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless). * (dimensionless).
* @param[out] S12 area under the geodesic (meters<sup>2</sup>). * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
* *
* \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should
be
* in the range [-180, 360]. The values of \e lon2 and \e azi2 returne
d
* are in the range [-180, 180).
*
* If either point is at a pole, the azimuth is defined by keeping the * If either point is at a pole, the azimuth is defined by keeping the
* longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
* taking the limit \e eps -> 0 from above. An arc length greater that 180 * taking the limit \e eps -> 0 from above. An arc length greater that 180
* degrees signifies a geodesic which is not a shortest path. (For a * degrees signifies a geodesic which is not a shortest path. (For a
* prolate ellipsoid, an additional condition is necessary for a shorte st * prolate ellipsoid, an additional condition is necessary for a shorte st
* path: the longitudinal extent must not exceed of 180 degrees.) * path: the longitudinal extent must not exceed of 180 degrees.)
* *
* The following functions are overloaded versions of Geodesic::Direct * The following functions are overloaded versions of Geodesic::Direct
* which omit some of the output parameters. * which omit some of the output parameters.
********************************************************************** / ********************************************************************** /
skipping to change at line 594 skipping to change at line 602
///@{ ///@{
/** /**
* Perform the inverse geodesic calculation. * Perform the inverse geodesic calculation.
* *
* @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 distance between point 1 and point 2 (meters). * @param[out] s12 distance between point 1 and point 2 (meters).
* @param[out] azi1 azimuth at point 1 (degrees). * @param[out] azi1 azimuth at point 1 (degrees).
* @param[out] azi2 (forward) azimuth at point 1 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] m12 reduced length of geodesic (meters). * @param[out] m12 reduced length of geodesic (meters).
* @param[out] M12 geodesic scale of point 2 relative to point 1 * @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless). * (dimensionless).
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless). * (dimensionless).
* @param[out] S12 area under the geodesic (meters<sup>2</sup>). * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
* @return \e a12 arc length of between point 1 and point 2 (degrees). * @return \e a12 arc length of between point 1 and point 2 (degrees).
* *
* \e lat1 and \e lat2 should be in the range [-90, 90]; \e lon1 and \e
* lon2 should be in the range [-180, 360]. The values of \e azi1 and
\e
* azi2 returned are in the range [-180, 180).
*
* If either point is at a pole, the azimuth is defined by keeping the * If either point is at a pole, the azimuth is defined by keeping the
* longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and
* taking the limit \e eps -> 0 from above. If the routine fails to * taking the limit \e eps -> 0 from above. If the routine fails to
* converge, then all the requested outputs are set to Math::NaN(). (T est * converge, then all the requested outputs are set to Math::NaN(). (T est
* for such results with Math::isnan.) This is not expected to happen with * for such results with Math::isnan.) This is not expected to happen with
* ellipsoidal models of the earth; please report all cases where this * ellipsoidal models of the earth; please report all cases where this
* occurs. * occurs.
* *
* The following functions are overloaded versions of Geodesic::Inverse * The following functions are overloaded versions of Geodesic::Inverse
* which omit some of the output parameters. Note, however, that the a rc * which omit some of the output parameters. Note, however, that the a rc
skipping to change at line 711 skipping to change at line 723
* in terms of this function. * in terms of this function.
* *
* @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[in] outmask a bitor'ed combination of Geodesic::mask values * @param[in] outmask a bitor'ed combination of Geodesic::mask values
* specifying which of the following parameters should be set. * specifying which of the following parameters should be set.
* @param[out] s12 distance between point 1 and point 2 (meters). * @param[out] s12 distance between point 1 and point 2 (meters).
* @param[out] azi1 azimuth at point 1 (degrees). * @param[out] azi1 azimuth at point 1 (degrees).
* @param[out] azi2 (forward) azimuth at point 1 (degrees). * @param[out] azi2 (forward) azimuth at point 2 (degrees).
* @param[out] m12 reduced length of geodesic (meters). * @param[out] m12 reduced length of geodesic (meters).
* @param[out] M12 geodesic scale of point 2 relative to point 1 * @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless). * (dimensionless).
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless). * (dimensionless).
* @param[out] S12 area under the geodesic (meters<sup>2</sup>). * @param[out] S12 area under the geodesic (meters<sup>2</sup>).
* @return \e a12 arc length of between point 1 and point 2 (degrees). * @return \e a12 arc length of between point 1 and point 2 (degrees).
* *
* The Geodesic::mask values possible for \e outmask are * The Geodesic::mask values possible for \e outmask are
* - \e outmask |= Geodesic::DISTANCE for the distance \e s12. * - \e outmask |= Geodesic::DISTANCE for the distance \e s12.
skipping to change at line 743 skipping to change at line 755
real& s12, real& azi1, real& azi2, real& s12, real& azi1, real& azi2,
real& m12, real& M12, real& M21, real& S12) real& m12, real& M12, real& M21, real& S12)
const throw(); const throw();
///@} ///@}
/** \name Interface to GeodesicLine. /** \name Interface to GeodesicLine.
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Set up to do a series of ranges. * Set up to compute several points on a singe geodesic.
* *
* @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] azi1 azimuth at point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees).
* @param[in] caps bitor'ed combination of Geodesic::mask values * @param[in] caps bitor'ed combination of Geodesic::mask values
* specifying the capabilities the GeodesicLine object should possess , * specifying the capabilities the GeodesicLine object should possess ,
* i.e., which quantities can be returned in calls to * i.e., which quantities can be returned in calls to
* GeodesicLib::Position. * GeodesicLib::Position.
* *
* \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should
be
* in the range [-180, 360].
*
* The Geodesic::mask values are * The Geodesic::mask values are
* - \e caps |= Geodesic::LATITUDE for the latitude \e lat2; this is * - \e caps |= Geodesic::LATITUDE for the latitude \e lat2; this is
* added automatically * added automatically
* - \e caps |= Geodesic::LONGITUDE for the latitude \e lon2 * - \e caps |= Geodesic::LONGITUDE for the latitude \e lon2
* - \e caps |= Geodesic::AZIMUTH for the latitude \e azi2; this is * - \e caps |= Geodesic::AZIMUTH for the latitude \e azi2; this is
* added automatically * added automatically
* - \e caps |= Geodesic::DISTANCE for the distance \e s12 * - \e caps |= Geodesic::DISTANCE for the distance \e s12
* - \e caps |= Geodesic::REDUCEDLENGTH for the reduced length \e m12 * - \e caps |= Geodesic::REDUCEDLENGTH for the reduced length \e m12
* - \e caps |= Geodesic::GEODESICSCALE for the geodesic scales \e M12 * - \e caps |= Geodesic::GEODESICSCALE for the geodesic scales \e M12
* and \e M21 * and \e M21
 End of changes. 8 change blocks. 
4 lines changed or deleted 25 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, 2010, 2011) <charles@karney.com> * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com>
* and licensed under the MIT/X11 License. For more information, see * and licensed 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 "$Id: d48cbce07611a1f8ca015a4d97eedc 83c8c3770a $" #define GEOGRAPHICLIB_GEODESICLINE_HPP "$Id: 24c298d5d343f35eaeeee27e3c65f2 2cae729faa $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief A geodesic line. * \brief A geodesic line.
* *
* GeodesicLine facilitates the determination of a series of points on a * GeodesicLine facilitates the determination of a series of points on a
skipping to change at line 199 skipping to change at line 199
* about the GeodesicLine. * about the GeodesicLine.
* *
* @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] azi1 azimuth at point 1 (degrees). * @param[in] azi1 azimuth at point 1 (degrees).
* @param[in] caps bitor'ed combination of GeodesicLine::mask values * @param[in] caps bitor'ed combination of GeodesicLine::mask values
* specifying the capabilities the GeodesicLine object should possess , * specifying the capabilities the GeodesicLine object should possess ,
* i.e., which quantities can be returned in calls to * i.e., which quantities can be returned in calls to
* GeodesicLib::Position. * GeodesicLib::Position.
* *
* \e lat1 should be in the range [-90, 90]; \e lon1 and \e azi1 should
be
* in the range [-180, 360].
*
* The GeodesicLine::mask values are * The GeodesicLine::mask values are
* - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this i s * - \e caps |= GeodesicLine::LATITUDE for the latitude \e lat2; this i s
* added automatically * added automatically
* - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2 * - \e caps |= GeodesicLine::LONGITUDE for the latitude \e lon2
* - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is * - \e caps |= GeodesicLine::AZIMUTH for the latitude \e azi2; this is
* added automatically * added automatically
* - \e caps |= GeodesicLine::DISTANCE for the distance \e s12 * - \e caps |= GeodesicLine::DISTANCE for the distance \e s12
* - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m 12 * - \e caps |= GeodesicLine::REDUCEDLENGTH for the reduced length \e m 12
* - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12 * - \e caps |= GeodesicLine::GEODESICSCALE for the geodesic scales \e M12
* and \e M21 * and \e M21
skipping to change at line 263 skipping to change at line 266
* (dimensionless); requires that the GeodesicLine object was constru cted * (dimensionless); requires that the GeodesicLine object was constru cted
* with \e caps |= GeodesicLine::GEODESICSCALE. * with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless); requires that the GeodesicLine object was constru cted * (dimensionless); requires that the GeodesicLine object was constru cted
* with \e caps |= GeodesicLine::GEODESICSCALE. * with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requir es * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requir es
* that the GeodesicLine object was constructed with \e caps |= * that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::AREA. * GeodesicLine::AREA.
* @return \e a12 arc length of between point 1 and point 2 (degrees). * @return \e a12 arc length of between point 1 and point 2 (degrees).
* *
* The values of \e lon2 and \e azi2 returned are in the range [-180, 1
80).
*
* The GeodesicLine object \e must have been constructed with \e caps | = * The GeodesicLine object \e must have been constructed with \e caps | =
* GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no * GeodesicLine::DISTANCE_IN; otherwise Math::NaN() is returned and no
* parameters are set. Requesting a value which the GeodesicLine objec t is * parameters are set. Requesting a value which the GeodesicLine objec t is
* not capable of computing is not an error; the corresponding argument * not capable of computing is not an error; the corresponding argument
* will not be altered. * will not be altered.
* *
* The following functions are overloaded versions of * The following functions are overloaded versions of
* GeodesicLine::Position which omit some of the output parameters. No te, * GeodesicLine::Position which omit some of the output parameters. No te,
* however, that the arc length is always computed and returned as the * however, that the arc length is always computed and returned as the
* function value. * function value.
skipping to change at line 378 skipping to change at line 383
* @param[out] M12 geodesic scale of point 2 relative to point 1 * @param[out] M12 geodesic scale of point 2 relative to point 1
* (dimensionless); requires that the GeodesicLine object was constru cted * (dimensionless); requires that the GeodesicLine object was constru cted
* with \e caps |= GeodesicLine::GEODESICSCALE. * with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] M21 geodesic scale of point 1 relative to point 2 * @param[out] M21 geodesic scale of point 1 relative to point 2
* (dimensionless); requires that the GeodesicLine object was constru cted * (dimensionless); requires that the GeodesicLine object was constru cted
* with \e caps |= GeodesicLine::GEODESICSCALE. * with \e caps |= GeodesicLine::GEODESICSCALE.
* @param[out] S12 area under the geodesic (meters<sup>2</sup>); requir es * @param[out] S12 area under the geodesic (meters<sup>2</sup>); requir es
* that the GeodesicLine object was constructed with \e caps |= * that the GeodesicLine object was constructed with \e caps |=
* GeodesicLine::AREA. * GeodesicLine::AREA.
* *
* The values of \e lon2 and \e azi2 returned are in the range [-180, 1
80).
*
* 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. * altered.
* *
* The following functions are overloaded versions of * The following functions are overloaded versions of
* GeodesicLine::ArcPosition which omit some of the output parameters. * GeodesicLine::ArcPosition which omit some of the output parameters.
********************************************************************** / ********************************************************************** /
void ArcPosition(real a12, real& lat2, real& lon2, real& azi2, void ArcPosition(real a12, 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 throw() { real& S12) const throw() {
 End of changes. 4 change blocks. 
1 lines changed or deleted 11 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, 2010, 2011) <charles@karney.com> * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com>
* and licensed under the MIT/X11 License. For more information, see * and licensed 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 "$Id: 57b427018406a7397153845cb919865d62263 020 $" #define GEOGRAPHICLIB_GEOID_HPP "$Id: ea21a7ef2bf421621967b0c442da427106c8d 6c2 $"
#include <string> #include <string>
#include <vector> #include <vector>
#include <fstream> #include <fstream>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Squelch warnings about dll vs vector // Squelch warnings about dll vs vector
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4251) #pragma warning (disable: 4251)
skipping to change at line 172 skipping to change at line 172
* The multiplier for converting from heights above the ellipsoid to * The multiplier for converting from heights above the ellipsoid to
* heights above the geoid. * heights above the geoid.
******************************************************************** **/ ******************************************************************** **/
GEOIDTOELLIPSOID = 1, GEOIDTOELLIPSOID = 1,
}; };
/** \name Setting up the geoid /** \name Setting up the geoid
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Construct a Geoid. * Construct a geoid.
* *
* @param[in] name the name of the geoid. * @param[in] name the name of the geoid.
* @param[in] path (optional) directory for data file. * @param[in] path (optional) directory for data file.
* @param[in] cubic (optional) interpolation method; false means biline ar, * @param[in] cubic (optional) interpolation method; false means biline ar,
* true (the default) means cubic. * true (the default) means cubic.
* @param[in] threadsafe (optional), if true, construct a thread safe * @param[in] threadsafe (optional), if true, construct a thread safe
* object. The default is false * object. The default is false
* *
* The data file is formed by appending ".pgm" to the name. If \e path is * The data file is formed by appending ".pgm" to the name. If \e path is
* specified (and is non-empty), then the file is loaded from directory , \e * specified (and is non-empty), then the file is loaded from directory , \e
* path. Otherwise the path is given by the GEOID_PATH environment * path. Otherwise the path is given by the GEOID_PATH environment
* variable. If that is undefined, a compile-time default path is used * variable. If that is undefined, a compile-time default path is used
* (/usr/local/share/GeographicLib/geoids on non-Windows systems and * (/usr/local/share/GeographicLib/geoids on non-Windows systems and
* C:/cygwin/usr/local/share/GeographicLib/geoids on Windows systems). * C:/Documents and Settings/All Users/Application
* This may throw an exception because the file does not exist, is * Data/GeographicLib/geoids on Windows systems). This may throw an
* unreadable, or is corrupt. If the \e threadsafe parameter is true, * exception because the file does not exist, is unreadable, or is corr
the upt.
* data set is read into memory (which this may also cause an exception * If the \e threadsafe parameter is true, the data set is read into me
to mory
* be thrown), the data file is closed, and single-cell caching is turn * (which this may also cause an exception to be thrown), the data file
ed is
* off; this results in a Geoid object which \e is thread safe. * closed, and single-cell caching is turned off; this results in a Geo
id
* object which \e is thread safe.
********************************************************************** / ********************************************************************** /
explicit Geoid(const std::string& name, const std::string& path = "", explicit Geoid(const std::string& name, const std::string& path = "",
bool cubic = true, bool threadsafe = false); bool cubic = true, bool threadsafe = false);
/** /**
* Set up a cache. * Set up a cache.
* *
* @param[in] south latitude (degrees) of the south edge of the cached area. * @param[in] south latitude (degrees) of the south edge of the cached area.
* @param[in] west longitude (degrees) of the west edge of the cached a rea. * @param[in] west longitude (degrees) of the west edge of the cached a rea.
* @param[in] north latitude (degrees) of the north edge of the cached area. * @param[in] north latitude (degrees) of the north edge of the cached area.
 End of changes. 3 change blocks. 
11 lines changed or deleted 13 lines changed or added


 LocalCartesian.hpp   LocalCartesian.hpp 
/** /**
* \file LocalCartesian.hpp * \file LocalCartesian.hpp
* \brief Header for GeographicLib::LocalCartesian class * \brief Header for GeographicLib::LocalCartesian class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP)
#define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: 6504c3f72ff159d17ddbd6e5bb48 3f0945438b9a $" #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: 66ad3a5333b92c5ff6f373080e62 c5392841afd3 $"
#include <GeographicLib/Geocentric.hpp> #include <GeographicLib/Geocentric.hpp>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Local Cartesian coordinates * \brief Local Cartesian coordinates
* *
* Convert between geodetic coordinates latitude = \e lat, longitude = \e * Convert between geodetic coordinates latitude = \e lat, longitude = \e
skipping to change at line 219 skipping to change at line 219
* @return \e a the equatorial radius of the ellipsoid (meters). This is * @return \e a the equatorial radius of the ellipsoid (meters). This is
* the value of \e a inherited from the Geocentric object used in the * the value of \e a inherited from the Geocentric object used in the
* constructor. * constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
/** /**
* @return \e f the flattening of the ellipsoid. This is the value * @return \e f the flattening of the ellipsoid. This is the value
* inherited from the Geocentric object used in the constructor. * inherited from the Geocentric object used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real Flattening() const throw() Math::real Flattening() const throw() { return _earth.Flattening(); }
{ return _earth.Flattening(); }
/** /**
* <b>DEPRECATED</b> * <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid. * @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() Math::real InverseFlattening() const throw()
{ return _earth.InverseFlattening(); } { return _earth.InverseFlattening(); }
///@} ///@}
}; };
 End of changes. 2 change blocks. 
3 lines changed or deleted 2 lines changed or added


 MGRS.hpp   MGRS.hpp 
/** /**
* \file MGRS.hpp * \file MGRS.hpp
* \brief Header for GeographicLib::MGRS class * \brief Header for GeographicLib::MGRS class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_MGRS_HPP) #if !defined(GEOGRAPHICLIB_MGRS_HPP)
#define GEOGRAPHICLIB_MGRS_HPP "$Id: b9b6a35bcdd5b270cdc3088be87e422efc9b30 53 $" #define GEOGRAPHICLIB_MGRS_HPP "$Id: b15aa92f13463a8432dc6ff095cbb2650eb4a9 a2 $"
#include <sstream> #include <sstream>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/UTMUPS.hpp> #include <GeographicLib/UTMUPS.hpp>
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Squelch warnings about dll vs string // Squelch warnings about dll vs string
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4251) #pragma warning (disable: 4251)
#endif #endif
skipping to change at line 92 skipping to change at line 92
// Top-level tiles are 10^5 m = 100 km on a side // Top-level tiles are 10^5 m = 100 km on a side
tilelevel_ = 5, tilelevel_ = 5,
// Period of UTM row letters // Period of UTM row letters
utmrowperiod_ = 20, utmrowperiod_ = 20,
// Row letters are shifted by 5 for even zones // Row letters are shifted by 5 for even zones
utmevenrowshift_ = 5, utmevenrowshift_ = 5,
// Maximum precision is um // Maximum precision is um
maxprec_ = 5 + 6, maxprec_ = 5 + 6,
}; };
static void CheckCoords(bool utmp, bool& northp, real& x, real& y); static void CheckCoords(bool utmp, bool& northp, real& x, real& y);
static int lookup(const std::string& s, char c) throw() {
std::string::size_type r = s.find(toupper(c));
return r == std::string::npos ? -1 : int(r);
}
template<typename T> static std::string str(T x) {
std::ostringstream s; s << x; return s.str();
}
static int UTMRow(int iband, int icol, int irow) throw(); static int UTMRow(int iband, int icol, int irow) throw();
friend class UTMUPS; // UTMUPS::StandardZone calls LatitudeBand friend class UTMUPS; // UTMUPS::StandardZone calls LatitudeBand
// Return latitude band number [-10, 10) for the give latitude (degrees ). // Return latitude band number [-10, 10) for the give latitude (degrees ).
// The bands are reckoned in include their southern edges. // The bands are reckoned in include their southern edges.
static int LatitudeBand(real lat) throw() { static int LatitudeBand(real lat) throw() {
int ilat = int(std::floor(lat)); int ilat = int(std::floor(lat));
return (std::max)(-10, (std::min)(9, (ilat + 80)/8 - 10)); return (std::max)(-10, (std::min)(9, (ilat + 80)/8 - 10));
} }
// UTMUPS access these enums // UTMUPS access these enums
 End of changes. 2 change blocks. 
8 lines changed or deleted 1 lines changed or added


 Math.hpp   Math.hpp 
skipping to change at line 15 skipping to change at line 15
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
// Constants.hpp includes Math.hpp. Place this include outside Math.hpp's // Constants.hpp includes Math.hpp. Place this include outside Math.hpp's
// include guard to enforce this ordering. // include guard to enforce this ordering.
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#if !defined(GEOGRAPHICLIB_MATH_HPP) #if !defined(GEOGRAPHICLIB_MATH_HPP)
#define GEOGRAPHICLIB_MATH_HPP "$Id: 30d442ca2b676500169652c4157fd2c263a19d 6c $" #define GEOGRAPHICLIB_MATH_HPP "$Id: dd6afb3ee17e4c12342f7691e714c5f6dc78f0 12 $"
/** /**
* Are C++0X math functions available? * Are C++0X math functions available?
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH) #if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH)
# if defined(__GXX_EXPERIMENTAL_CXX0X__) # if defined(__GXX_EXPERIMENTAL_CXX0X__)
# define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1 # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1
# else # else
# define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 0 # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 0
# endif # endif
#endif #endif
#if !defined(WORDS_BIGENDIAN)
# define WORDS_BIGENDIAN 0
#endif
#if !defined(GEOGRAPHICLIB_PREC) #if !defined(GEOGRAPHICLIB_PREC)
/** /**
* The precision of floating point numbers used in %GeographicLib. 0 means * The precision of floating point numbers used in %GeographicLib. 0 means
* float; 1 (default) means double; 2 means long double. Nearly all the * float; 1 (default) means double; 2 means long double. Nearly all the
* testing has been carried out with doubles and that's the recommended * testing has been carried out with doubles and that's the recommended
* configuration. In order for long double to be used, HAVE_LONG_DOUBLE ne eds * configuration. In order for long double to be used, HAVE_LONG_DOUBLE ne eds
* to be defined. Note that with Microsoft Visual Studio, long double is t he * to be defined. Note that with Microsoft Visual Studio, long double is t he
* same as double. * same as double.
**********************************************************************/ **********************************************************************/
#define GEOGRAPHICLIB_PREC 1 #define GEOGRAPHICLIB_PREC 1
#endif #endif
#include <cmath> #include <cmath>
#include <limits> #include <limits>
#include <algorithm> #include <algorithm>
#include <vector>
/** /**
* \brief Namespace for %GeographicLib * \brief Namespace for %GeographicLib
* *
* All of %GeographicLib is defined within the GeographicLib namespace. In * All of %GeographicLib is defined within the GeographicLib namespace. In
* addtion all the header files are included via %GeographicLib/filename. This * addtion all the header files are included via %GeographicLib/filename. This
* minimizes the likelihood of conflicts with other packages. * minimizes the likelihood of conflicts with other packages.
**********************************************************************/ **********************************************************************/
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Mathematical functions needed by %GeographicLib * \brief Mathematical functions needed by %GeographicLib
* *
* Define mathematical functions in order to localize system dependencies and * Define mathematical functions in order to localize system dependencies and
* to provide generic versions of the functions. In addition define a re al * to provide generic versions of the functions. In addition define a re al
* type to be used by %GeographicLib. * type to be used by %GeographicLib.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT Math { class GEOGRAPHIC_EXPORT Math {
private: private:
void dummy() { void dummy() {
STATIC_ASSERT((GEOGRAPHICLIB_PREC) >= 0 && (GEOGRAPHICLIB_PREC) <= 2, STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2,
"Bad value of precision"); "Bad value of precision");
} }
Math(); // Disable constructor Math(); // Disable constructor
public: public:
#if defined(HAVE_LONG_DOUBLE) #if defined(HAVE_LONG_DOUBLE)
/** /**
* The extended precision type for real numbers, used for some testing. * The extended precision type for real numbers, used for some testing.
* This is long double on computers with this type; otherwise it is dou ble. * This is long double on computers with this type; otherwise it is dou ble.
********************************************************************** / ********************************************************************** /
typedef long double extended; typedef long double extended;
#else #else
typedef double extended; typedef double extended;
#endif #endif
#if GEOGRAPHICLIB_PREC == 1 #if GEOGRAPHICLIB_PREC == 1
/** /**
* The real type for %GeographicLib. Nearly all the testing has been do ne * The real type for %GeographicLib. Nearly all the testing has been do ne
* with \e real = double. However, the algorithms should also work wit h * with \e real = double. However, the algorithms should also work wit h
* float and long double (where available). * float and long double (where available). (<b>CAUTION</b>: reasonabl
e
* accuracy typically cannot be obtained using floats.)
********************************************************************** / ********************************************************************** /
typedef double real; typedef double real;
#elif GEOGRAPHICLIB_PREC == 0 #elif GEOGRAPHICLIB_PREC == 0
typedef float real; typedef float real;
#elif GEOGRAPHICLIB_PREC == 2 #elif GEOGRAPHICLIB_PREC == 2
typedef extended real; typedef extended real;
#else #else
typedef double real; typedef double real;
#endif #endif
/** /**
* true if the machine is big-endian
**********************************************************************
/
static const bool bigendian = WORDS_BIGENDIAN;
/**
* @tparam T the type of the returned value.
* @return \e pi. * @return \e pi.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T pi() throw() { return std::atan2(T(0), -T(1)); } static inline T pi() throw() { return std::atan2(T(0), -T(1)); }
/** /**
* A synonym for pi<real>(). * A synonym for pi<real>().
********************************************************************** / ********************************************************************** /
static inline real pi() throw() { return pi<real>(); } static inline real pi() throw() { return pi<real>(); }
/** /**
* @tparam T the type of the returned value.
* @return the number of radians in a degree. * @return the number of radians in a degree.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T degree() throw() { return pi<T>() / T(180); } static inline T degree() throw() { return pi<T>() / T(180); }
/** /**
* A synonym for degree<real>(). * A synonym for degree<real>().
********************************************************************** / ********************************************************************** /
static inline real degree() throw() { return degree<real>(); } static inline real degree() throw() { return degree<real>(); }
/** /**
* Square a number. * Square a number.
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return \e x<sup>2</sup>. * @return \e x<sup>2</sup>.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T sq(T x) throw() { return x * x; } static inline T sq(T x) throw() { return x * x; }
#if defined(DOXYGEN) #if defined(DOXYGEN)
/** /**
* The hypotenuse function avoiding underflow and overflow. * The hypotenuse function avoiding underflow and overflow.
* *
* @tparam T the type of the arguments and the returned value.
* @param[in] x * @param[in] x
* @param[in] y * @param[in] y
* @return sqrt(\e x<sup>2</sup> + \e y<sup>2</sup>). * @return sqrt(\e x<sup>2</sup> + \e y<sup>2</sup>).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T hypot(T x, T y) throw() { static inline T hypot(T x, T y) throw() {
x = std::abs(x); x = std::abs(x);
y = std::abs(y); y = std::abs(y);
T a = (std::max)(x, y), T a = (std::max)(x, y),
b = (std::min)(x, y) / (a ? a : 1); b = (std::min)(x, y) / (a ? a : 1);
skipping to change at line 174 skipping to change at line 190
{ return ::hypotl(x, y); } { return ::hypotl(x, y); }
#endif #endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
/** /**
* exp(\e x) - 1 accurate near \e x = 0. This is taken from * exp(\e x) - 1 accurate near \e x = 0. This is taken from
* N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd * N. J. Higham, Accuracy and Stability of Numerical Algorithms, 2nd
* Edition (SIAM, 2002), Sec 1.14.1, p 19. * Edition (SIAM, 2002), Sec 1.14.1, p 19.
* *
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return exp(\e x) - 1. * @return exp(\e x) - 1.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T expm1(T x) throw() { static inline T expm1(T x) throw() {
volatile T volatile T
y = std::exp(x), y = std::exp(x),
z = y - 1; z = y - 1;
// The reasoning here is similar to that for log1p. The expression // The reasoning here is similar to that for log1p. The expression
// mathematically reduces to exp(x) - 1, and the factor z/log(y) = (y - // mathematically reduces to exp(x) - 1, and the factor z/log(y) = (y -
skipping to change at line 209 skipping to change at line 226
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
/** /**
* log(1 + \e x) accurate near \e x = 0. * log(1 + \e x) accurate near \e x = 0.
* *
* This is taken from D. Goldberg, * This is taken from D. Goldberg,
* <a href="http://dx.doi.org/10.1145/103162.103163">What every compute r * <a href="http://dx.doi.org/10.1145/103162.103163">What every compute r
* scientist should know about floating-point arithmetic</a> (1991), * scientist should know about floating-point arithmetic</a> (1991),
* Theorem 4. See also, Higham (op. cit.), Answer to Problem 1.5, p 52 8. * Theorem 4. See also, Higham (op. cit.), Answer to Problem 1.5, p 52 8.
* *
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return log(1 + \e x). * @return log(1 + \e x).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T log1p(T x) throw() { static inline T log1p(T x) throw() {
volatile T volatile T
y = 1 + x, y = 1 + x,
z = y - 1; z = y - 1;
// Here's the explanation for this magic: y = 1 + z, exactly, and z // Here's the explanation for this magic: y = 1 + z, exactly, and z
// approx x, thus log(y)/z (which is nearly constant near z = 0) retu rns // approx x, thus log(y)/z (which is nearly constant near z = 0) retu rns
skipping to change at line 241 skipping to change at line 259
{ return ::log1pl(x); } { return ::log1pl(x); }
#endif #endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
/** /**
* The inverse hyperbolic sine function. This is defined in terms of * The inverse hyperbolic sine function. This is defined in terms of
* Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In
* addition, the odd parity of the function is enforced. * addition, the odd parity of the function is enforced.
* *
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return asinh(\e x). * @return asinh(\e x).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T asinh(T x) throw() { static inline T asinh(T x) throw() {
T y = std::abs(x); // Enforce odd parity T y = std::abs(x); // Enforce odd parity
y = log1p(y * (1 + y/(hypot(T(1), y) + 1))); y = log1p(y * (1 + y/(hypot(T(1), y) + 1)));
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH #elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH
skipping to change at line 268 skipping to change at line 287
{ return ::asinhl(x); } { return ::asinhl(x); }
#endif #endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
/** /**
* The inverse hyperbolic tangent function. This is defined in terms o f * The inverse hyperbolic tangent function. This is defined in terms o f
* Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In * Math::log1p(\e x) in order to maintain accuracy near \e x = 0. In
* addition, the odd parity of the function is enforced. * addition, the odd parity of the function is enforced.
* *
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return atanh(\e x). * @return atanh(\e x).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T atanh(T x) throw() { static inline T atanh(T x) throw() {
T y = std::abs(x); // Enforce odd parity T y = std::abs(x); // Enforce odd parity
y = log1p(2 * y/(1 - y))/2; y = log1p(2 * y/(1 - y))/2;
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH #elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH
skipping to change at line 293 skipping to change at line 313
#if defined(HAVE_LONG_DOUBLE) #if defined(HAVE_LONG_DOUBLE)
static inline long double atanh(long double x) throw() static inline long double atanh(long double x) throw()
{ return ::atanhl(x); } { return ::atanhl(x); }
#endif #endif
#endif #endif
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
/** /**
* The cube root function. * The cube root function.
* *
* @tparam T the type of the argument and the returned value.
* @param[in] x * @param[in] x
* @return the real cube root of \e x. * @return the real cube root of \e x.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T cbrt(T x) throw() { static inline T cbrt(T x) throw() {
T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root T y = std::pow(std::abs(x), 1/T(3)); // Return the real cube root
return x < 0 ? -y : y; return x < 0 ? -y : y;
} }
#elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH #elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH
template<typename T> template<typename T>
skipping to change at line 315 skipping to change at line 336
static inline double cbrt(double x) throw() { return ::cbrt(x); } static inline double cbrt(double x) throw() { return ::cbrt(x); }
static inline float cbrt(float x) throw() { return ::cbrtf(x); } static inline float cbrt(float x) throw() { return ::cbrtf(x); }
#if defined(HAVE_LONG_DOUBLE) #if defined(HAVE_LONG_DOUBLE)
static inline long double cbrt(long double x) throw() { return ::cbrtl( x); } static inline long double cbrt(long double x) throw() { return ::cbrtl( x); }
#endif #endif
#endif #endif
/** /**
* Test for finiteness. * Test for finiteness.
* *
* @tparam T the type of the argument.
* @param[in] x * @param[in] x
* @return true if number is finite, false if NaN or infinite. * @return true if number is finite, false if NaN or infinite.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline bool isfinite(T x) throw() { static inline bool isfinite(T x) throw() {
#if defined(DOXYGEN) #if defined(DOXYGEN)
return std::abs(x) <= (std::numeric_limits<T>::max)(); return std::abs(x) <= (std::numeric_limits<T>::max)();
#elif (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MATH) #elif (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MATH)
return _finite(x) != 0; return _finite(x) != 0;
#else #else
return std::isfinite(x); return std::isfinite(x);
#endif #endif
} }
/** /**
* The NaN (not a number) * The NaN (not a number)
* *
* @tparam T the type of the returned value.
* @return NaN if available, otherwise return the max real. * @return NaN if available, otherwise return the max real.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T NaN() throw() { static inline T NaN() throw() {
return std::numeric_limits<T>::has_quiet_NaN ? return std::numeric_limits<T>::has_quiet_NaN ?
std::numeric_limits<T>::quiet_NaN() : std::numeric_limits<T>::quiet_NaN() :
(std::numeric_limits<T>::max)(); (std::numeric_limits<T>::max)();
} }
/** /**
* A synonym for NaN<real>(). * A synonym for NaN<real>().
********************************************************************** / ********************************************************************** /
static inline real NaN() throw() { return NaN<real>(); } static inline real NaN() throw() { return NaN<real>(); }
/** /**
* Test for NaN. * Test for NaN.
* *
* @tparam T the type of the argument.
* @param[in] x * @param[in] x
* @return true if argument is a NaN. * @return true if argument is a NaN.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline bool isnan(T x) throw() { static inline bool isnan(T x) throw() {
#if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH) #if defined(DOXYGEN) || (defined(_MSC_VER) && !GEOGRAPHICLIB_CPLUSPLUS0X_MA TH)
return x != x; return x != x;
#else #else
return std::isnan(x); return std::isnan(x);
#endif #endif
} }
/** /**
* Infinity * Infinity
* *
* @tparam T the type of the returned value.
* @return infinity if available, otherwise return the max real. * @return infinity if available, otherwise return the max real.
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T infinity() throw() { static inline T infinity() throw() {
return std::numeric_limits<T>::has_infinity ? return std::numeric_limits<T>::has_infinity ?
std::numeric_limits<T>::infinity() : std::numeric_limits<T>::infinity() :
(std::numeric_limits<T>::max)(); (std::numeric_limits<T>::max)();
} }
/** /**
* A synonym for infinity<real>(). * A synonym for infinity<real>().
********************************************************************** / ********************************************************************** /
static inline real infinity() throw() { return infinity<real>(); } static inline real infinity() throw() { return infinity<real>(); }
/**
* Swap the bytes of a quantity
*
* @tparam T the type of the argument and the returned value.
* @param[in] x
* @return x with its bytes swapped.
**********************************************************************
/
template<typename T> static inline T swab(T x) {
union {
T r;
unsigned char c[sizeof(T)];
} b;
b.r = x;
for (int i = sizeof(T)/2; i--; )
std::swap(b.c[i], b.c[sizeof(T) - 1 - i]);
return b.r;
}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_MATH_HPP #endif // GEOGRAPHICLIB_MATH_HPP
 End of changes. 19 change blocks. 
3 lines changed or deleted 49 lines changed or added


 OSGB.hpp   OSGB.hpp 
/** /**
* \file OSGB.hpp * \file OSGB.hpp
* \brief Header for GeographicLib::OSGB class * \brief Header for GeographicLib::OSGB class
* *
* Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen sed * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen sed
* 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_OSGB_HPP) #if !defined(GEOGRAPHICLIB_OSGB_HPP)
#define GEOGRAPHICLIB_OSGB_HPP "$Id: 3684ee43efad2de6271c94f210458913345a10 87 $" #define GEOGRAPHICLIB_OSGB_HPP "$Id: 62fc66a3aeb0c2ac3e65b3de36063530995014 20 $"
#include <string> #include <string>
#include <sstream> #include <sstream>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/TransverseMercator.hpp> #include <GeographicLib/TransverseMercator.hpp>
#if defined(_MSC_VER) #if defined(_MSC_VER)
// Squelch warnings about dll vs string // Squelch warnings about dll vs string
#pragma warning (push) #pragma warning (push)
#pragma warning (disable: 4251) #pragma warning (disable: 4251)
skipping to change at line 66 skipping to change at line 66
tileoffy_ = 1 * tilegrid_, tileoffy_ = 1 * tilegrid_,
minx_ = - tileoffx_ * tile_, minx_ = - tileoffx_ * tile_,
miny_ = - tileoffy_ * tile_, miny_ = - tileoffy_ * tile_,
maxx_ = (tilegrid_*tilegrid_ - tileoffx_) * tile_, maxx_ = (tilegrid_*tilegrid_ - tileoffx_) * tile_,
maxy_ = (tilegrid_*tilegrid_ - tileoffy_) * tile_, maxy_ = (tilegrid_*tilegrid_ - tileoffy_) * tile_,
// Maximum precision is um // Maximum precision is um
maxprec_ = 5 + 6, maxprec_ = 5 + 6,
}; };
static real computenorthoffset() throw(); static real computenorthoffset() throw();
static void CheckCoords(real x, real y); static void CheckCoords(real x, real y);
static int lookup(const std::string& s, char c) throw() {
std::string::size_type r = s.find(toupper(c));
return r == std::string::npos ? -1 : int(r);
}
template<typename T> static std::string str(T x) {
std::ostringstream s; s << x; return s.str();
}
OSGB(); // Disable constructor OSGB(); // Disable constructor
public: public:
/** /**
* Forward projection, from geographic to OSGB coordinates. * Forward projection, from geographic to OSGB coordinates.
* *
* @param[in] lat latitude of point (degrees). * @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees). * @param[in] lon longitude of point (degrees).
* @param[out] x easting of point (meters). * @param[out] x easting of point (meters).
 End of changes. 2 change blocks. 
8 lines changed or deleted 1 lines changed or added


 UTMUPS.hpp   UTMUPS.hpp 
/** /**
* \file UTMUPS.hpp * \file UTMUPS.hpp
* \brief Header for GeographicLib::UTMUPS class * \brief Header for GeographicLib::UTMUPS class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the MIT/X11 License. For more information, see * and licensed under the MIT/X11 License. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_UTMUPS_HPP) #if !defined(GEOGRAPHICLIB_UTMUPS_HPP)
#define GEOGRAPHICLIB_UTMUPS_HPP "$Id: 5d3bb175628985fddad7d67a028bffc0f049 f515 $" #define GEOGRAPHICLIB_UTMUPS_HPP "$Id: 7973c2fa261a964b7ccdccd2057a08612c1d 4cd5 $"
#include <sstream> #include <sstream>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Convert between Geographic coordinates and UTM/UPS * \brief Convert between Geographic coordinates and UTM/UPS
* *
* UTM and UPS are defined * UTM and UPS are defined
skipping to change at line 70 skipping to change at line 70
private: private:
typedef Math::real real; typedef Math::real real;
static const real falseeasting_[4]; static const real falseeasting_[4];
static const real falsenorthing_[4]; static const real falsenorthing_[4];
static const real mineasting_[4]; static const real mineasting_[4];
static const real maxeasting_[4]; static const real maxeasting_[4];
static const real minnorthing_[4]; static const real minnorthing_[4];
static const real maxnorthing_[4]; static const real maxnorthing_[4];
static real CentralMeridian(int zone) throw() static real CentralMeridian(int zone) throw()
{ return real(6 * zone - 183); } { return real(6 * zone - 183); }
template<typename T> static std::string str(T x) {
std::ostringstream s; s << x; return s.str();
}
static void CheckLatLon(real lat, real lon); static void CheckLatLon(real lat, real lon);
// Throw an error if easting or northing are outside standard ranges. If // Throw an error if easting or northing are outside standard ranges. If
// throwp = false, return bool instead. // throwp = false, return bool instead.
static bool CheckCoords(bool utmp, bool northp, real x, real y, static bool CheckCoords(bool utmp, bool northp, real x, real y,
bool msgrlimits = false, bool throwp = true); bool msgrlimits = false, bool throwp = true);
UTMUPS(); // Disable constructor UTMUPS(); // Disable constructor
public: public:
/** /**
skipping to change at line 151 skipping to change at line 148
* The largest physical zone number. * The largest physical zone number.
******************************************************************** **/ ******************************************************************** **/
MAXZONE = 60, MAXZONE = 60,
}; };
/** /**
* The standard zone. * The standard zone.
* *
* @param[in] lat latitude (degrees). * @param[in] lat latitude (degrees).
* @param[in] lon longitude (degrees). * @param[in] lon longitude (degrees).
* @param[in] setzone zone override (optional) * @param[in] setzone zone override (optional).
* *
* This is exact. If the optional argument \e setzone is given then us e * This is exact. If the optional argument \e setzone is given then us e
* that zone if it is non-negative, otherwise apply the rules given in * that zone if it is non-negative, otherwise apply the rules given in
* UTMUPS::zonespec. Throws an error if \e setzone is outsize the rang e * UTMUPS::zonespec. Throws an error if \e setzone is outsize the rang e
* [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [-4, 60]. * [UTMUPS::MINPSEUDOZONE, UTMUPS::MAXZONE] = [-4, 60].
********************************************************************** / ********************************************************************** /
static int StandardZone(real lat, real lon, int setzone = STANDARD); static int StandardZone(real lat, real lon, int setzone = STANDARD);
/** /**
* Forward projection, from geographic to UTM/UPS. * Forward projection, from geographic to UTM/UPS.
* *
* @param[in] lat latitude of point (degrees). * @param[in] lat latitude of point (degrees).
* @param[in] lon longitude of point (degrees). * @param[in] lon longitude of point (degrees).
* @param[out] zone the UTM zone (zero means UPS). * @param[out] zone the UTM zone (zero means UPS).
* @param[out] northp hemisphere (true means north, false means south). * @param[out] northp hemisphere (true means north, false means south).
* @param[out] x easting of point (meters). * @param[out] x easting of point (meters).
* @param[out] y northing of point (meters). * @param[out] y northing of point (meters).
* @param[out] gamma meridian convergence at point (degrees). * @param[out] gamma meridian convergence at point (degrees).
* @param[out] k scale of projection at point. * @param[out] k scale of projection at point.
* @param[in] setzone zone override. * @param[in] setzone zone override.
* @param[in] mgrslimits if true enforce the stricted MGRS limits on th e * @param[in] mgrslimits if true enforce the stricter MGRS limits on th e
* coordinates (default = false). * coordinates (default = false).
* *
* The prefered zone for the result can be specified with \e setzone, s ee * The prefered zone for the result can be specified with \e setzone, s ee
* UTMUPS::StandardZone. Throw error if the resulting easting or north ing * UTMUPS::StandardZone. Throw error if the resulting easting or north ing
* is outside the allowed range (see Reverse), in which case the argume nts * is outside the allowed range (see Reverse), in which case the argume nts
* are unchanged. This also returns meridian convergence \e gamma * are unchanged. This also returns meridian convergence \e gamma
* (degrees) and scale \e k. The accuracy of the conversion is about 5 nm. * (degrees) and scale \e k. The accuracy of the conversion is about 5 nm.
********************************************************************** / ********************************************************************** /
static void Forward(real lat, real lon, static void Forward(real lat, real lon,
int& zone, bool& northp, real& x, real& y, int& zone, bool& northp, real& x, real& y,
 End of changes. 4 change blocks. 
6 lines changed or deleted 3 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/