AlbersEqualArea.hpp   AlbersEqualArea.hpp 
/** /**
* \file AlbersEqualArea.hpp * \file AlbersEqualArea.hpp
* \brief Header for GeographicLib::AlbersEqualArea class * \brief Header for GeographicLib::AlbersEqualArea 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 LGPL. For more information, see * under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP)
#define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP "$Id: 76631a35cadd11d3dcbfd2b2951 bd1528b8ae63b $" #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP "$Id: 62d2975148c072f824730134ca6 b1cbc659250f0 $"
#include <algorithm> #include <algorithm>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Albers Equal Area Conic Projection * \brief Albers Equal Area Conic Projection
* *
* Implementation taken from the report, * Implementation taken from the report,
skipping to change at line 57 skipping to change at line 57
* aligned with the cardinal directions is projected to a rectangle with * aligned with the cardinal directions is projected to a rectangle with
* dimensions \e k (in the E-W direction) and 1/\e k (in the N-S directio n). * dimensions \e k (in the E-W direction) and 1/\e k (in the N-S directio n).
* The E-W sides of the rectangle are oriented \e gamma degrees * The E-W sides of the rectangle are oriented \e gamma degrees
* counter-clockwise from the \e x axis. There is no provision in this c lass * counter-clockwise from the \e x axis. There is no provision in this c lass
* for specifying a false easting or false northing or a different latitu de * for specifying a false easting or false northing or a different latitu de
* of origin. * of origin.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT AlbersEqualArea { class GEOGRAPHIC_EXPORT AlbersEqualArea {
private: private:
typedef Math::real real; typedef Math::real real;
const real _a, _r, _f, _fm, _e2, _e, _e2m, _qZ, _qx; const real _a, _f, _r, _fm, _e2, _e, _e2m, _qZ, _qx;
real _sign, _lat0, _k0; real _sign, _lat0, _k0;
real _n0, _m02, _nrho0, _k2, _txi0, _scxi0, _sxi0; real _n0, _m02, _nrho0, _k2, _txi0, _scxi0, _sxi0;
static const real eps_; static const real eps_;
static const real epsx_; static const real epsx_;
static const real epsx2_; static const real epsx2_;
static const real tol_; static const real tol_;
static const real tol0_; static const real tol0_;
static const real ahypover_; static const real ahypover_;
static const int numit_ = 5; // Newton iterations in Reverse static const int numit_ = 5; // Newton iterations in Reverse
static const int numit0_ = 20; // Newton iterations in Init static const int numit0_ = 20; // Newton iterations in Init
skipping to change at line 115 skipping to change at line 115
real DDatanhee(real x, real y) const throw(); real DDatanhee(real x, real y) const throw();
void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) thro w(); void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) thro w();
real txif(real tphi) const throw(); real txif(real tphi) const throw();
real tphif(real txi) const throw(); real tphif(real txi) const throw();
public: public:
/** /**
* Constructor with a single standard parallel. * Constructor with a single standard parallel.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] stdlat standard parallel (degrees), the circle of tangenc y. * @param[in] stdlat standard parallel (degrees), the circle of tangenc y.
* @param[in] k0 azimuthal scale on the standard parallel. * @param[in] k0 azimuthal scale on the standard parallel.
* *
* An exception is thrown if \e a or \e k0 is not positive or if \e std lat * An exception is thrown if \e a or \e k0 is not positive or if \e std lat
* is not in the range [-90, 90]. * is not in the range [-90, 90].
********************************************************************** / ********************************************************************** /
AlbersEqualArea(real a, real r, real stdlat, real k0); AlbersEqualArea(real a, real f, real stdlat, real k0);
/** /**
* Constructor with two standard parallels. * Constructor with two standard parallels.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat1 first standard parallel (degrees).
* @param[in] stdlat2 second standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees).
* @param[in] k1 azimuthal scale on the standard parallels. * @param[in] k1 azimuthal scale on the standard parallels.
* *
* An exception is thrown if \e a or \e k0 is not positive or if \e std lat1 * An exception is thrown if \e a or \e k0 is not positive or if \e std lat1
* or \e stdlat2 is not in the range [-90, 90]. In addition, an except ion * or \e stdlat2 is not in the range [-90, 90]. In addition, an except ion
* is thrown if \e stdlat1 and \e stdlat2 are opposite poles. * is thrown if \e stdlat1 and \e stdlat2 are opposite poles.
********************************************************************** / ********************************************************************** /
AlbersEqualArea(real a, real r, real stdlat1, real stdlat2, real k1); AlbersEqualArea(real a, real f, real stdlat1, real stdlat2, real k1);
/** /**
* Constructor with two standard parallels specified by sines and cosin es. * Constructor with two standard parallels specified by sines and cosin es.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] sinlat1 sine of first standard parallel. * @param[in] sinlat1 sine of first standard parallel.
* @param[in] coslat1 cosine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel.
* @param[in] sinlat2 sine of second standard parallel. * @param[in] sinlat2 sine of second standard parallel.
* @param[in] coslat2 cosine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel.
* @param[in] k1 azimuthal scale on the standard parallels. * @param[in] k1 azimuthal scale on the standard parallels.
* *
* This allows parallels close to the poles to be specified accurately. * This allows parallels close to the poles to be specified accurately.
* This routine computes the latitude of origin and the azimuthal scale at * This routine computes the latitude of origin and the azimuthal scale at
* this latitude. If \e dlat = abs(\e lat2 - \e lat1) <= 160<sup>o</su p>, * this latitude. If \e dlat = abs(\e lat2 - \e lat1) <= 160<sup>o</su p>,
* then the error in the latitude of origin is less than * then the error in the latitude of origin is less than
* 4.5e-14<sup>o</sup>. * 4.5e-14<sup>o</sup>.
********************************************************************** / ********************************************************************** /
AlbersEqualArea(real a, real r, AlbersEqualArea(real a, real f,
real sinlat1, real coslat1, real sinlat1, real coslat1,
real sinlat2, real coslat2, real sinlat2, real coslat2,
real k1); real k1);
/** /**
* Set the azimuthal scale for the projection. * Set the azimuthal scale for the projection.
* *
* @param[in] lat (degrees). * @param[in] lat (degrees).
* @param[in] k azimuthal scale at latitude \e lat (default 1). * @param[in] k azimuthal scale at latitude \e lat (default 1).
* *
skipping to change at line 251 skipping to change at line 251
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value use
* value used in the constructor. A value of 0 is returned for a sph d in
ere * the constructor.
* (infinite inverse flattening). **********************************************************************
/
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* @return latitude of the origin for the projection (degrees). * @return latitude of the origin for the projection (degrees).
* *
* This is the latitude of minimum azimuthal scale and equals the \e st dlat * This is the latitude of minimum azimuthal scale and equals the \e st dlat
* in the 1-parallel constructor and lies between \e stdlat1 and \e std lat2 * in the 1-parallel constructor and lies between \e stdlat1 and \e std lat2
* in the 2-parallel constructors. * in the 2-parallel constructors.
********************************************************************** / ********************************************************************** /
 End of changes. 9 change blocks. 
21 lines changed or deleted 30 lines changed or added


 AzimuthalEquidistant.hpp   AzimuthalEquidistant.hpp 
/** /**
* \file AzimuthalEquidistant.hpp * \file AzimuthalEquidistant.hpp
* \brief Header for GeographicLib::AzimuthalEquidistant class * \brief Header for GeographicLib::AzimuthalEquidistant class
* *
* Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and
* licensed under the LGPL. For more information, see * licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP) #if !defined(GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP)
#define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP "$Id: 526db2f041dd6d71d05acd 60c7429ad2835ab79e $" #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP "$Id: 5b471fba64d7706c552fa2 1bcc6b70e8283837a0 $"
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Azimuthal Equidistant Projection. * \brief Azimuthal Equidistant Projection.
* *
* Azimuthal equidistant projection centered at an arbitrary position on the * Azimuthal equidistant projection centered at an arbitrary position on the
skipping to change at line 124 skipping to change at line 124
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 inherited from the Geodesic object used in the construct or. * the value inherited from the Geodesic object used in the construct or.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value
* value inherited from the Geodesic object used in the constructor. * inherited from the Geodesic object used in the constructor.
A **********************************************************************
* value of 0 is returned for a sphere (infinite inverse flattening). /
Math::real Flattening() const throw() { return _earth.Flattening(); }
/**
* <b>DEPRECATED</b>
* @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(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP #endif // GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP
 End of changes. 2 change blocks. 
5 lines changed or deleted 10 lines changed or added


 CassiniSoldner.hpp   CassiniSoldner.hpp 
/** /**
* \file CassiniSoldner.hpp * \file CassiniSoldner.hpp
* \brief Header for GeographicLib::CassiniSoldner class * \brief Header for GeographicLib::CassiniSoldner class
* *
* Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and
* licensed under the LGPL. For more information, see * licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_CASSINISOLDNER_HPP) #if !defined(GEOGRAPHICLIB_CASSINISOLDNER_HPP)
#define GEOGRAPHICLIB_CASSINISOLDNER_HPP "$Id: 7d36c41fb37aafe5f0f467755684 85be6f2d6502 $" #define GEOGRAPHICLIB_CASSINISOLDNER_HPP "$Id: 4ef919febf6e2388065e651dd606 b0bf3b7443ce $"
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicLine.hpp> #include <GeographicLib/GeodesicLine.hpp>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Cassini-Soldner Projection. * \brief Cassini-Soldner Projection.
* *
skipping to change at line 217 skipping to change at line 217
Math::real LongitudeOrigin() const throw() Math::real LongitudeOrigin() const throw()
{ return _meridian.Longitude(); } { return _meridian.Longitude(); }
/** /**
* @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 inherited from the Geodesic object used in the construct or. * the value inherited from the Geodesic object used in the construct or.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value
* value inherited from the Geodesic object used in the constructor. * inherited from the Geodesic object used in the constructor.
A **********************************************************************
* value of 0 is returned for a sphere (infinite inverse flattening). /
Math::real Flattening() const throw() { return _earth.Flattening(); }
/**
* <b>DEPRECATED</b>
* @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(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_CASSINISOLDNER_HPP #endif // GEOGRAPHICLIB_CASSINISOLDNER_HPP
 End of changes. 2 change blocks. 
5 lines changed or deleted 10 lines changed or added


 Config.h   Config.h 
#define HAVE_LONG_DOUBLE 1 #define HAVE_LONG_DOUBLE 1
#define GEOGRAPHICLIB_VERSION_STRING "1.10" #define GEOGRAPHICLIB_VERSION_STRING "1.11"
 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 LGPL. For more information, see * and licensed under the LGPL. 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: 484b008f7c73d568472abe2cc8fcbdfbc 81a63af $" #define GEOGRAPHICLIB_CONSTANTS_HPP "$Id: 4aca66343d10b60147ea54b9ede6cc7f0 5e0916d $"
#include <GeographicLib/Config.h> #include <GeographicLib/Config.h>
/** /**
* 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
skipping to change at line 68 skipping to change at line 68
# define GEOGRAPHIC_EXPORT # define GEOGRAPHIC_EXPORT
#endif #endif
RCSID_DECL(GEOGRAPHICLIB_CONSTANTS_HPP) RCSID_DECL(GEOGRAPHICLIB_CONSTANTS_HPP)
#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. Note that with Microsoft Visual Studio, long double is t * configuration. In order for long double to be used, HAVE_LONG_DOUBLE ne
he eds
* 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 <stdexcept> #include <stdexcept>
skipping to change at line 130 skipping to change at line 131
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
/** /**
* @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>(); }
/// \cond DEPRECATED
/** /**
* <b>DEPRECATED</b> A synonym for pi<extened>(). * <b>DEPRECATED</b> A synonym for pi<extened>().
********************************************************************** / ********************************************************************** /
static inline extended epi() throw() { return pi<extended>(); } static inline extended epi() throw() { return pi<extended>(); }
/// \endcond
/** /**
* @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>(); }
/// \cond DEPRECATED
/** /**
* <b>DEPRECATED</b> A synonym for degree<extened>(). * <b>DEPRECATED</b> A synonym for degree<extened>().
********************************************************************** / ********************************************************************** /
static inline extended edegree() throw() { return degree<extended>(); } static inline extended edegree() throw() { return degree<extended>(); }
/// \endcond
/** /**
* Square a number. * Square a number.
* @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)
skipping to change at line 426 skipping to change at line 431
* *
* Define constants specifying the WGS84 ellipsoid, the UTM and UPS * Define constants specifying the WGS84 ellipsoid, the UTM and UPS
* projections, and various unit conversions. * projections, and various unit conversions.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT Constants { class GEOGRAPHIC_EXPORT Constants {
private: private:
typedef Math::real real; typedef Math::real real;
Constants(); // Disable constructor Constants(); // Disable constructor
public: public:
/// \cond DEPRECATED
/** /**
* <b>DEPRECATED</b> A synonym for Math::pi<real>(). * <b>DEPRECATED</b> A synonym for Math::pi<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real pi() throw() { return Math::pi<real>(); } static inline Math::real pi() throw() { return Math::pi<real>(); }
/// \endcond
/** /**
* A synonym for Math::degree<real>(). * A synonym for Math::degree<real>().
********************************************************************** / ********************************************************************** /
static inline Math::real degree() throw() { return Math::degree<real>() ; } static inline Math::real degree() throw() { return Math::degree<real>() ; }
/** /**
* @return the number of radians in an arcminute. * @return the number of radians in an arcminute.
********************************************************************** / ********************************************************************** /
static inline Math::real arcminute() throw() static inline Math::real arcminute() throw()
{ return Math::degree<real>() / 60; } { return Math::degree<real>() / 60; }
/** /**
* @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
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @return the equatorial radius of WGS84 ellipsoid * @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>(); }
/** /**
* @return the reciprocal flattening of WGS84 ellipsoid * @return the flattening of WGS84 ellipsoid (1/298.257223563).
********************************************************************** / ********************************************************************** /
template<typename T> template<typename T>
static inline T WGS84_r() throw() { static inline T WGS84_f() throw() {
// 298.257223563 return T(1) / ( T(298) + T(257223563) / T(1000000000) );
return T(298) + T(257223563) / T(1000000000);
} }
/** /**
* A synonym for WGS84_f<real>().
**********************************************************************
/
static inline Math::real WGS84_f() throw() { return WGS84_f<real>(); }
/**
* <b>DEPRECATED</b>
* @return the reciprocal flattening of WGS84 ellipsoid.
**********************************************************************
/
template<typename T>
static inline T WGS84_r() throw() { return 1/WGS84_f<T>(); }
/**
* <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>(); }
/** /**
* @return the central scale factor for UTM * @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); } // 0.999 6 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>(); }
/** /**
* @return the central scale factor for UPS * @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); } // 0.994 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
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
 End of changes. 17 change blocks. 
13 lines changed or deleted 33 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 LGPL. For more information, see * and licensed under the LGPL. 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: 782c1f225888b3c0b4ff19d0b677e549bd36fa1 c $" #define GEOGRAPHICLIB_DMS_HPP "$Id: 5b4f8ca628248d9f4ad044627eabe6f5918c0c2 d $"
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.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 154 skipping to change at line 154
/** /**
* 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);
/** /**
* Convert a string to a real number treating the case where the string
is
* a simple fraction.
*
* @param[in] str string input.
* @return decoded number.
**********************************************************************
/
static Math::real DecodeFraction(const std::string& 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.
* *
* By default, the \e lat (resp., \e lon) is assigned to the results of * By default, the \e lat (resp., \e lon) is assigned to the results of
* decoding \e dmsa (resp., \e dmsb). However this is overridden if ei ther * decoding \e dmsa (resp., \e dmsb). However this is overridden if ei ther
* \e dmsa or \e dmsb contain a latitude or longitude hemisphere design ator * \e dmsa or \e dmsb contain a latitude or longitude hemisphere design ator
 End of changes. 2 change blocks. 
1 lines changed or deleted 12 lines changed or added


 GeoCoords.hpp   GeoCoords.hpp 
/** /**
* \file GeoCoords.hpp * \file GeoCoords.hpp
* \brief Header for GeographicLib::GeoCoords class * \brief Header for GeographicLib::GeoCoords class
* *
* Copyright (c) Charles Karney (2008, 2009, 2010) <charles@karney.com> * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co m>
* and licensed under the LGPL. For more information, see * and licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#ifndef GEOGRAPHICLIB_GEOCOORDS_HPP #ifndef GEOGRAPHICLIB_GEOCOORDS_HPP
#define GEOGRAPHICLIB_GEOCOORDS_HPP "$Id: 43489a5a6c17b341fd293b326d0340e71 9df01e9 $" #define GEOGRAPHICLIB_GEOCOORDS_HPP "$Id: 99a8aac8540818e46115bc98694955d14 6e53fef $"
#include <GeographicLib/UTMUPS.hpp> #include <GeographicLib/UTMUPS.hpp>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Conversion between geographic coordinates * \brief Conversion between geographic coordinates
* *
* This class stores a geographic position which may be set via the * This class stores a geographic position which may be set via the
skipping to change at line 421 skipping to change at line 421
///@{ ///@{
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return UTMUPS::MajorRadius(); } Math::real MajorRadius() const throw() { return UTMUPS::MajorRadius(); }
/** /**
* @return \e r the inverse flattening of the WGS84 ellipsoid. * @return \e f the flattening of the WGS84 ellipsoid.
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
Math::real Flattening() const throw() { return UTMUPS::Flattening(); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the WGS84 ellipsoid.
**********************************************************************
/
Math::real InverseFlattening() const throw() Math::real InverseFlattening() const throw()
{ return UTMUPS::InverseFlattening(); } { return UTMUPS::InverseFlattening(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_GEOCOORDS_HPP #endif // GEOGRAPHICLIB_GEOCOORDS_HPP
 End of changes. 4 change blocks. 
3 lines changed or deleted 10 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 LGPL. For more information, see * and licensed under the LGPL. 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: 42003fa7ad2a422cf52cc3eff6fa6360 bb25d774 $" #define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: 9a894a0d79bd444c60cfb3b4ecf4981c 1d3dd757 $"
#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 61 skipping to change at line 61
* 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;
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_;
const real _a, _r, _f, _e2, _e2m, _e2a, _e4a, _maxrad; const real _a, _f, _r, _e2, _e2m, _e2a, _e4a, _maxrad;
// Actually this can be static because it doesn't depend on the ellipso id. // Actually this can be static because it doesn't depend on the ellipso id.
// But let's be more general than that. // But let's be more general than that.
void Rotation(real sphi, real cphi, real slam, real clam, void Rotation(real sphi, real cphi, real slam, real clam,
real M[dim2_]) const throw(); 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] r reciprocal flattening. Setting \e r = 0 implies \e r = * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
inf re.
* or flattening = 0 (i.e., a sphere). Negative \e r indicates a pro * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
late ing
* ellipsoid. * to 1/\e f.
* *
* An exception is thrown if either of the axes of the ellipsoid is * An exception is thrown if either of the axes of the ellipsoid is
* non-positive. * non-positive.
********************************************************************** / ********************************************************************** /
Geocentric(real a, real r); Geocentric(real a, real f);
/** /**
* Convert from geodetic to geocentric coordinates. * Convert from geodetic to geocentric 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[in] h height of point above the ellipsoid (meters). * @param[in] h height of point above the ellipsoid (meters).
* @param[out] x geocentric coordinate (meters). * @param[out] x geocentric coordinate (meters).
* @param[out] y geocentric coordinate (meters). * @param[out] y geocentric coordinate (meters).
* @param[out] z geocentric coordinate (meters). * @param[out] z geocentric coordinate (meters).
skipping to change at line 191 skipping to change at line 191
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the
* value used in the constructor. A value of 0 is returned for a sph * value used in the constructor.
ere **********************************************************************
* (infinite inverse flattening). /
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
///@} ///@}
/** /**
* A global instantiation of Geocentric with the parameters for the WGS 84 * A global instantiation of Geocentric with the parameters for the WGS 84
* ellipsoid. * ellipsoid.
********************************************************************** / ********************************************************************** /
static const Geocentric WGS84; static const Geocentric WGS84;
}; };
 End of changes. 5 change blocks. 
12 lines changed or deleted 17 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 LGPL. For more information, see * and licensed under the LGPL. 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: 052cedecb4ece3fa1d25103ae750a4e05f ee2126 $" #define GEOGRAPHICLIB_GEODESIC_HPP "$Id: d93e74a8d3eadc56d947c54b86978191f9 1bf758 $"
#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 (GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 3 : 7) #define GEOD_ORD (GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 3 : 7)
#endif #endif
skipping to change at line 67 skipping to change at line 67
* that the geodesic is not a shortest path. In addition, the arc length * that the geodesic is not a shortest path. In addition, the arc length
* between an equatorial crossing and the next extremum of latitude for a * between an equatorial crossing and the next extremum of latitude for a
* geodesic is 90<sup>o</sup>. * geodesic is 90<sup>o</sup>.
* *
* This class can also calculate several other quantities related to * This class can also calculate several other quantities related to
* geodesics. These are: * geodesics. These are:
* - <i>reduced length</i>. If we fix the first point and increase \e az i1 * - <i>reduced length</i>. If we fix the first point and increase \e az i1
* by \e dazi1 (radians), the the second point is displaced \e m12 \e d azi1 * by \e dazi1 (radians), the the second point is displaced \e m12 \e d azi1
* in the direction \e azi2 + 90<sup>o</sup>. The quantity \e m12 is * in the direction \e azi2 + 90<sup>o</sup>. The quantity \e m12 is
* called the "reduced length" and is symmetric under interchange of th e * called the "reduced length" and is symmetric under interchange of th e
* two points. On a flat surface, we have \e m12 = \e s12. The ratio * two points. On a curved surface the reduced length obeys a symmetry
\e * relation, \e m12 + \e m21 = 0. On a flat surface, we have \e m12 =
* s12/\e m12 gives the azimuthal scale for an azimuthal equidistant \e
* projection. * s12. The ratio \e s12/\e m12 gives the azimuthal scale for an azimu
thal
* 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>. Consider the quadrilateral bounded by the following li nes: * - <i>area</i>. Consider the quadrilateral bounded by the following li nes:
* the geodesic from point 1 to point 2, the meridian from point 2 to t he * the geodesic from point 1 to point 2, the meridian from point 2 to t he
* equator, the equator from \e lon2 to \e lon1, the meridian from the * equator, the equator from \e lon2 to \e lon1, the meridian from the
* equator to point 1. The area of this quadrilateral is represented b y \e * equator to point 1. The area of this quadrilateral is represented b y \e
* S12 with a clockwise traversal of the perimeter counting as a positi ve * S12 with a clockwise traversal of the perimeter counting as a positi ve
* area and it can be used to compute the area of any simple geodesic * area and it can be used to compute the area of any simple geodesic
* polygon. * 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
* which allow an arbitrary set of results to be computed. * which allow an arbitrary set of results to be computed. The quantitie
s \e
* m12, \e M12, \e M21 which all specify the behavior of nearby geodesics
* obey addition rules. Let points 1, 2, and 3 all lie on a single geode
sic,
* then
* - \e m13 = \e m12 \e M23 + \e m23 \e M21
* - \e M13 = \e M12 \e M23 - (1 - \e M12 \e M21) \e m23 / \e m12
* - \e M31 = \e M32 \e M21 - (1 - \e M23 \e M32) \e m12 / \e m23
* *
* Additional functionality if provided by the GeodesicLine class, which * Additional functionality is provided by the GeodesicLine class, which
* allows a sequence of points along a geodesic to be computed. * allows a sequence of points along a geodesic to be computed.
* *
* The calculations are accurate to better than 15 nm. See Sec. 9 of * The calculations are accurate to better than 15 nm. See Sec. 9 of
* <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for d * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>
etails. * for details.
* *
* The algorithms are described in * The algorithms are described in
* - C. F. F. Karney, * - C. F. F. Karney,
* <a href="http://arxiv.org/abs/1102.1215v1">Geodesics * <a href="http://arxiv.org/abs/1102.1215v1">Geodesics
* on an ellipsoid of revolution</a>, * on an ellipsoid of revolution</a>,
* Feb. 2011; * Feb. 2011;
* preprint * preprint
* <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>. * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a>.
* . * .
* For more information on geodesics see \ref geodesic. * For more information on geodesics see \ref geodesic.
skipping to change at line 149 skipping to change at line 157
real& ssig1, real& csig1, real& ssig2, real& csig2, real& ssig1, real& csig1, real& ssig2, real& csig2,
real& eps, real& domg12, bool diffp, real& dlam12, real& eps, real& domg12, bool diffp, real& dlam12,
real C1a[], real C2a[], real C3a[]) real C1a[], real C2a[], real C3a[])
const throw(); const throw();
static const real eps2_; static const real eps2_;
static const real tol0_; static const real tol0_;
static const real tol1_; static const real tol1_;
static const real tol2_; static const real tol2_;
static const real xthresh_; static const real xthresh_;
const real _a, _r, _f, _f1, _e2, _ep2, _n, _b, _c2, _etol2; const real _a, _f, _r, _f1, _e2, _ep2, _n, _b, _c2, _etol2;
real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_]; real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_];
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)
throw(); throw();
static inline real AngNormalize(real x) throw() { static inline real AngNormalize(real x) throw() {
// Place angle in [-180, 180). Assumes x is in [-540, 540). // Place angle in [-180, 180). Assumes x is in [-540, 540).
return x >= 180 ? x - 360 : x < -180 ? x + 360 : x; return x >= 180 ? x - 360 : x < -180 ? x + 360 : x;
} }
static inline real AngRound(real x) throw() { static inline real AngRound(real x) throw() {
// 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
skipping to change at line 273 skipping to change at line 281
ALL = OUT_ALL| CAP_ALL, ALL = OUT_ALL| CAP_ALL,
}; };
/** \name Constructor /** \name Constructor
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Constructor for a ellipsoid with * Constructor for a ellipsoid with
* *
* @param[in] a equatorial radius (meters) * @param[in] a equatorial radius (meters)
* @param[in] r reciprocal flattening. Setting \e r = 0 implies \e r = * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
inf re.
* or flattening = 0 (i.e., a sphere). Negative \e r indicates a pro * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
late ing
* ellipsoid. * to 1/\e f.
* *
* An exception is thrown if either of the axes of the ellipsoid is * An exception is thrown if either of the axes of the ellipsoid is
* non-positive. * non-positive.
********************************************************************** / ********************************************************************** /
Geodesic(real a, real r); Geodesic(real a, real f);
///@} ///@}
/** \name Direct geodesic problem specified in terms of distance. /** \name Direct geodesic problem specified in terms of distance.
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* Perform the direct geodesic calculation where the length of the geod esic * Perform the direct geodesic calculation where the length of the geod esic
* is specify in terms of distance. * is specify in terms of distance.
* *
* @param[in] lat1 latitude of point 1 (degrees). * @param[in] lat1 latitude of point 1 (degrees).
skipping to change at line 771 skipping to change at line 779
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the
* value used in the constructor. A value of 0 is returned for a sph * value used in the constructor.
ere **********************************************************************
* (infinite inverse flattening). /
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* @return total area of ellipsoid in meters<sup>2</sup>. The area of a * @return total area of ellipsoid in meters<sup>2</sup>. The area of a
* polygon encircling a pole can be found by adding * polygon encircling a pole can be found by adding
* Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the * Geodesic::EllipsoidArea()/2 to the sum of \e S12 for each side of the
* polygon. * polygon.
********************************************************************** / ********************************************************************** /
Math::real EllipsoidArea() const throw() Math::real EllipsoidArea() const throw()
{ return 4 * Math::pi<real>() * _c2; } { return 4 * Math::pi<real>() * _c2; }
///@} ///@}
/** /**
* A global instantiation of Geodesic with the parameters for the WGS84 * A global instantiation of Geodesic with the parameters for the WGS84
* ellipsoid. * ellipsoid.
********************************************************************** / ********************************************************************** /
static const Geodesic WGS84; static const Geodesic WGS84;
/// \cond DEPRECATED
/** \name Deprecated function. /** \name Deprecated function.
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* <b>DEPRECATED</b> Perform the direct geodesic calculation. Given a * <b>DEPRECATED</b> Perform the direct geodesic calculation. Given a
* latitude, \e lat1, longitude, \e lon1, and azimuth \e azi1 (degrees) for * latitude, \e lat1, longitude, \e lon1, and azimuth \e azi1 (degrees) for
* point 1 and a range, \e s12 (meters) from point 1 to point 2, return the * point 1 and a range, \e s12 (meters) from point 1 to point 2, return the
* latitude, \e lat2, longitude, \e lon2, and forward azimuth, \e azi2 * latitude, \e lat2, longitude, \e lon2, and forward azimuth, \e azi2
* (degrees) for point 2 and the reduced length \e m12 (meters). If ei ther * (degrees) for point 2 and the reduced length \e m12 (meters). If ei ther
* point is at a pole, the azimuth is defined by keeping the longitude * point is at a pole, the azimuth is defined by keeping the longitude
skipping to change at line 826 skipping to change at line 840
if (arcmode) { if (arcmode) {
real a12 = s12_a12, s12; real a12 = s12_a12, s12;
ArcDirect(lat1, lon1, azi1, a12, lat2, lon2, azi2, s12, m12); ArcDirect(lat1, lon1, azi1, a12, lat2, lon2, azi2, s12, m12);
return s12; return s12;
} else { } else {
real s12 = s12_a12; real s12 = s12_a12;
return Direct(lat1, lon1, azi1, s12, lat2, lon2, azi2, m12); return Direct(lat1, lon1, azi1, s12, lat2, lon2, azi2, m12);
} }
} }
///@} ///@}
/// \endcond
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_GEODESIC_HPP #endif // GEOGRAPHICLIB_GEODESIC_HPP
 End of changes. 11 change blocks. 
20 lines changed or deleted 37 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 LGPL. For more information, see * and licensed under the LGPL. 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: 5d443e356d7037207c0298f930948d 0712c2fe3d $" #define GEOGRAPHICLIB_GEODESICLINE_HPP "$Id: 7621f104dea2ed253fbcf6173ffc8f 2c23c3d67b $"
#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 89 skipping to change at line 89
private: private:
typedef Math::real real; typedef Math::real real;
friend class Geodesic; friend class Geodesic;
static const int nC1_ = Geodesic::nC1_; static const int nC1_ = Geodesic::nC1_;
static const int nC1p_ = Geodesic::nC1p_; static const int nC1p_ = Geodesic::nC1p_;
static const int nC2_ = Geodesic::nC2_; static const int nC2_ = Geodesic::nC2_;
static const int nC3_ = Geodesic::nC3_; static const int nC3_ = Geodesic::nC3_;
static const int nC4_ = Geodesic::nC4_; static const int nC4_ = Geodesic::nC4_;
real _lat1, _lon1, _azi1; real _lat1, _lon1, _azi1;
real _a, _r, _b, _c2, _f1, _salp0, _calp0, _k2, real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2,
_salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1, _salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1,
_A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41;
// index zero elements of _C1a, _C1pa, _C2a, _C3a are unused // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused
real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_], real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_],
_C4a[nC4_]; // all the elements of _C4a are used _C4a[nC4_]; // all the elements of _C4a are used
bool _areap; bool _areap;
unsigned _caps; unsigned _caps;
enum captype { enum captype {
CAP_NONE = Geodesic::CAP_NONE, CAP_NONE = Geodesic::CAP_NONE,
skipping to change at line 535 skipping to change at line 535
///@{ ///@{
/** /**
* @return true if the object has been initialized. * @return true if the object has been initialized.
********************************************************************** / ********************************************************************** /
bool Init() const throw() { return _caps != 0U; } bool Init() const throw() { return _caps != 0U; }
/** /**
* @return \e lat1 the latitude of point 1 (degrees). * @return \e lat1 the latitude of point 1 (degrees).
********************************************************************** / ********************************************************************** /
Math::real Latitude() const throw() { return Init() ? _lat1 : 0; } Math::real Latitude() const throw() { return Init() ? _lat1 : Math::NaN (); }
/** /**
* @return \e lon1 the longitude of point 1 (degrees). * @return \e lon1 the longitude of point 1 (degrees).
********************************************************************** / ********************************************************************** /
Math::real Longitude() const throw() { return Init() ? _lon1 : 0; } Math::real Longitude() const throw()
{ return Init() ? _lon1 : Math::NaN(); }
/** /**
* @return \e azi1 the azimuth (degrees) of the geodesic line at point 1. * @return \e azi1 the azimuth (degrees) of the geodesic line at point 1.
********************************************************************** / ********************************************************************** /
Math::real Azimuth() const throw() { return Init() ? _azi1 : 0; } Math::real Azimuth() const throw() { return Init() ? _azi1 : Math::NaN( ); }
/** /**
* @return \e azi0 the azimuth (degrees) of the geodesic line as it cro sses * @return \e azi0 the azimuth (degrees) of the geodesic line as it cro sses
* the equator in a northward direction. * the equator in a northward direction.
********************************************************************** / ********************************************************************** /
Math::real EquatorialAzimuth() const throw() { Math::real EquatorialAzimuth() const throw() {
return Init() ? atan2(_salp0, _calp0) / Math::degree<real>() : 0; return Init() ?
atan2(_salp0, _calp0) / Math::degree<real>() : Math::NaN();
} }
/** /**
* @return \e a1 the arc length (degrees) between the northward equator ial * @return \e a1 the arc length (degrees) between the northward equator ial
* crossing and point 1. * crossing and point 1.
********************************************************************** / ********************************************************************** /
Math::real EquatorialArc() const throw() { Math::real EquatorialArc() const throw() {
return Init() ? atan2(_ssig1, _csig1) / Math::degree<real>() : 0; return Init() ?
atan2(_ssig1, _csig1) / Math::degree<real>() : Math::NaN();
} }
/** /**
* @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 inherited from the Geodesic object used in the construct or. * the value inherited from the Geodesic object used in the construct or.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return Init() ? _a : 0; } Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN (); }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value
* value inherited from the Geodesic object used in the constructor. * inherited from the Geodesic object used in the constructor.
A
* value of 0 is returned for a sphere (infinite inverse flattening).
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return Init() ? _r : 0; Math::real Flattening() const throw() { return Init() ? _f : Math::NaN(
} ); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
**********************************************************************
/
Math::real InverseFlattening() const throw()
{ return Init() ? 1/_f : Math::NaN(); }
/** /**
* @return \e caps the computational capabilities that this object was * @return \e caps the computational capabilities that this object was
* constructed with. LATITUDE and AZIMUTH are always included. * constructed with. LATITUDE and AZIMUTH are always included.
********************************************************************** / ********************************************************************** /
unsigned Capabilities() const throw() { return _caps; } unsigned Capabilities() const throw() { return _caps; }
/** /**
* @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values.
* @return true if the GeodesicLine object has all these capabilities. * @return true if the GeodesicLine object has all these capabilities.
********************************************************************** / ********************************************************************** /
bool Capabilities(unsigned testcaps) const throw() { bool Capabilities(unsigned testcaps) const throw() {
testcaps &= OUT_ALL; testcaps &= OUT_ALL;
return (_caps & testcaps) == testcaps; return (_caps & testcaps) == testcaps;
} }
///@} ///@}
/// \cond DEPRECATED
/** \name Deprecated Functions /** \name Deprecated Functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* <b>DEPRECATED</b>. Return the latitude, \e lat2, longitude, \e lon2 , * <b>DEPRECATED</b>. Return the latitude, \e lat2, longitude, \e lon2 ,
* and forward azimuth, \e azi2 (degrees) of the point 2 which is a * and forward azimuth, \e azi2 (degrees) of the point 2 which is a
* distance, \e s12 (in meters), from point 1. Also return the reduced * distance, \e s12 (in meters), from point 1. Also return the reduced
* length \e m12 (meters). \e s12 can be signed. If \e arcmode (defau lt * length \e m12 (meters). \e s12 can be signed. If \e arcmode (defau lt
* false) is set to true, \e s12 is interpreted as the arc length \e a1 2 * false) is set to true, \e s12 is interpreted as the arc length \e a1 2
skipping to change at line 631 skipping to change at line 641
* by the following construction: starting at point 1 proceed at azimut h \e * by the following construction: starting at point 1 proceed at azimut h \e
* azi1 + 90<sup>o</sup> a small distance \e dt; turn -90<sup>o</sup> a nd * azi1 + 90<sup>o</sup> a small distance \e dt; turn -90<sup>o</sup> a nd
* proceed a distance \e s12 (\e not the arc length \e a12); the distan ce * proceed a distance \e s12 (\e not the arc length \e a12); the distan ce
* to point 2 is given by \e M12 \e dt. \e M21 is defined analogously. * to point 2 is given by \e M12 \e dt. \e M21 is defined analogously.
********************************************************************** / ********************************************************************** /
void Scale(real a12, real& M12, real& M21) const throw() { void Scale(real a12, real& M12, real& M21) const throw() {
real lat2, lon2, azi2, s12; real lat2, lon2, azi2, s12;
ArcPosition(a12, lat2, lon2, azi2, s12, M12, M21); ArcPosition(a12, lat2, lon2, azi2, s12, M12, M21);
} }
///@} ///@}
/// \endcond
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_GEODESICLINE_HPP #endif // GEOGRAPHICLIB_GEODESICLINE_HPP
 End of changes. 12 change blocks. 
14 lines changed or deleted 25 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 LGPL. For more information, see * and licensed under the LGPL. 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: a7310c17a3b20283af1640db0dc1de40974d9 10c $" #define GEOGRAPHICLIB_GEOID_HPP "$Id: 64e08f1d43515d6da898e5255319d701dde75 00c $"
#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 419 skipping to change at line 419
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
* *
* (The WGS84 value is returned because the supported geoid models are all * (The WGS84 value is returned because the supported geoid models are all
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() Math::real MajorRadius() const throw()
{ return Constants::WGS84_a<real>(); } { return Constants::WGS84_a<real>(); }
/** /**
* @return \e r the inverse flattening of the WGS84 ellipsoid. * @return \e f the flattening of the WGS84 ellipsoid.
* *
* (The WGS84 value is returned because the supported geoid models are all * (The WGS84 value is returned because the supported geoid models are all
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
Math::real Flattening() const throw() { return Constants::WGS84_f<real>
(); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the WGS84 ellipsoid.
**********************************************************************
/
Math::real InverseFlattening() const throw() Math::real InverseFlattening() const throw()
{ return Constants::WGS84_r<real>(); } { return 1/Constants::WGS84_f<real>(); }
///@} ///@}
/** /**
* @return the default path for geoid data files. * @return the default path for geoid data files.
* *
* This is the value of the environment variable GEOID_PATH, if set, * This is the value of the environment variable GEOID_PATH, if set,
* otherwise, it is a compile-time default. * otherwise, it is a compile-time default.
********************************************************************** / ********************************************************************** /
static std::string DefaultGeoidPath(); static std::string DefaultGeoidPath();
/** /**
* @return the default name for the geoid. * @return the default name for the geoid.
* *
* This is the value of the environment variable GEOID_NAME, if set, * This is the value of the environment variable GEOID_NAME, if set,
* otherwise, it is "egm96-5". The Geoid class does not use this funct ion; * otherwise, it is "egm96-5". The Geoid class does not use this funct ion;
* it is just provided as a convenience for a calling program when * it is just provided as a convenience for a calling program when
* constructing a Geoid object. * constructing a Geoid object.
********************************************************************** / ********************************************************************** /
static std::string DefaultGeoidName(); static std::string DefaultGeoidName();
/// \cond DEPRECATED
/** /**
* <b>DEPRECATED</b> Return the compile-time default path for the geoid * <b>DEPRECATED</b> Return the compile-time default path for the geoid
* data files. * data files.
********************************************************************** / ********************************************************************** /
static std::string DefaultPath(); static std::string DefaultPath();
/** /**
* <b>DEPRECATED</b> Return the value of the environment variable * <b>DEPRECATED</b> Return the value of the environment variable
* GEOID_PATH. * GEOID_PATH.
********************************************************************** / ********************************************************************** /
static std::string GeoidPath(); static std::string GeoidPath();
/// \endcond
}; };
} // namespace GeographicLib } // namespace GeographicLib
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning (pop) #pragma warning (pop)
#endif #endif
#endif // GEOGRAPHICLIB_GEOID_HPP #endif // GEOGRAPHICLIB_GEOID_HPP
 End of changes. 6 change blocks. 
3 lines changed or deleted 13 lines changed or added


 Gnomonic.hpp   Gnomonic.hpp 
/** /**
* \file Gnomonic.hpp * \file Gnomonic.hpp
* \brief Header for GeographicLib::Gnomonic class * \brief Header for GeographicLib::Gnomonic 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 LGPL. For more information, see * under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_GNOMONIC_HPP) #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP)
#define GEOGRAPHICLIB_GNOMONIC_HPP "$Id: bf3b7f9f87a997fd135064f9b3233ef267 eb8394 $" #define GEOGRAPHICLIB_GNOMONIC_HPP "$Id: dfab3affb3ed4ae149ff2fdf04c4e30503 126308 $"
#include <GeographicLib/Geodesic.hpp> #include <GeographicLib/Geodesic.hpp>
#include <GeographicLib/GeodesicLine.hpp> #include <GeographicLib/GeodesicLine.hpp>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief %Gnomonic Projection. * \brief %Gnomonic Projection.
* *
skipping to change at line 110 skipping to change at line 110
/** /**
* Constructor for Gnomonic. * Constructor for Gnomonic.
* *
* @param[in] earth the Geodesic object to use for geodesic calculation s. * @param[in] earth the Geodesic object to use for geodesic calculation s.
* By default this uses the WGS84 ellipsoid. * By default this uses the WGS84 ellipsoid.
********************************************************************** / ********************************************************************** /
explicit Gnomonic(const Geodesic& earth = Geodesic::WGS84) explicit Gnomonic(const Geodesic& earth = Geodesic::WGS84)
throw() throw()
: _earth(earth) : _earth(earth)
, _a(_earth.MajorRadius()) , _a(_earth.MajorRadius())
, _f(_earth.InverseFlattening() ? , _f(_earth.Flattening())
1/std::abs(_earth.InverseFlattening()) : 0)
{} {}
/** /**
* Forward projection, from geographic to gnomonic. * Forward projection, from geographic to gnomonic.
* *
* @param[in] lat0 latitude of center point of projection (degrees). * @param[in] lat0 latitude of center point of projection (degrees).
* @param[in] lon0 longitude of center point of projection (degrees). * @param[in] lon0 longitude of center point of projection (degrees).
* @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).
skipping to change at line 193 skipping to change at line 192
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 inherited from the Geodesic object used in the construct or. * the value inherited from the Geodesic object used in the construct or.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _earth.MajorRadius(); } Math::real MajorRadius() const throw() { return _earth.MajorRadius(); }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value
* value inherited from the Geodesic object used in the constructor. * inherited from the Geodesic object used in the constructor.
A **********************************************************************
* value of 0 is returned for a sphere (infinite inverse flattening). /
Math::real Flattening() const throw() { return _earth.Flattening(); }
/**
* <b>DEPRECATED</b>
* @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(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_GNOMONIC_HPP #endif // GEOGRAPHICLIB_GNOMONIC_HPP
 End of changes. 3 change blocks. 
7 lines changed or deleted 11 lines changed or added


 LambertConformalConic.hpp   LambertConformalConic.hpp 
/** /**
* \file LambertConformalConic.hpp * \file LambertConformalConic.hpp
* \brief Header for GeographicLib::LambertConformalConic class * \brief Header for GeographicLib::LambertConformalConic 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 LGPL. For more information, see * under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP)
#define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP "$Id: 2d1efcd0fe69672e8c21b 87133c7c04e8a7b45f6 $" #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP "$Id: 36261b322b57fd7a06c53 868842661888a202041 $"
#include <algorithm> #include <algorithm>
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Lambert Conformal Conic Projection * \brief Lambert Conformal Conic Projection
* *
* Implementation taken from the report, * Implementation taken from the report,
skipping to change at line 55 skipping to change at line 55
* \e lon0 argument of the LambertConformalConic::Forward and * \e lon0 argument of the LambertConformalConic::Forward and
* LambertConformalConic::Reverse functions. There is no provision in th is * LambertConformalConic::Reverse functions. There is no provision in th is
* class for specifying a false easting or false northing or a different * class for specifying a false easting or false northing or a different
* latitude of origin. However these are can be simply included by the * latitude of origin. However these are can be simply included by the
* calling function. For example the Pennsylvania South state coordinate * calling function. For example the Pennsylvania South state coordinate
* system (<a href="http://www.spatialreference.org/ref/epsg/3364/"> * system (<a href="http://www.spatialreference.org/ref/epsg/3364/">
* EPSG:3364</a>) is obtained by: * EPSG:3364</a>) is obtained by:
\code \code
const double const double
a = GeographicLib::Constants::WGS84_a<double>(), a = GeographicLib::Constants::WGS84_a<double>(),
r = 298.257222101, // GRS80 f = 1/298.257222101, // GRS80
lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels
k1 = 1, // scale k1 = 1, // scale
lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin
fe = 600000, fn = 0; // false easting and northin g fe = 600000, fn = 0; // false easting and northin g
// Set up basic projection // Set up basic projection
const GeographicLib::LambertConformalConic PASouth(a, r, lat1, lat2, k1) ; const GeographicLib::LambertConformalConic PASouth(a, f, lat1, lat2, k1) ;
double x0, y0; double x0, y0;
{ {
// Transform origin point // Transform origin point
PASouth.Forward(lon0, lat0, lon0, x0, y0); PASouth.Forward(lon0, lat0, lon0, x0, y0);
x0 -= fe; y0 -= fn; // Combine result with false origin x0 -= fe; y0 -= fn; // Combine result with false origin
} }
double lat, lon, x, y; double lat, lon, x, y;
// Sample conversion from geodetic to PASouth grid // Sample conversion from geodetic to PASouth grid
std::cin >> lat >> lon; std::cin >> lat >> lon;
PASouth.Forward(lon0, lat, lon, x, y); PASouth.Forward(lon0, lat, lon, x, y);
skipping to change at line 84 skipping to change at line 84
// Sample conversion from PASouth grid to geodetic // Sample conversion from PASouth grid to geodetic
std::cin >> x >> y; std::cin >> x >> y;
x += x0; y += y0; x += x0; y += y0;
PASouth.Reverse(lon0, x, y, lat, lon); PASouth.Reverse(lon0, x, y, lat, lon);
std::cout << lat << " " << lon << "\n"; std::cout << lat << " " << lon << "\n";
\endcode \endcode
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT LambertConformalConic { class GEOGRAPHIC_EXPORT LambertConformalConic {
private: private:
typedef Math::real real; typedef Math::real real;
const real _a, _r, _f, _fm, _e2, _e, _e2m; const real _a, _f, _r, _fm, _e2, _e, _e2m;
real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0; real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0;
real _scbet0, _tchi0, _scchi0, _psi0, _nrho0; real _scbet0, _tchi0, _scchi0, _psi0, _nrho0;
static const real eps_; static const real eps_;
static const real epsx_; static const real epsx_;
static const real tol_; static const real tol_;
static const real ahypover_; static const real ahypover_;
static const int numit_ = 5; static const int numit_ = 5;
static inline real hyp(real x) throw() { return Math::hypot(real(1), x) ; } static inline real hyp(real x) throw() { return Math::hypot(real(1), x) ; }
// e * atanh(e * x) = log( ((1 + e*x)/(1 - e*x))^(e/2) ) if f >= 0 // e * atanh(e * x) = log( ((1 + e*x)/(1 - e*x))^(e/2) ) if f >= 0
// - sqrt(-e2) * atan( sqrt(-e2) * x) if f < 0 // - sqrt(-e2) * atan( sqrt(-e2) * x) if f < 0
skipping to change at line 167 skipping to change at line 167
real t = x - y, d = 1 - _e2 * x * y; real t = x - y, d = 1 - _e2 * x * y;
return t != 0 ? eatanhe(t / d) / t : _e2 / d; return t != 0 ? eatanhe(t / d) / t : _e2 / d;
} }
void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) thro w(); void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1) thro w();
public: public:
/** /**
* Constructor with a single standard parallel. * Constructor with a single standard parallel.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] stdlat standard parallel (degrees), the circle of tangenc y. * @param[in] stdlat standard parallel (degrees), the circle of tangenc y.
* @param[in] k0 scale on the standard parallel. * @param[in] k0 scale on the standard parallel.
* *
* An exception is thrown if \e a or \e k0 is not positive or if \e std lat * An exception is thrown if \e a or \e k0 is not positive or if \e std lat
* is not in the range [-90, 90]. * is not in the range [-90, 90].
********************************************************************** / ********************************************************************** /
LambertConformalConic(real a, real r, real stdlat, real k0); LambertConformalConic(real a, real f, real stdlat, real k0);
/** /**
* Constructor with two standard parallels. * Constructor with two standard parallels.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] stdlat1 first standard parallel (degrees). * @param[in] stdlat1 first standard parallel (degrees).
* @param[in] stdlat2 second standard parallel (degrees). * @param[in] stdlat2 second standard parallel (degrees).
* @param[in] k1 scale on the standard parallels. * @param[in] k1 scale on the standard parallels.
* *
* An exception is thrown if \e a or \e k0 is not positive or if \e std lat1 * An exception is thrown if \e a or \e k0 is not positive or if \e std lat1
* or \e stdlat2 is not in the range [-90, 90]. In addition, if either \e * or \e stdlat2 is not in the range [-90, 90]. In addition, if either \e
* stdlat1 or \e stdlat2 is a pole, then an exception is thrown if \e * stdlat1 or \e stdlat2 is a pole, then an exception is thrown if \e
* stdlat1 is not equal \e stdlat2. * stdlat1 is not equal \e stdlat2.
********************************************************************** / ********************************************************************** /
LambertConformalConic(real a, real r, real stdlat1, real stdlat2, real k1); LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1);
/** /**
* Constructor with two standard parallels specified by sines and cosin es. * Constructor with two standard parallels specified by sines and cosin es.
* *
* @param[in] a equatorial radius of ellipsoid (meters) * @param[in] a equatorial radius of ellipsoid (meters)
* @param[in] r reciprocal flattening of ellipsoid. Setting \e r = 0 * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
* implies \e r = inf or flattening = 0 (i.e., a sphere). Negative \ re.
e r * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
* indicates a prolate ellipsoid. ing
* to 1/\e f.
* @param[in] sinlat1 sine of first standard parallel. * @param[in] sinlat1 sine of first standard parallel.
* @param[in] coslat1 cosine of first standard parallel. * @param[in] coslat1 cosine of first standard parallel.
* @param[in] sinlat2 sine of second standard parallel. * @param[in] sinlat2 sine of second standard parallel.
* @param[in] coslat2 cosine of second standard parallel. * @param[in] coslat2 cosine of second standard parallel.
* @param[in] k1 scale on the standard parallels. * @param[in] k1 scale on the standard parallels.
* *
* This allows parallels close to the poles to be specified accurately. * This allows parallels close to the poles to be specified accurately.
* This routine computes the latitude of origin and the scale at this * This routine computes the latitude of origin and the scale at this
* latitude. In the case where \e lat1 and \e lat2 are different, the * latitude. In the case where \e lat1 and \e lat2 are different, the
* errors in this routines are as follows: if \e dlat = abs(\e lat2 - \ e * errors in this routines are as follows: if \e dlat = abs(\e lat2 - \ e
* lat1) <= 160<sup>o</sup> and max(abs(\e lat1), abs(\e lat2)) <= 90 - * lat1) <= 160<sup>o</sup> and max(abs(\e lat1), abs(\e lat2)) <= 90 -
* min(0.0002, 2.2e-6(180 - \e dlat), 6e-8\e dlat<sup>2</sup>) (in * min(0.0002, 2.2e-6(180 - \e dlat), 6e-8\e dlat<sup>2</sup>) (in
* degrees), then the error in the latitude of origin is less than * degrees), then the error in the latitude of origin is less than
* 4.5e-14<sup>o</sup> and the relative error in the scale is less than * 4.5e-14<sup>o</sup> and the relative error in the scale is less than
* 7e-15. * 7e-15.
********************************************************************** / ********************************************************************** /
LambertConformalConic(real a, real r, LambertConformalConic(real a, real f,
real sinlat1, real coslat1, real sinlat1, real coslat1,
real sinlat2, real coslat2, real sinlat2, real coslat2,
real k1); real k1);
/** /**
* Set the scale for the projection. * Set the scale for the projection.
* *
* @param[in] lat (degrees). * @param[in] lat (degrees).
* @param[in] k scale at latitude \e lat (default 1). * @param[in] k scale at latitude \e lat (default 1).
* *
skipping to change at line 309 skipping to change at line 309
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the
* value used in the constructor. A value of 0 is returned for a sph * value used in the constructor.
ere **********************************************************************
* (infinite inverse flattening). /
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* @return latitude of the origin for the projection (degrees). * @return latitude of the origin for the projection (degrees).
* *
* This is the latitude of minimum scale and equals the \e stdlat in th e * This is the latitude of minimum scale and equals the \e stdlat in th e
* 1-parallel constructor and lies between \e stdlat1 and \e stdlat2 in the * 1-parallel constructor and lies between \e stdlat1 and \e stdlat2 in the
* 2-parallel constructors. * 2-parallel constructors.
********************************************************************** / ********************************************************************** /
 End of changes. 11 change blocks. 
23 lines changed or deleted 31 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 LGPL. For more information, see * and licensed under the LGPL. 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: d20959dd365321594acba2a7dea5 cd4dedfbf66a $" #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: 1f16fc06cd148ecb87836a52fad1 2dc36a69a52b $"
#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 201 skipping to change at line 201
Math::real HeightOrigin() const throw() { return _h0; } Math::real HeightOrigin() const throw() { return _h0; }
/** /**
* @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 r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value
* value of \e r inherited from the Geocentric object used in the * inherited from the Geocentric object used in the constructor.
* constructor. A value of 0 is returned for a sphere (infinite inve **********************************************************************
rse /
* flattening). Math::real Flattening() const throw()
{ return _earth.Flattening(); }
/**
* <b>DEPRECATED</b>
* @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(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_LOCALCARTESIAN_HPP #endif // GEOGRAPHICLIB_LOCALCARTESIAN_HPP
 End of changes. 2 change blocks. 
6 lines changed or deleted 11 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 LGPL. For more information, see * and licensed under the LGPL. 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: c818eb3e77b330b44be1412ea54172a9458a67 0c $" #define GEOGRAPHICLIB_MGRS_HPP "$Id: e69a6ec0376f85352407c6c889b6de31aab2f2 d3 $"
#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 43 skipping to change at line 43
* Defense Mapping Agency, Technical Manual TM8358.1 (1990). * Defense Mapping Agency, Technical Manual TM8358.1 (1990).
* *
* This implementation has the following properties: * This implementation has the following properties:
* - The conversions are closed, i.e., output from Forward is legal input for * - The conversions are closed, i.e., output from Forward is legal input for
* Reverse and vice versa. Conversion in both directions preserve the * Reverse and vice versa. Conversion in both directions preserve the
* UTM/UPS selection and the UTM zone. * UTM/UPS selection and the UTM zone.
* - Forward followed by Reverse and vice versa is approximately the * - Forward followed by Reverse and vice versa is approximately the
* identity. (This is affected in predictable ways by errors in * identity. (This is affected in predictable ways by errors in
* determining the latitude band and by loss of precision in the MGRS * determining the latitude band and by loss of precision in the MGRS
* coordinates.) * coordinates.)
* - All MGRS coordinates truncate to legal 100km blocks. All MGRS * - All MGRS coordinates truncate to legal 100 km blocks. All MGRS
* coordinates with a legal 100km block prefix are legal (even though t * coordinates with a legal 100 km block prefix are legal (even though
he the
* latitude band letter may now belong to a neighboring band). * latitude band letter may now belong to a neighboring band).
* - The range of UTM/UPS coordinates allowed for conversion to MGRS * - The range of UTM/UPS coordinates allowed for conversion to MGRS
* coordinates is the maximum consistent with staying within the letter * coordinates is the maximum consistent with staying within the letter
* ranges of the MGRS scheme. * ranges of the MGRS scheme.
* - All the transformations are implemented as static methods in the MGR S * - All the transformations are implemented as static methods in the MGR S
* class. * class.
* *
* The <a href="http://www.nga.mil">NGA</a> software package * The <a href="http://www.nga.mil">NGA</a> software package
* <a href="http://earth-info.nga.mil/GandG/geotrans/index.html">geotrans </a> * <a href="http://earth-info.nga.mil/GandG/geotrans/index.html">geotrans </a>
* also provides conversions to and from MGRS. Version 3.0 (and earlier) * also provides conversions to and from MGRS. Version 3.0 (and earlier)
skipping to change at line 82 skipping to change at line 82
static const std::string latband_; static const std::string latband_;
static const std::string upsband_; static const std::string upsband_;
static const std::string digits_; static const std::string digits_;
static const int mineasting_[4]; static const int mineasting_[4];
static const int maxeasting_[4]; static const int maxeasting_[4];
static const int minnorthing_[4]; static const int minnorthing_[4];
static const int maxnorthing_[4]; static const int maxnorthing_[4];
enum { enum {
base_ = 10, base_ = 10,
// Top-level tiles are 10^5 m = 100km 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() { static int lookup(const std::string& s, char c) throw() {
skipping to change at line 141 skipping to change at line 141
* Convert UTM or UPS coordinate to an MGRS coordinate. * Convert UTM or UPS coordinate to an MGRS coordinate.
* *
* @param[in] zone UTM zone (zero means UPS). * @param[in] zone UTM zone (zero means UPS).
* @param[in] northp hemisphere (true means north, false means south). * @param[in] northp hemisphere (true means north, false means south).
* @param[in] x (meters). * @param[in] x (meters).
* @param[in] y (meters). * @param[in] y (meters).
* @param[in] prec precision relative to 100 km. * @param[in] prec precision relative to 100 km.
* @param[out] mgrs MGRS string. * @param[out] mgrs MGRS string.
* *
* \e prec specifies the precision of the MSGRS string as follows: * \e prec specifies the precision of the MSGRS string as follows:
* - prec = 0 (min), 100km * - prec = 0 (min), 100 km
* - prec = 1, 10km * - prec = 1, 10 km
* - prec = 2, 1km * - prec = 2, 1 km
* - prec = 3, 100m * - prec = 3, 100 m
* - prec = 4, 10m * - prec = 4, 10 m
* - prec = 5, 1m * - prec = 5, 1 m
* - prec = 6, 0.1m * - prec = 6, 0.1 m
* - prec = 11 (max), 1um * - prec = 11 (max), 1 um
* *
* UTM eastings are allowed to be in the range [100 km, 900 km], northi ngs * UTM eastings are allowed to be in the range [100 km, 900 km], northi ngs
* are allowed to be in in [0 km, 9500 km] for the northern hemisphere and * are allowed to be in in [0 km, 9500 km] for the northern hemisphere and
* in [1000 km, 10000 km] for the southern hemisphere. (However UTM * in [1000 km, 10000 km] for the southern hemisphere. (However UTM
* northings can be continued across the equator. So the actual limits on * northings can be continued across the equator. So the actual limits on
* the northings are [-9000 km, 9500 km] for the "northern" hemisphere and * the northings are [-9000 km, 9500 km] for the "northern" hemisphere and
* [1000 km, 19500 km] for the "southern" hemisphere.) * [1000 km, 19500 km] for the "southern" hemisphere.)
* *
* UPS eastings/northings are allowed to be in the range [1300 km, 2700 km] * UPS eastings/northings are allowed to be in the range [1300 km, 2700 km]
* in the northern hemisphere and in [800 km, 3200 km] in the southern * in the northern hemisphere and in [800 km, 3200 km] in the southern
skipping to change at line 172 skipping to change at line 172
* geographic coordinates and UTM and UPS given by UTMUPS. These * geographic coordinates and UTM and UPS given by UTMUPS. These
* restrictions are dictated by the allowed letters in MGRS coordinates . * restrictions are dictated by the allowed letters in MGRS coordinates .
* The choice of 9500 km for the maximum northing for northern hemisphe re * The choice of 9500 km for the maximum northing for northern hemisphe re
* and of 1000 km as the minimum northing for southern hemisphere provi de * and of 1000 km as the minimum northing for southern hemisphere provi de
* at least 0.5 degree extension into standard UPS zones. The upper en ds * at least 0.5 degree extension into standard UPS zones. The upper en ds
* of the ranges for the UPS coordinates is dictated by requiring symme try * of the ranges for the UPS coordinates is dictated by requiring symme try
* about the meridans 0E and 90E. * about the meridans 0E and 90E.
* *
* All allowed UTM and UPS coordinates may now be converted to legal MG RS * All allowed UTM and UPS coordinates may now be converted to legal MG RS
* coordinates with the proviso that eastings and northings on the uppe r * coordinates with the proviso that eastings and northings on the uppe r
* boundaries are silently reduced by about 4nm to place them \e within the * boundaries are silently reduced by about 4 nm to place them \e withi n the
* allowed range. (This includes reducing a southern hemisphere northi ng * allowed range. (This includes reducing a southern hemisphere northi ng
* of 10000km by 4nm so that it is placed in latitude band M.) The UTM or * of 10000 km by 4 nm so that it is placed in latitude band M.) The U TM or
* UPS coordinates are truncated to requested precision to determine th e * UPS coordinates are truncated to requested precision to determine th e
* MGRS coordinate. Thus in UTM zone 38N, the square area with easting in * MGRS coordinate. Thus in UTM zone 38N, the square area with easting in
* [444 km, 445 km) and northing in [3688 km, 3689 km) maps to MGRS * [444 km, 445 km) and northing in [3688 km, 3689 km) maps to MGRS
* coordinate 38SMB4488 (at \e prec = 2, 1km), Khulani Sq., Baghdad. * coordinate 38SMB4488 (at \e prec = 2, 1 km), Khulani Sq., Baghdad.
* *
* The UTM/UPS selection and the UTM zone is preserved in the conversio n to * The UTM/UPS selection and the UTM zone is preserved in the conversio n to
* MGRS coordinate. Thus for \e zone > 0, the MGRS coordinate begins w ith * MGRS coordinate. Thus for \e zone > 0, the MGRS coordinate begins w ith
* the zone number followed by one of [C&ndash;M] for the southern * the zone number followed by one of [C&ndash;M] for the southern
* hemisphere and [N&ndash;X] for the northern hemisphere. For \e zone = * hemisphere and [N&ndash;X] for the northern hemisphere. For \e zone =
* 0, the MGRS coordinates begins with one of [AB] for the southern * 0, the MGRS coordinates begins with one of [AB] for the southern
* hemisphere and [XY] for the northern hemisphere. * hemisphere and [XY] for the northern hemisphere.
* *
* The conversion to the MGRS is exact for prec in [0, 5] except that a * The conversion to the MGRS is exact for prec in [0, 5] except that a
* neighboring latitude band letter may be given if the point is within 5nm * neighboring latitude band letter may be given if the point is within 5nm
skipping to change at line 238 skipping to change at line 238
* @param[out] y (meters). * @param[out] y (meters).
* @param[out] prec precision relative to 100 km. * @param[out] prec precision relative to 100 km.
* @param[in] centerp if true (default), return center of the MGRS squa re, * @param[in] centerp if true (default), return center of the MGRS squa re,
* else return SW (lower left) corner. * else return SW (lower left) corner.
* *
* All conversions from MGRS to UTM/UPS are permitted provided the MGRS * All conversions from MGRS to UTM/UPS are permitted provided the MGRS
* coordinate is a possible result of a conversion in the other directi on. * coordinate is a possible result of a conversion in the other directi on.
* (The leading 0 may be dropped from an input MGRS coordinate for UTM * (The leading 0 may be dropped from an input MGRS coordinate for UTM
* zones 1&ndash;9.) In addition, MGRS coordinates with a neighboring * zones 1&ndash;9.) In addition, MGRS coordinates with a neighboring
* latitude band letter are permitted provided that some portion of the * latitude band letter are permitted provided that some portion of the
* 100km block is within the given latitude band. Thus * 100 km block is within the given latitude band. Thus
* - 38VLS and 38WLS are allowed (latitude 64N intersects the square * - 38VLS and 38WLS are allowed (latitude 64N intersects the square
* 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N) * 38[VW]LS); but 38VMS is not permitted (all of 38VMS is north of 64N)
* - 38MPE and 38NPF are permitted (they straddle the equator); but 3 8NPE * - 38MPE and 38NPF are permitted (they straddle the equator); but 3 8NPE
* and 38MPF are not permitted (the equator does not intersect eith er * and 38MPF are not permitted (the equator does not intersect eith er
* block). * block).
* - Similarly ZAB and YZB are permitted (they straddle the prime * - Similarly ZAB and YZB are permitted (they straddle the prime
* meridian); but YAB and ZZB are not (the prime meridian does not * meridian); but YAB and ZZB are not (the prime meridian does not
* intersect either block). * intersect either block).
* *
* The UTM/UPS selection and the UTM zone is preserved in the conversio n * The UTM/UPS selection and the UTM zone is preserved in the conversio n
skipping to change at line 271 skipping to change at line 271
///@{ ///@{
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real MajorRadius() throw() { return UTMUPS::MajorRadius(); } static Math::real MajorRadius() throw() { return UTMUPS::MajorRadius(); }
/** /**
* @return \e r the inverse flattening of the WGS84 ellipsoid. * @return \e f the flattening of the WGS84 ellipsoid.
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real Flattening() throw() { return UTMUPS::Flattening(); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the WGS84 ellipsoid.
**********************************************************************
/
static Math::real InverseFlattening() throw() static Math::real InverseFlattening() throw()
{ return UTMUPS::InverseFlattening(); } { return UTMUPS::InverseFlattening(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#if defined(_MSC_VER) #if defined(_MSC_VER)
#pragma warning (pop) #pragma warning (pop)
#endif #endif
 End of changes. 10 change blocks. 
18 lines changed or deleted 25 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 LGPL. For more information, see * under the LGPL. 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: 35c0f9c3cf61ce5fae409218463cce0c5558a7 e0 $" #define GEOGRAPHICLIB_OSGB_HPP "$Id: 42b12900bf7035d62562ca4d97ea930e69db8c af $"
#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 191 skipping to change at line 191
* *
* This is 20923713 ft converted to meters using the rule 1 ft = * This is 20923713 ft converted to meters using the rule 1 ft =
* 10^(9.48401603-10) m. (The Airy 1830 value is returned because the OSGB * 10^(9.48401603-10) m. (The Airy 1830 value is returned because the OSGB
* projection is based on this ellipsoid.) * projection is based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real MajorRadius() throw() static Math::real MajorRadius() throw()
// result is about 6377563.3960320664406 m // result is about 6377563.3960320664406 m
{ return real(20923713) * std::pow(real(10), real(0.48401603L) - 1); } { return real(20923713) * std::pow(real(10), real(0.48401603L) - 1); }
/** /**
* @return \e r the inverse flattening of the Airy 1830 ellipsoid. * @return \e f the inverse flattening of the Airy 1830 ellipsoid.
* *
* For the Airy 1830 ellipsoid, \e a = 20923713 ft and \e b = 20853810 ft; * For the Airy 1830 ellipsoid, \e a = 20923713 ft and \e b = 20853810 ft;
* thus the inverse flattening = 20923713/(20923713 - 20853810) = * thus the flattening = (20923713 - 20853810)/20923713 = 7767/2324857
* 299.32496459... (The Airy 1830 value is returned because the OSGB =
* 1/299.32496459... (The Airy 1830 value is returned because the OSGB
* projection is based on this ellipsoid.) * projection is based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real InverseFlattening() throw() static Math::real Flattening() throw()
{ return real(20923713) / real(20923713 - 20853810); } { return real(20923713 - 20853810) / real(20923713); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the Airy 1830 ellipsoid.
**********************************************************************
/
static Math::real InverseFlattening() throw() { return 1/Flattening();
}
/** /**
* @return \e k0 central scale for the OSGB projection (0.9996012717). * @return \e k0 central scale for the OSGB projection (0.9996012717).
********************************************************************** / ********************************************************************** /
static Math::real CentralScale() throw() static Math::real CentralScale() throw()
{ return real(0.9996012717L); } { return real(0.9996012717L); }
/** /**
* @return latitude of the origin for the OSGB projection (49 degrees). * @return latitude of the origin for the OSGB projection (49 degrees).
********************************************************************** / ********************************************************************** /
 End of changes. 4 change blocks. 
6 lines changed or deleted 15 lines changed or added


 PolarStereographic.hpp   PolarStereographic.hpp 
/** /**
* \file PolarStereographic.hpp * \file PolarStereographic.hpp
* \brief Header for GeographicLib::PolarStereographic class * \brief Header for GeographicLib::PolarStereographic 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 LGPL. For more information, see * and licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP)
#define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP "$Id: 75b815b23a06168b724d4bc6 779bad53029ede58 $" #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP "$Id: d87b9c7de659fb35a42845b6 3ae1e5b8239db032 $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief Polar Stereographic Projection * \brief Polar Stereographic Projection
* *
* Implementation taken from the report, * Implementation taken from the report,
* - J. P. Snyder, * - J. P. Snyder,
skipping to change at line 33 skipping to change at line 33
* Working Manual</a>, USGS Professional Paper 1395 (1987), * Working Manual</a>, USGS Professional Paper 1395 (1987),
* pp. 160&ndash;163. * pp. 160&ndash;163.
* *
* This is a straightforward implementation of the equations in Snyder ex cept * This is a straightforward implementation of the equations in Snyder ex cept
* that Newton's method is used to invert the projection. * that Newton's method is used to invert the projection.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT PolarStereographic { class GEOGRAPHIC_EXPORT PolarStereographic {
private: private:
typedef Math::real real; typedef Math::real real;
// _Cx used to be _C but g++ 3.4 has a macro of that name // _Cx used to be _C but g++ 3.4 has a macro of that name
const real _a, _r, _f, _e2, _e, _e2m, _Cx, _c; const real _a, _f, _r, _e2, _e, _e2m, _Cx, _c;
real _k0; real _k0;
static const real tol_; static const real tol_;
static const real overflow_; static const real overflow_;
static const int numit_ = 5; static const int numit_ = 5;
// Return e * atanh(e * x) for f >= 0, else return // Return e * atanh(e * x) for f >= 0, else return
// - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0 // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0
inline real eatanhe(real x) const throw() { inline real eatanhe(real x) const throw() {
return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x); return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x);
} }
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] r reciprocal flattening. Setting \e r = 0 implies \e r = * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
inf re.
* or flattening = 0 (i.e., a sphere). Negative \e r indicates a pro * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
late ing
* ellipsoid. * to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* *
* An exception is thrown if either of the axes of the ellipsoid is * An exception is thrown if either of the axes of the ellipsoid is
* not positive \e a or if \e k0 is not positive. * not positive \e a or if \e k0 is not positive.
********************************************************************** / ********************************************************************** /
PolarStereographic(real a, real r, real k0); PolarStereographic(real a, real f, real k0);
/** /**
* Set the scale for the projection. * Set the scale for the projection.
* *
* @param[in] lat (degrees) assuming \e northp = true. * @param[in] lat (degrees) assuming \e northp = true.
* @param[in] k scale at latitude \e lat (default 1). * @param[in] k scale at latitude \e lat (default 1).
* *
* This allows a "latitude of true scale" to be specified. An exceptio n is * This allows a "latitude of true scale" to be specified. An exceptio n is
* thrown if \e k is not positive or if \e lat is not in the range (-90 , * thrown if \e k is not positive or if \e lat is not in the range (-90 ,
* 90]. * 90].
skipping to change at line 136 skipping to change at line 136
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value use
* value used in the constructor. A value of 0 is returned for a sph d in
ere * the constructor.
* (infinite inverse flattening). **********************************************************************
/
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* The central scale for the projection. This is the value of \e k0 us ed * The central scale for the projection. This is the value of \e k0 us ed
* in the constructor and is the scale at the pole unless overridden by * in the constructor and is the scale at the pole unless overridden by
* PolarStereographic::SetScale. * PolarStereographic::SetScale.
********************************************************************** / ********************************************************************** /
Math::real CentralScale() const throw() { return _k0; } Math::real CentralScale() const throw() { return _k0; }
///@} ///@}
 End of changes. 5 change blocks. 
12 lines changed or deleted 18 lines changed or added


 TransverseMercator.hpp   TransverseMercator.hpp 
/** /**
* \file TransverseMercator.hpp * \file TransverseMercator.hpp
* \brief Header for GeographicLib::TransverseMercator class * \brief Header for GeographicLib::TransverseMercator 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 LGPL. For more information, see * and licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP)
#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP "$Id: efc1fd9413c24c01583c80fd 99435b84f0be1597 $" #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP "$Id: ceb368923a049a1e5fddfb83 6983974ad315b13e $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#if !defined(TM_TX_MAXPOW) #if !defined(TM_TX_MAXPOW)
/** /**
* The order of the series approximation used in TransverseMercator. * The order of the series approximation used in TransverseMercator.
* TM_TX_MAXPOW can be set to any integer in [4, 8]. * TM_TX_MAXPOW can be set to any integer in [4, 8].
**********************************************************************/ **********************************************************************/
#define TM_TX_MAXPOW \ #define TM_TX_MAXPOW \
(GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 4 : 8) (GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 4 : 8)
skipping to change at line 78 skipping to change at line 78
* See \ref transversemercator for a discussion of this projection. * See \ref transversemercator for a discussion of this projection.
**********************************************************************/ **********************************************************************/
class GEOGRAPHIC_EXPORT TransverseMercator { class GEOGRAPHIC_EXPORT TransverseMercator {
private: private:
typedef Math::real real; typedef Math::real real;
static const int maxpow_ = TM_TX_MAXPOW; static const int maxpow_ = TM_TX_MAXPOW;
static const real tol_; static const real tol_;
static const real overflow_; static const real overflow_;
static const int numit_ = 5; static const int numit_ = 5;
const real _a, _r, _f, _k0, _e2, _e, _e2m, _c, _n; const real _a, _f, _r, _k0, _e2, _e, _e2m, _c, _n;
// _alp[0] and _bet[0] unused // _alp[0] and _bet[0] unused
real _a1, _b1, _alp[maxpow_ + 1], _bet[maxpow_ + 1]; real _a1, _b1, _alp[maxpow_ + 1], _bet[maxpow_ + 1];
// tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right
static inline real tanx(real x) throw() { static inline real tanx(real x) throw() {
real t = std::tan(x); real t = std::tan(x);
// Write the tests this way to ensure that tanx(NaN()) is NaN() // Write the tests this way to ensure that tanx(NaN()) is NaN()
return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overfl ow_); return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overfl ow_);
} }
// Return e * atanh(e * x) for f >= 0, else return // Return e * atanh(e * x) for f >= 0, else return
// - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0 // - sqrt(-e2) * atan( sqrt(-e2) * x) for f < 0
inline real eatanhe(real x) const throw() { inline real eatanhe(real x) const throw() {
return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x); return _f >= 0 ? _e * Math::atanh(_e * x) : - _e * std::atan(_e * x);
} }
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] r reciprocal flattening. Setting \e r = 0 implies \e r = * @param[in] f flattening of ellipsoid. Setting \e f = 0 gives a sphe
inf re.
* or flattening = 0 (i.e., a sphere). Negative \e r indicates a pro * Negative \e f gives a prolate ellipsoid. If \e f > 1, set flatten
late ing
* ellipsoid. * to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* *
* An exception is thrown if either of the axes of the ellipsoid or \e k0 * An exception is thrown if either of the axes of the ellipsoid or \e k0
* is not positive. * is not positive.
********************************************************************** / ********************************************************************** /
TransverseMercator(real a, real r, real k0); TransverseMercator(real a, real f, real k0);
/** /**
* Forward projection, from geographic to transverse Mercator. * Forward projection, from geographic to transverse Mercator.
* *
* @param[in] lon0 central meridian of the projection (degrees). * @param[in] lon0 central meridian of the projection (degrees).
* @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).
* @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).
skipping to change at line 170 skipping to change at line 170
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value use
* value used in the constructor. A value of 0 is returned for a sph d in
ere * the constructor.
* (infinite inverse flattening). **********************************************************************
/
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* @return \e k0 central scale for the projection. This is the value o f \e * @return \e k0 central scale for the projection. This is the value o f \e
* k0 used in the constructor and is the scale on the central meridia n. * k0 used in the constructor and is the scale on the central meridia n.
********************************************************************** / ********************************************************************** /
Math::real CentralScale() const throw() { return _k0; } Math::real CentralScale() const throw() { return _k0; }
///@} ///@}
 End of changes. 5 change blocks. 
12 lines changed or deleted 18 lines changed or added


 TransverseMercatorExact.hpp   TransverseMercatorExact.hpp 
/** /**
* \file TransverseMercatorExact.hpp * \file TransverseMercatorExact.hpp
* \brief Header for GeographicLib::TransverseMercatorExact class * \brief Header for GeographicLib::TransverseMercatorExact 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 LGPL. For more information, see * and licensed under the LGPL. For more information, see
* http://geographiclib.sourceforge.net/ * http://geographiclib.sourceforge.net/
**********************************************************************/ **********************************************************************/
#if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP)
#define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP "$Id: 06681bb71d3ef73c0f4 6224eed80ca77fbeb6fc8 $" #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP "$Id: 0dd60506e65ce6eebf1 fe0a38dc9d58840535e74 $"
#include <GeographicLib/Constants.hpp> #include <GeographicLib/Constants.hpp>
#include <GeographicLib/EllipticFunction.hpp> #include <GeographicLib/EllipticFunction.hpp>
namespace GeographicLib { namespace GeographicLib {
/** /**
* \brief An exact implementation of the Transverse Mercator Projection * \brief An exact implementation of the Transverse Mercator Projection
* *
* Implementation of the Transverse Mercator Projection given in * Implementation of the Transverse Mercator Projection given in
skipping to change at line 76 skipping to change at line 76
class GEOGRAPHIC_EXPORT TransverseMercatorExact { class GEOGRAPHIC_EXPORT TransverseMercatorExact {
private: private:
typedef Math::real real; typedef Math::real real;
static const real tol_; static const real tol_;
static const real tol1_; static const real tol1_;
static const real tol2_; static const real tol2_;
static const real taytol_; static const real taytol_;
static const real overflow_; static const real overflow_;
static const int numit_ = 10; static const int numit_ = 10;
const real _a, _r, _f, _k0, _mu, _mv, _e, _ep2; const real _a, _f, _r, _k0, _mu, _mv, _e, _ep2;
const bool _extendp; const bool _extendp;
const EllipticFunction _Eu, _Ev; const EllipticFunction _Eu, _Ev;
// tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right // tan(x) for x in [-pi/2, pi/2] ensuring that the sign is right
static inline real tanx(real x) throw() { static inline real tanx(real x) throw() {
real t = std::tan(x); real t = std::tan(x);
// Write the tests this way to ensure that tanx(NaN()) is NaN() // Write the tests this way to ensure that tanx(NaN()) is NaN()
return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overfl ow_); return x >= 0 ? (!(t < 0) ? t : overflow_) : (!(t >= 0) ? t : -overfl ow_);
} }
real taup(real tau) const throw(); real taup(real tau) const throw();
skipping to change at line 122 skipping to change at line 122
real snu, real cnu, real dnu, real snu, real cnu, real dnu,
real snv, real cnv, real dnv, real snv, real cnv, real dnv,
real& gamma, real& k) const throw(); real& gamma, real& k) 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] r reciprocal flattening. * @param[in] f flattening of ellipsoid. If \e f > 1, set flattening
* to 1/\e f.
* @param[in] k0 central scale factor. * @param[in] k0 central scale factor.
* @param[in] extendp use extended domain. * @param[in] extendp use extended domain.
* *
* The transverse Mercator projection has a branch point singularity at \e * The transverse Mercator projection has a branch point singularity at \e
* lat = 0 and \e lon - \e lon0 = 90 (1 - \e e) or (for * lat = 0 and \e lon - \e lon0 = 90 (1 - \e e) or (for
* TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The \e extendp * TransverseMercatorExact::UTM) x = 18381 km, y = 0m. The \e extendp
* argument governs where the branch cut is placed. With \e extendp = * argument governs where the branch cut is placed. With \e extendp =
* false, the "standard" convention is followed, namely the cut is plac ed * false, the "standard" convention is followed, namely the cut is plac ed
* along x > 18381 km, y = 0m. Forward can be called with any \e lat a nd * along x > 18381 km, y = 0m. Forward can be called with any \e lat a nd
* \e lon then produces the transformation shown in Lee, Fig 46. Rever se * \e lon then produces the transformation shown in Lee, Fig 46. Rever se
skipping to change at line 157 skipping to change at line 158
* - \e x/(\e k0 \e a) in [0, inf) and * - \e x/(\e k0 \e a) in [0, inf) and
* \e y/(\e k0 \e a) in [0, E(\e e^2)] * \e y/(\e k0 \e a) in [0, E(\e e^2)]
* - \e x/(\e k0 \e a) in [K(1 - \e e^2) - E(1 - \e e^2), inf) and * - \e x/(\e k0 \e a) in [K(1 - \e e^2) - E(1 - \e e^2), inf) and
* \e y/(\e k0 \e a) in (-inf, 0] * \e y/(\e k0 \e a) in (-inf, 0]
* . * .
* See Sec. 5 of * See Sec. 5 of
* <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a f ull * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for a f ull
* discussion of the treatment of the branch cut. * discussion of the treatment of the branch cut.
* *
* The method will work for all ellipsoids used in terrestial geodesy. The * The method will work for all ellipsoids used in terrestial geodesy. The
* method cannot be applied directly to the case of a sphere (\e r = in f) * method cannot be applied directly to the case of a sphere (\e f = 0)
* because some the constants characterizing this method diverge in tha t * because some the constants characterizing this method diverge in tha t
* limit, and in practise, \e r should be smaller than about * limit, and in practise, \e f should be larger than about numeric_lim
* 1/numeric_limits< real >::%epsilon(). However, TransverseMercator its<
* treats the sphere exactly. An exception is thrown if either axis of * real >::%epsilon(). However, TransverseMercator treats the sphere
the * exactly. An exception is thrown if either axis of the ellipsoid or
* ellipsoid or \e k0 is not positive or if \e r < 1. \e
* k0 is not positive or if \e f <= 0.
********************************************************************** / ********************************************************************** /
TransverseMercatorExact(real a, real r, real k0, bool extendp = false); TransverseMercatorExact(real a, real f, real k0, bool extendp = false);
/** /**
* Forward projection, from geographic to transverse Mercator. * Forward projection, from geographic to transverse Mercator.
* *
* @param[in] lon0 central meridian of the projection (degrees). * @param[in] lon0 central meridian of the projection (degrees).
* @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).
* @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).
skipping to change at line 230 skipping to change at line 231
/** \name Inspector functions /** \name Inspector functions
********************************************************************** / ********************************************************************** /
///@{ ///@{
/** /**
* @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 used in the constructor. * the value used in the constructor.
********************************************************************** / ********************************************************************** /
Math::real MajorRadius() const throw() { return _a; } Math::real MajorRadius() const throw() { return _a; }
/** /**
* @return \e r the inverse flattening of the ellipsoid. This is the * @return \e f the flattening of the ellipsoid. This is the value use
* value used in the constructor. A value of 0 is returned for a sph d in
ere * the constructor.
* (infinite inverse flattening). **********************************************************************
/
Math::real Flattening() const throw() { return _f; }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the ellipsoid.
********************************************************************** / ********************************************************************** /
Math::real InverseFlattening() const throw() { return _r; } Math::real InverseFlattening() const throw() { return _r; }
/** /**
* @return \e k0 central scale for the projection. This is the value o f \e * @return \e k0 central scale for the projection. This is the value o f \e
* k0 used in the constructor and is the scale on the central meridia n. * k0 used in the constructor and is the scale on the central meridia n.
********************************************************************** / ********************************************************************** /
Math::real CentralScale() const throw() { return _k0; } Math::real CentralScale() const throw() { return _k0; }
///@} ///@}
 End of changes. 7 change blocks. 
14 lines changed or deleted 22 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 LGPL. For more information, see * and licensed under the LGPL. 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: 280b3ae1d12d4ed1f8a429abf99be36a0546 c309 $" #define GEOGRAPHICLIB_UTMUPS_HPP "$Id: d860994613fb8833812d850ab154d98aa4c8 83b6 $"
#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 302 skipping to change at line 302
/** /**
* @return \e a the equatorial radius of the WGS84 ellipsoid (meters). * @return \e a the equatorial radius of the WGS84 ellipsoid (meters).
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real MajorRadius() throw() static Math::real MajorRadius() throw()
{ return Constants::WGS84_a<real>(); } { return Constants::WGS84_a<real>(); }
/** /**
* @return \e r the inverse flattening of the WGS84 ellipsoid. * @return \e f the flattening of the WGS84 ellipsoid.
* *
* (The WGS84 value is returned because the UTM and UPS projections are * (The WGS84 value is returned because the UTM and UPS projections are
* based on this ellipsoid.) * based on this ellipsoid.)
********************************************************************** / ********************************************************************** /
static Math::real Flattening() throw()
{ return Constants::WGS84_f<real>(); }
/**
* <b>DEPRECATED</b>
* @return \e r the inverse flattening of the WGS84 ellipsoid.
**********************************************************************
/
static Math::real InverseFlattening() throw() static Math::real InverseFlattening() throw()
{ return Constants::WGS84_r<real>(); } { return 1/Constants::WGS84_f<real>(); }
///@} ///@}
}; };
} // namespace GeographicLib } // namespace GeographicLib
#endif // GEOGRAPHICLIB_UTMUPS_HPP #endif // GEOGRAPHICLIB_UTMUPS_HPP
 End of changes. 4 change blocks. 
3 lines changed or deleted 11 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/