| Accumulator.hpp | | Accumulator.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file Accumulator.hpp | | * \file Accumulator.hpp | |
| * \brief Header for GeographicLib::Accumulator class | | * \brief Header for GeographicLib::Accumulator class | |
| * | | * | |
| * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | | * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | |
| * under the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP) | | #if !defined(GEOGRAPHICLIB_ACCUMULATOR_HPP) | |
| #define GEOGRAPHICLIB_ACCUMULATOR_HPP \ | | #define GEOGRAPHICLIB_ACCUMULATOR_HPP \ | |
|
| "$Id: 39476b3fc8d7c5abcc980a7f434bb132d24f53ef $" | | "$Id: 03b7f4fdb9974c822f98d5f5aab1094b5a9ac8f2 $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief An accumulator for sums. | | * \brief An accumulator for sums. | |
| * | | * | |
| * This allow many numbers of floating point type \e T to be added togeth
er | | * This allow many numbers of floating point type \e T to be added togeth
er | |
| * with twice the normal precision. Thus if \e T is double, the effectiv
e | | * with twice the normal precision. Thus if \e T is double, the effectiv
e | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| * <a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision | | * <a href="http://dx.doi.org/10.1007/PL00009321"> Adaptive Precision | |
| * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>, | | * Floating-Point Arithmetic and Fast Robust Geometric Predicates</a>, | |
| * Discrete & Computational Geometry 18(3) 305-363 (1997). | | * Discrete & Computational Geometry 18(3) 305-363 (1997). | |
| * | | * | |
| * Approximate timings (summing a vector<double>) | | * Approximate timings (summing a vector<double>) | |
| * - double: 2ns | | * - double: 2ns | |
| * - Accumulator<double>: 23ns | | * - Accumulator<double>: 23ns | |
| * | | * | |
| * In the documentation of the member functions, \e sum stands for the va
lue | | * In the documentation of the member functions, \e sum stands for the va
lue | |
| * currently held in the accumulator. | | * currently held in the accumulator. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Accumulator.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| template<typename T = Math::real> | | template<typename T = Math::real> | |
| class GEOGRAPHIC_EXPORT Accumulator { | | class GEOGRAPHIC_EXPORT Accumulator { | |
| private: | | private: | |
| // _s + _t accumulates for the sum. | | // _s + _t accumulates for the sum. | |
| T _s, _t; | | T _s, _t; | |
| // Error free transformation of a sum. Note that t can be the same as
one | | // Error free transformation of a sum. Note that t can be the same as
one | |
| // of the first two arguments. | | // of the first two arguments. | |
| static inline T sum(T u, T v, T& t) { | | static inline T sum(T u, T v, T& t) { | |
| volatile T s = u + v; | | volatile T s = u + v; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| AlbersEqualArea.hpp | | AlbersEqualArea.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) | | #if !defined(GEOGRAPHICLIB_ALBERSEQUALAREA_HPP) | |
| #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP \ | | #define GEOGRAPHICLIB_ALBERSEQUALAREA_HPP \ | |
|
| "$Id: 554a5a83b2feb1f029cc7a7e3c94bdc86ccc36d1 $" | | "$Id: c9f194023273bee32876018a1f6a548e35303836 $" | |
| | | | |
| #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 54 | | skipping to change at line 54 | |
| * longitude) is specified as the \e lon0 argument of the | | * longitude) is specified as the \e lon0 argument of the | |
| * AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. | | * AlbersEqualArea::Forward and AlbersEqualArea::Reverse functions. | |
| * AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the | | * AlbersEqualArea::Forward and AlbersEqualArea::Reverse also return the | |
| * meridian convergence, \e gamma, and azimuthal scale, \e k. A small sq
uare | | * meridian convergence, \e gamma, and azimuthal scale, \e k. A small sq
uare | |
| * 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. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-AlbersEqualArea.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT AlbersEqualArea { | | class GEOGRAPHIC_EXPORT AlbersEqualArea { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| real _a, _f, _fm, _e2, _e, _e2m, _qZ, _qx; | | real _a, _f, _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_; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| AzimuthalEquidistant.hpp | | AzimuthalEquidistant.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * licensed under the MIT/X11 License. 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 \ | | #define GEOGRAPHICLIB_AZIMUTHALEQUIDISTANT_HPP \ | |
|
| "$Id: 457b3566d14500cdc67b82e6422e0e621f136b3e $" | | "$Id: 8883d9b1d45bf4371550426398b39ee5f821ce90 $" | |
| | | | |
| #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 34 | | skipping to change at line 34 | |
| * distance from the center position is hypot(\e x, \e y) and the azimuth
of | | * distance from the center position is hypot(\e x, \e y) and the azimuth
of | |
| * the geodesic from the center point is atan2(\e x, \e y). The Forward
and | | * the geodesic from the center point is atan2(\e x, \e y). The Forward
and | |
| * Reverse methods also return the azimuth \e azi of the geodesic at (\e
x, | | * Reverse methods also return the azimuth \e azi of the geodesic at (\e
x, | |
| * \e y) and reciprocal scale \e rk in the azimuthal direction which, | | * \e y) and reciprocal scale \e rk in the azimuthal direction which, | |
| * together with the basic properties of the projection, serve to specify | | * together with the basic properties of the projection, serve to specify | |
| * completely the local affine transformation between geographic and | | * completely the local affine transformation between geographic and | |
| * projected coordinates. | | * projected coordinates. | |
| * | | * | |
| * The conversions all take place using a Geodesic object (by default | | * The conversions all take place using a Geodesic object (by default | |
| * Geodesic::WGS84). For more information on geodesics see \ref geodesic
. | | * Geodesic::WGS84). For more information on geodesics see \ref geodesic
. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-AzimuthalEquidistant.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT AzimuthalEquidistant { | | class GEOGRAPHIC_EXPORT AzimuthalEquidistant { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| Geodesic _earth; | | Geodesic _earth; | |
| static const real eps_; | | static const real eps_; | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| CassiniSoldner.hpp | | CassiniSoldner.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * licensed under the MIT/X11 License. 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 \ | | #define GEOGRAPHICLIB_CASSINISOLDNER_HPP \ | |
|
| "$Id: 5714da5714d03e293c707371c888faefb2bf5fd2 $" | | "$Id: 5e164482237fc52a63dda3d7e4f287f6313fc79a $" | |
| | | | |
| #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 61 | | skipping to change at line 61 | |
| * | | * | |
| * The conversions all take place using a Geodesic object (by default | | * The conversions all take place using a Geodesic object (by default | |
| * Geodesic::WGS84). For more information on geodesics see \ref geodesic
. | | * Geodesic::WGS84). For more information on geodesics see \ref geodesic
. | |
| * The determination of (\e lat1, \e lon1) in the forward projection is b
y | | * The determination of (\e lat1, \e lon1) in the forward projection is b
y | |
| * solving the inverse geodesic problem for (\e lat, \e lon) and its twin | | * solving the inverse geodesic problem for (\e lat, \e lon) and its twin | |
| * obtained by reflection in the meridional plane. The scale is found by | | * obtained by reflection in the meridional plane. The scale is found by | |
| * determining where two neighboring geodesics intersecting the central | | * determining where two neighboring geodesics intersecting the central | |
| * meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ra
tio | | * meridian at \e lat1 and \e lat1 + \e dlat1 intersect and taking the ra
tio | |
| * of the reduced lengths for the two geodesics between that point and, | | * of the reduced lengths for the two geodesics between that point and, | |
| * respectively, (\e lat1, \e lon1) and (\e lat, \e lon). | | * respectively, (\e lat1, \e lon1) and (\e lat, \e lon). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-CassiniSoldner.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT CassiniSoldner { | | class GEOGRAPHIC_EXPORT CassiniSoldner { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| Geodesic _earth; | | Geodesic _earth; | |
| GeodesicLine _meridian; | | GeodesicLine _meridian; | |
| real _sbet0, _cbet0; | | real _sbet0, _cbet0; | |
| static const real eps1_; | | static const real eps1_; | |
| static const real tiny_; | | static const real tiny_; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| CircularEngine.hpp | | CircularEngine.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file CircularEngine.hpp | | * \file CircularEngine.hpp | |
| * \brief Header for GeographicLib::CircularEngine class | | * \brief Header for GeographicLib::CircularEngine class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_CIRCULARENGINE_HPP) | | #if !defined(GEOGRAPHICLIB_CIRCULARENGINE_HPP) | |
| #define GEOGRAPHICLIB_CIRCULARENGINE_HPP \ | | #define GEOGRAPHICLIB_CIRCULARENGINE_HPP \ | |
|
| "$Id: 6694dcc59d2fe64a0971fdb0d0d78ff084b0b484 $" | | "$Id: d0528f468369dbc1b7af11e02278ad7a361d398b $" | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/SphericalEngine.hpp> | | #include <GeographicLib/SphericalEngine.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) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 48 | | skipping to change at line 48 | |
| * | | * | |
| * CircularEngine is tightly linked to the internals of SphericalEngine.
For | | * CircularEngine is tightly linked to the internals of SphericalEngine.
For | |
| * that reason, the constructor for this class is private. Use | | * that reason, the constructor for this class is private. Use | |
| * SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and | | * SphericalHarmonic::Circle, SphericalHarmonic1::Circle, and | |
| * SphericalHarmonic2::Circle to create instances of this class. | | * SphericalHarmonic2::Circle to create instances of this class. | |
| * | | * | |
| * CircularEngine stores the coefficients needed to allow the summation o
ver | | * CircularEngine stores the coefficients needed to allow the summation o
ver | |
| * order to be performed in 2 or 6 vectors of length \e M + 1 (depending
on | | * order to be performed in 2 or 6 vectors of length \e M + 1 (depending
on | |
| * whether gradients are to be calculated). For this reason the construc
tor | | * whether gradients are to be calculated). For this reason the construc
tor | |
| * may throw a bad_alloc exception. | | * may throw a bad_alloc exception. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-CircularEngine.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT CircularEngine { | | class GEOGRAPHIC_EXPORT CircularEngine { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| enum normalization { | | enum normalization { | |
| FULL = SphericalEngine::FULL, | | FULL = SphericalEngine::FULL, | |
| SCHMIDT = SphericalEngine::SCHMIDT, | | SCHMIDT = SphericalEngine::SCHMIDT, | |
| }; | | }; | |
| int _M; | | int _M; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| Constants.hpp | | Constants.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file Constants.hpp | | * \file Constants.hpp | |
| * \brief Header for GeographicLib::Constants class | | * \brief Header for GeographicLib::Constants class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) | | #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) | |
| #define GEOGRAPHICLIB_CONSTANTS_HPP \ | | #define GEOGRAPHICLIB_CONSTANTS_HPP \ | |
|
| "$Id: b5139b6cb944bbfb59ea89fef8ab7f60306057c6 $" | | "$Id: 58b3796803fd552851e800c63f8ee43f64bacd0c $" | |
| | | | |
| #include <GeographicLib/Config.h> | | #include <GeographicLib/Config.h> | |
| | | | |
| /** | | /** | |
| * A compile-time assert. Use C++0X static_assert, if available. | | * A compile-time assert. Use C++0X static_assert, if available. | |
| **********************************************************************/ | | **********************************************************************/ | |
| #if !defined(STATIC_ASSERT) | | #if !defined(STATIC_ASSERT) | |
| # if defined(__GXX_EXPERIMENTAL_CXX0X__) | | # if defined(__GXX_EXPERIMENTAL_CXX0X__) | |
| # define STATIC_ASSERT static_assert | | # define STATIC_ASSERT static_assert | |
| # elif defined(_MSC_VER) && _MSC_VER >= 1600 | | # elif defined(_MSC_VER) && _MSC_VER >= 1600 | |
| | | | |
| skipping to change at line 68 | | skipping to change at line 68 | |
| * addition all the header files are included via %GeographicLib/filename. | | * addition all the header files are included via %GeographicLib/filename. | |
| * This minimizes the likelihood of conflicts with other packages. | | * This minimizes the likelihood of conflicts with other packages. | |
| **********************************************************************/ | | **********************************************************************/ | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief %Constants needed by %GeographicLib | | * \brief %Constants needed by %GeographicLib | |
| * | | * | |
| * 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. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Constants.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| 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: | |
| /** | | /** | |
| * A synonym for Math::degree<real>(). | | * A synonym for Math::degree<real>(). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
| skipping to change at line 305 | | skipping to change at line 308 | |
| static inline Math::real surveyfoot() throw() | | static inline Math::real surveyfoot() throw() | |
| { return real(1200) / real(3937) * meter<real>(); } | | { return real(1200) / real(3937) * meter<real>(); } | |
| ///@} | | ///@} | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * \brief Exception handling for %GeographicLib | | * \brief Exception handling for %GeographicLib | |
| * | | * | |
| * A class to handle exceptions. It's derived from std::runtime_error so
it | | * A class to handle exceptions. It's derived from std::runtime_error so
it | |
| * can be caught by the usual catch clauses. | | * can be caught by the usual catch clauses. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-GeographicErr.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GeographicErr : public std::runtime_error { | | class GeographicErr : public std::runtime_error { | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Constructor | | * Constructor | |
| * | | * | |
| * @param[in] msg a string message, which is accessible in the catch | | * @param[in] msg a string message, which is accessible in the catch | |
| * clause, via what(). | | * clause, via what(). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 7 lines changed or added | |
|
| DMS.hpp | | DMS.hpp | |
| /** | | /** | |
| * \file DMS.hpp | | * \file DMS.hpp | |
| * \brief Header for GeographicLib::DMS class | | * \brief Header for GeographicLib::DMS class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_DMS_HPP) | | #if !defined(GEOGRAPHICLIB_DMS_HPP) | |
|
| #define GEOGRAPHICLIB_DMS_HPP "$Id: 83292a5889c09c7f444a587d501a4145bcdf993
c $" | | #define GEOGRAPHICLIB_DMS_HPP "$Id: ace0c24b4f8b290b6ec49fb0f5e9aba47b6b996
a $" | |
| | | | |
| #include <sstream> | | #include <sstream> | |
| #include <iomanip> | | #include <iomanip> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Utility.hpp> | | #include <GeographicLib/Utility.hpp> | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| // Squelch warnings about dll vs string | | // Squelch warnings about dll vs string | |
| #pragma warning (push) | | #pragma warning (push) | |
| #pragma warning (disable: 4251) | | #pragma warning (disable: 4251) | |
| #endif | | #endif | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Convert between degrees and %DMS representation. | | * \brief Convert between degrees and %DMS representation. | |
| * | | * | |
| * Parse a string representing degree, minutes, and seconds and return th
e | | * Parse a string representing degree, minutes, and seconds and return th
e | |
| * angle in degrees and format an angle in degrees as degree, minutes, an
d | | * angle in degrees and format an angle in degrees as degree, minutes, an
d | |
| * seconds. In addition, handle NANs and infinities on input and output. | | * seconds. In addition, handle NANs and infinities on input and output. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-DMS.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT DMS { | | class GEOGRAPHIC_EXPORT DMS { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| // Replace all occurrences of pat by c | | // Replace all occurrences of pat by c | |
| static void replace(std::string& s, const std::string& pat, char c) { | | static void replace(std::string& s, const std::string& pat, char c) { | |
| std::string::size_type p = 0; | | std::string::size_type p = 0; | |
| while (true) { | | while (true) { | |
| p = s.find(pat, p); | | p = s.find(pat, p); | |
| if (p == std::string::npos) | | if (p == std::string::npos) | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| EllipticFunction.hpp | | EllipticFunction.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file EllipticFunction.hpp | | * \file EllipticFunction.hpp | |
| * \brief Header for GeographicLib::EllipticFunction class | | * \brief Header for GeographicLib::EllipticFunction class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2008, 2009, 2011) <charles@karney.com> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) | | #if !defined(GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP) | |
| #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP \ | | #define GEOGRAPHICLIB_ELLIPTICFUNCTION_HPP \ | |
|
| "$Id: fcee9dee564eaf87b75e742f16d1954091a77dbf $" | | "$Id: 1d42b41095ac447697a256ac7f71a4f969270ddd $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Elliptic functions needed for TransverseMercatorExact | | * \brief Elliptic functions needed for TransverseMercatorExact | |
| * | | * | |
| * This provides the subset of elliptic functions needed for | | * This provides the subset of elliptic functions needed for | |
| * TransverseMercatorExact. For a given ellipsoid, only parameters | | * TransverseMercatorExact. For a given ellipsoid, only parameters | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| * integrals</a>, Numerical Algorithms 10, 13–26 (1995). | | * integrals</a>, Numerical Algorithms 10, 13–26 (1995). | |
| * . | | * . | |
| * The computation of the Jacobi elliptic functions uses the algorithm gi
ven | | * The computation of the Jacobi elliptic functions uses the algorithm gi
ven | |
| * in | | * in | |
| * - R. Bulirsch, | | * - R. Bulirsch, | |
| * <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculatio
n of | | * <a href="http://dx.doi.org/10.1007/BF01397975"> Numerical Calculatio
n of | |
| * Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik
7, | | * Elliptic Integrals and Elliptic Functions</a>, Numericshe Mathematik
7, | |
| * 78–90 (1965). | | * 78–90 (1965). | |
| * . | | * . | |
| * The notation follows Abramowitz and Stegun, Chapters 16 and 17. | | * The notation follows Abramowitz and Stegun, Chapters 16 and 17. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-EllipticFunction.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT EllipticFunction { | | class GEOGRAPHIC_EXPORT EllipticFunction { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| static const real tol_; | | static const real tol_; | |
| static const real tolRF_; | | static const real tolRF_; | |
| static const real tolRD_; | | static const real tolRD_; | |
| static const real tolRG0_; | | static const real tolRG0_; | |
| static const real tolJAC_; | | static const real tolJAC_; | |
| static const real tolJAC1_; | | static const real tolJAC1_; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| GeoCoords.hpp | | GeoCoords.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #ifndef GEOGRAPHICLIB_GEOCOORDS_HPP | | #ifndef GEOGRAPHICLIB_GEOCOORDS_HPP | |
| #define GEOGRAPHICLIB_GEOCOORDS_HPP \ | | #define GEOGRAPHICLIB_GEOCOORDS_HPP \ | |
|
| "$Id: 8f389fbd5bd0231892039ef8ffae9ded5736f013 $" | | "$Id: fc52421e0cbb368e60f7ac14a3eac25e5e9c0ca6 $" | |
| | | | |
| #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 43 | | skipping to change at line 43 | |
| * The mutable state consists of the UTM or UPS coordinates for a alterna
te | | * The mutable state consists of the UTM or UPS coordinates for a alterna
te | |
| * zone. A method SetAltZone is provided to set the alternate UPS/UTM zo
ne. | | * zone. A method SetAltZone is provided to set the alternate UPS/UTM zo
ne. | |
| * | | * | |
| * Methods are provided to return the geographic coordinates, the input U
TM | | * Methods are provided to return the geographic coordinates, the input U
TM | |
| * or UPS coordinates (and associated meridian convergence and scale), or | | * or UPS coordinates (and associated meridian convergence and scale), or | |
| * alternate UTM or UPS coordinates (and their associated meridian | | * alternate UTM or UPS coordinates (and their associated meridian | |
| * convergence and scale). | | * convergence and scale). | |
| * | | * | |
| * Once the input string has been parsed, you can print the result out in
any | | * Once the input string has been parsed, you can print the result out in
any | |
| * of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UP
S. | | * of the formats, decimal degrees, degrees minutes seconds, MGRS, UTM/UP
S. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-GeoCoords.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT GeoCoords { | | class GEOGRAPHIC_EXPORT GeoCoords { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| real _lat, _long, _easting, _northing, _gamma, _k; | | real _lat, _long, _easting, _northing, _gamma, _k; | |
| bool _northp; | | bool _northp; | |
| int _zone; // See UTMUPS::zonespec | | int _zone; // See UTMUPS::zonespec | |
| mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k; | | mutable real _alt_easting, _alt_northing, _alt_gamma, _alt_k; | |
| mutable int _alt_zone; | | mutable int _alt_zone; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| Geocentric.hpp | | Geocentric.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file Geocentric.hpp | | * \file Geocentric.hpp | |
| * \brief Header for GeographicLib::Geocentric class | | * \brief Header for GeographicLib::Geocentric class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | | #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | |
| #define GEOGRAPHICLIB_GEOCENTRIC_HPP \ | | #define GEOGRAPHICLIB_GEOCENTRIC_HPP \ | |
|
| "$Id: 869e8cba7a96857eef318b2b02e4135d88bfbc75 $" | | "$Id: 3d26a1dd3b0e584cd935de138af65d0e577adfcd $" | |
| | | | |
| #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 52 | | skipping to change at line 52 | |
| * <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>. | |
| * . | | * . | |
| * See \ref geocentric for more information. | | * See \ref geocentric for more information. | |
| * | | * | |
| * The errors in these routines are close to round-off. Specifically, fo
r | | * The errors in these routines are close to round-off. Specifically, fo
r | |
| * points within 5000 km of the surface of the ellipsoid (either inside o
r | | * points within 5000 km of the surface of the ellipsoid (either inside o
r | |
|
| * outside the ellipsoid), the error is bounded by 7 nm for the WGS84 | | * outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) fo | |
| * ellipsoid. See \ref geocentric for further information on the errors. | | r | |
| | | * the WGS84 ellipsoid. See \ref geocentric for further information on t | |
| | | he | |
| | | * errors. | |
| | | * | |
| | | * Example of use: | |
| | | * \include example-Geocentric.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT Geocentric { | | class GEOGRAPHIC_EXPORT Geocentric { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class LocalCartesian; | | friend class LocalCartesian; | |
| friend class MagneticCircle; // MagneticCircle uses Rotation | | friend class MagneticCircle; // MagneticCircle uses Rotation | |
| friend class MagneticModel; // MagneticModel uses IntForward | | friend class MagneticModel; // MagneticModel uses IntForward | |
| friend class GravityCircle; // GravityCircle uses Rotation | | friend class GravityCircle; // GravityCircle uses Rotation | |
| friend class GravityModel; // GravityModel uses IntForward | | friend class GravityModel; // GravityModel uses IntForward | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 9 lines changed or added | |
|
| Geodesic.hpp | | Geodesic.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file Geodesic.hpp | | * \file Geodesic.hpp | |
| * \brief Header for GeographicLib::Geodesic class | | * \brief Header for GeographicLib::Geodesic class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) | |
| #define GEOGRAPHICLIB_GEODESIC_HPP \ | | #define GEOGRAPHICLIB_GEODESIC_HPP \ | |
|
| "$Id: 81785396c1ad962e10595c8b81d9673658669591 $" | | "$Id: 94017f1e00ed1e70c28e86271a49d5f03732648f $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| #if !defined(GEOD_ORD) | | #if !defined(GEOD_ORD) | |
| /** | | /** | |
| * The order of the expansions used by Geodesic. | | * The order of the expansions used by Geodesic. | |
| **********************************************************************/ | | **********************************************************************/ | |
| #define GEOD_ORD \ | | #define GEOD_ORD \ | |
| (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7)) | | (GEOGRAPHICLIB_PREC == 1 ? 6 : (GEOGRAPHICLIB_PREC == 0 ? 3 : 7)) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 102 | | skipping to change at line 102 | |
| * m12, \e M12, \e M21 which all specify the behavior of nearby geodesics | | * 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, | | * obey addition rules. Let points 1, 2, and 3 all lie on a single geode
sic, | |
| * then | | * then | |
| * - \e m13 = \e m12 \e M23 + \e m23 \e M21 | | * - \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 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 | | * - \e M31 = \e M32 \e M21 - (1 - \e M23 \e M32) \e m12 / \e m23 | |
| * | | * | |
| * Additional functionality is 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 (15 nanometers). S | |
| | | ee | |
| | | * Sec. 9 of | |
| * <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 details. | | * 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>. | |
| * - C. F. F. Karney, | | * - C. F. F. Karney, | |
| * <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a
>, | | * <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a
>, | |
| * Sept. 2011; | | * Sept. 2011; | |
| * preprint | | * preprint | |
| * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | | * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | |
| * . | | * . | |
| * For more information on geodesics see \ref geodesic. | | * For more information on geodesics see \ref geodesic. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Geodesic.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT Geodesic { | | class GEOGRAPHIC_EXPORT Geodesic { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class GeodesicLine; | | friend class GeodesicLine; | |
| static const int nA1_ = GEOD_ORD; | | static const int nA1_ = GEOD_ORD; | |
| static const int nC1_ = GEOD_ORD; | | static const int nC1_ = GEOD_ORD; | |
| static const int nC1p_ = GEOD_ORD; | | static const int nC1p_ = GEOD_ORD; | |
| static const int nA2_ = GEOD_ORD; | | static const int nA2_ = GEOD_ORD; | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 7 lines changed or added | |
|
| GeodesicLine.hpp | | GeodesicLine.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file GeodesicLine.hpp | | * \file GeodesicLine.hpp | |
| * \brief Header for GeographicLib::GeodesicLine class | | * \brief Header for GeographicLib::GeodesicLine class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | |
| #define GEOGRAPHICLIB_GEODESICLINE_HPP \ | | #define GEOGRAPHICLIB_GEODESICLINE_HPP \ | |
|
| "$Id: b18e66a0299f857bf2d71c6debd98b7f14da8a64 $" | | "$Id: 40b72a48fbb1bb9f62f50561529d5809071ffe52 $" | |
| | | | |
| #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 | |
| * single geodesic. The starting point (\e lat1, \e lon1) and the azimut
h \e | | * single geodesic. The starting point (\e lat1, \e lon1) and the azimut
h \e | |
| * azi1 are specified in the constructor. GeodesicLine.Position returns
the | | * azi1 are specified in the constructor. GeodesicLine.Position returns
the | |
| * location of point 2 a distance \e s12 along the geodesic. Alternative
ly | | * location of point 2 a distance \e s12 along the geodesic. Alternative
ly | |
| * GeodesicLine.ArcPosition gives the position of point 2 an arc length \
e | | * GeodesicLine.ArcPosition gives the position of point 2 an arc length \
e | |
|
| * a12 along the geodesic. An example of use of this class is: | | * a12 along the geodesic. | |
| \code | | * | |
| #include <GeographicLib/Geodesic.hpp> | | | |
| #include <GeographicLib/GeodesicLine.hpp> | | | |
| | | | |
| int main() { | | | |
| // Print waypoints between JFK and SIN at approximately | | | |
| // equal 100km intervals | | | |
| double | | | |
| lat1 = 40.640, lon1 = -73.779, // JFK | | | |
| lat2 = 1.359, lon2 = 177.486; // SIN | | | |
| const GeographicLib::Geodesic& | | | |
| g = GeographicLib::Geodesic::WGS84; | | | |
| double s12, azi1, azi2, | | | |
| a12 = g.Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2); | | | |
| double ds = 100e3; // Nominal distance between points = 100 km | | | |
| int num = std::ceil(s12 / ds); // Number of intervals | | | |
| double da = a12/num; // Arc length of each interval | | | |
| const GeographicLib::GeodesicLine l(g, lat1, lon1, azi1); | | | |
| std::cout << std::fixed << std::setprecision(3); | | | |
| for (int i = 0; i <= num; ++i) { | | | |
| double lat, lon; | | | |
| l.ArcPosition(i * da, lat, lon); | | | |
| std::cout << lat << " " << lon << "\n"; | | | |
| } | | | |
| } | | | |
| \endcode | | | |
| * The default copy constructor and assignment operators work with this | | * The default copy constructor and assignment operators work with this | |
|
| * class, so that, for example, the previous example could start | | * class. Similarly, a vector can be used to hold GeodesicLine objects. | |
| \code | | | |
| GeographicLib::GeodesicLine l; | | | |
| l = g.Line(lat1, lon1, azi1); | | | |
| \endcode | | | |
| * Similarly, a vector can be used to hold GeodesicLine objects. | | | |
| * | | * | |
|
| * The calculations are accurate to better than 15 nm. See Sec. 9 of | | * The calculations are accurate to better than 15 nm (15 nanometers). S | |
| | | ee | |
| | | * Sec. 9 of | |
| * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for | | * <a href="http://arxiv.org/abs/1102.1215v1">arXiv:1102.1215v1</a> for | |
| * details. | | * 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>. | |
| * - C. F. F. Karney, | | * - C. F. F. Karney, | |
| * <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a
>, | | * <a href="http://arxiv.org/abs/1109.4448">Algorithms for geodesics</a
>, | |
| * Sept. 2011; | | * Sept. 2011; | |
| * preprint | | * preprint | |
| * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | | * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | |
| * . | | * . | |
| * For more information on geodesics see \ref geodesic. | | * For more information on geodesics see \ref geodesic. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-GeodesicLine.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT GeodesicLine { | | class GEOGRAPHIC_EXPORT GeodesicLine { | |
| 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_; | |
| | | | |
End of changes. 5 change blocks. |
| 35 lines changed or deleted | | 10 lines changed or added | |
|
| Geoid.hpp | | Geoid.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file Geoid.hpp | | * \file Geoid.hpp | |
| * \brief Header for GeographicLib::Geoid class | | * \brief Header for GeographicLib::Geoid class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEOID_HPP) | | #if !defined(GEOGRAPHICLIB_GEOID_HPP) | |
| #define GEOGRAPHICLIB_GEOID_HPP \ | | #define GEOGRAPHICLIB_GEOID_HPP \ | |
|
| "$Id: 73a380e4dcfed4a6ec72c818622ec45f8daf3352 $" | | "$Id: 8bb7b98423fb36c6e078363bf2b5fc851bd8b1fc $" | |
| | | | |
| #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 66 | | skipping to change at line 66 | |
| * | | * | |
| * This class is typically \e not thread safe in that a single instantiat
ion | | * This class is typically \e not thread safe in that a single instantiat
ion | |
| * cannot be safely used by multiple threads because of the way the objec
t | | * cannot be safely used by multiple threads because of the way the objec
t | |
| * reads the data set and because it maintains a single-cell cache. If | | * reads the data set and because it maintains a single-cell cache. If | |
| * multiple threads need to calculate geoid heights they should all const
ruct | | * multiple threads need to calculate geoid heights they should all const
ruct | |
| * thread-local instantiations. Alternatively, set the optional \e | | * thread-local instantiations. Alternatively, set the optional \e | |
| * threadsafe parameter to true in the constructor. This causes the | | * threadsafe parameter to true in the constructor. This causes the | |
| * constructor to read all the data into memory and to turn off the | | * constructor to read all the data into memory and to turn off the | |
| * single-cell caching which results in a Geoid object which \e is thread | | * single-cell caching which results in a Geoid object which \e is thread | |
| * safe. | | * safe. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Geoid.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT Geoid { | | class GEOGRAPHIC_EXPORT Geoid { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| static const unsigned stencilsize_ = 12; | | static const unsigned stencilsize_ = 12; | |
| static const unsigned nterms_ = ((3 + 1) * (3 + 2))/2; // for a cubic f
it | | static const unsigned nterms_ = ((3 + 1) * (3 + 2))/2; // for a cubic f
it | |
| static const real c0_; | | static const real c0_; | |
| static const real c0n_; | | static const real c0n_; | |
| static const real c0s_; | | static const real c0s_; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| Gnomonic.hpp | | Gnomonic.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP) | | #if !defined(GEOGRAPHICLIB_GNOMONIC_HPP) | |
| #define GEOGRAPHICLIB_GNOMONIC_HPP \ | | #define GEOGRAPHICLIB_GNOMONIC_HPP \ | |
|
| "$Id: 3ae0cfd77aad984813d955a03726248ac6b427a9 $" | | "$Id: 93b8247cb467dd7cbafbe10acd6b7c85f7aaf7d1 $" | |
| | | | |
| #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 98 | | skipping to change at line 98 | |
| * sphere at the center point. This causes normal sections through the | | * sphere at the center point. This causes normal sections through the | |
| * center point to appear as straight lines in the projection; i.e., it | | * center point to appear as straight lines in the projection; i.e., it | |
| * generalizes the spherical great circle to a normal section. This wa
s | | * generalizes the spherical great circle to a normal section. This wa
s | |
| * proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic | | * proposed by I. G. Letoval'tsev, Generalization of the %Gnomonic | |
| * Projection for a Spheroid and the Principal Geodetic Problems Involv
ed | | * Projection for a Spheroid and the Principal Geodetic Problems Involv
ed | |
| * in the Alignment of Surface Routes, Geodesy and Aerophotography (5), | | * in the Alignment of Surface Routes, Geodesy and Aerophotography (5), | |
| * 271-274 (1963). | | * 271-274 (1963). | |
| * - The projection given here. This causes geodesics close to the cente
r | | * - The projection given here. This causes geodesics close to the cente
r | |
| * point to appear as straight lines in the projection; i.e., it | | * point to appear as straight lines in the projection; i.e., it | |
| * generalizes the spherical great circle to a geodesic. | | * generalizes the spherical great circle to a geodesic. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Gnomonic.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT Gnomonic { | | class GEOGRAPHIC_EXPORT Gnomonic { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| Geodesic _earth; | | Geodesic _earth; | |
| real _a, _f; | | real _a, _f; | |
| static const real eps0_; | | static const real eps0_; | |
| static const real eps_; | | static const real eps_; | |
| static const int numit_ = 5; | | static const int numit_ = 5; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| GravityCircle.hpp | | GravityCircle.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file GravityCircle.hpp | | * \file GravityCircle.hpp | |
| * \brief Header for GeographicLib::GravityCircle class | | * \brief Header for GeographicLib::GravityCircle class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP) | | #if !defined(GEOGRAPHICLIB_GRAVITYCIRCLE_HPP) | |
| #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP \ | | #define GEOGRAPHICLIB_GRAVITYCIRCLE_HPP \ | |
|
| "$Id: 96763a9084283054e15373a012242f1314b37abe $" | | "$Id: e7a230fffb6fcb413694f2b4ece36ae44627ef33 $" | |
| | | | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/CircularEngine.hpp> | | #include <GeographicLib/CircularEngine.hpp> | |
| #include <GeographicLib/GravityModel.hpp> | | #include <GeographicLib/GravityModel.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 35 | | skipping to change at line 35 | |
| * Evaluate the earth's gravity field on a circle of constant height and | | * Evaluate the earth's gravity field on a circle of constant height and | |
| * latitude. This uses a CircleEngine to pre-evaluate the inner sum of t
he | | * latitude. This uses a CircleEngine to pre-evaluate the inner sum of t
he | |
| * spherical harmonic sum, allowing the values of the field at several | | * spherical harmonic sum, allowing the values of the field at several | |
| * different longitudes to be evaluated rapidly. | | * different longitudes to be evaluated rapidly. | |
| * | | * | |
| * Use GravityModel::Circle to create a GravityCircle object. (The | | * Use GravityModel::Circle to create a GravityCircle object. (The | |
| * constructor for this class is private.) | | * constructor for this class is private.) | |
| * | | * | |
| * See \ref gravityparallel for an example of using GravityCircle (togeth
er | | * See \ref gravityparallel for an example of using GravityCircle (togeth
er | |
| * with OpenMP) to speed up the computation of geoid heights. | | * with OpenMP) to speed up the computation of geoid heights. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-GravityCircle.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT GravityCircle { | | class GEOGRAPHIC_EXPORT GravityCircle { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| enum mask { | | enum mask { | |
| NONE = GravityModel::NONE, | | NONE = GravityModel::NONE, | |
| GRAVITY = GravityModel::GRAVITY, | | GRAVITY = GravityModel::GRAVITY, | |
| DISTURBANCE = GravityModel::DISTURBANCE, | | DISTURBANCE = GravityModel::DISTURBANCE, | |
| DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL, | | DISTURBING_POTENTIAL = GravityModel::DISTURBING_POTENTIAL, | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| GravityModel.hpp | | GravityModel.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file GravityModel.hpp | | * \file GravityModel.hpp | |
| * \brief Header for GeographicLib::GravityModel class | | * \brief Header for GeographicLib::GravityModel class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GRAVITYMODEL_HPP) | | #if !defined(GEOGRAPHICLIB_GRAVITYMODEL_HPP) | |
| #define GEOGRAPHICLIB_GRAVITYMODEL_HPP \ | | #define GEOGRAPHICLIB_GRAVITYMODEL_HPP \ | |
|
| "$Id: 8fa8382c061a698b760fd7fa345f0e02bf362fd6 $" | | "$Id: e1cd05f6303c46250b29d12bc51c3497d06508ae $" | |
| | | | |
| #include <string> | | #include <string> | |
| #include <sstream> | | #include <sstream> | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/NormalGravity.hpp> | | #include <GeographicLib/NormalGravity.hpp> | |
| #include <GeographicLib/SphericalHarmonic.hpp> | | #include <GeographicLib/SphericalHarmonic.hpp> | |
| #include <GeographicLib/SphericalHarmonic1.hpp> | | #include <GeographicLib/SphericalHarmonic1.hpp> | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| | | | |
| skipping to change at line 79 | | skipping to change at line 79 | |
| * - \e X, \e Y, \e Z, geocentric coordinates; | | * - \e X, \e Y, \e Z, geocentric coordinates; | |
| * - \e x, \e y, \e z, local cartesian coordinates used to denote the eas
t, | | * - \e x, \e y, \e z, local cartesian coordinates used to denote the eas
t, | |
| * north and up directions. | | * north and up directions. | |
| * | | * | |
| * See \ref gravity for details of how to install the gravity model and t
he | | * See \ref gravity for details of how to install the gravity model and t
he | |
| * data format. | | * data format. | |
| * | | * | |
| * References: | | * References: | |
| * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San | | * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San | |
| * Francisco, 1967). | | * Francisco, 1967). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-GravityModel.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT GravityModel { | | class GEOGRAPHIC_EXPORT GravityModel { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class GravityCircle; | | friend class GravityCircle; | |
| static const int idlength_ = 8; | | static const int idlength_ = 8; | |
| std::string _name, _dir, _description, _date, _filename, _id; | | std::string _name, _dir, _description, _date, _filename, _id; | |
| real _amodel, _GMmodel, _zeta0, _corrmult; | | real _amodel, _GMmodel, _zeta0, _corrmult; | |
| SphericalHarmonic::normalization _norm; | | SphericalHarmonic::normalization _norm; | |
| | | | |
| skipping to change at line 402 | | skipping to change at line 405 | |
| * - \e caps |= GravityModel::DISTURBING_POTENTIAL | | * - \e caps |= GravityModel::DISTURBING_POTENTIAL | |
| * - \e caps |= GravityModel::SPHERICAL_ANOMALY | | * - \e caps |= GravityModel::SPHERICAL_ANOMALY | |
| * - \e caps |= GravityModel::GEOID_HEIGHT | | * - \e caps |= GravityModel::GEOID_HEIGHT | |
| * . | | * . | |
| * The default value of \e caps is GravityModel::ALL which turns on all
the | | * The default value of \e caps is GravityModel::ALL which turns on all
the | |
| * capabilities. If an unsupported function is invoked, it will return | | * capabilities. If an unsupported function is invoked, it will return | |
| * NaNs. Note that GravityModel::GEOID_HEIGHT will only be honored if
\e h | | * NaNs. Note that GravityModel::GEOID_HEIGHT will only be honored if
\e h | |
| * = 0. | | * = 0. | |
| * | | * | |
| * If the field at several points on a circle of latitude need to be | | * If the field at several points on a circle of latitude need to be | |
|
| * calculated then instead of | | * calculated then creating a GravityCircle object and using its member | |
| \code | | * functions will be substantially faster, especially for high-degree | |
| GravityModel g(...); // Create a gravity model | | * models. See \ref gravityparallel for an example of using GravityCir | |
| double lat = 33, lon0 = 44, dlon = 0.01; | | cle | |
| for (int i = 0; i <= 100; ++i) { | | * (together with OpenMP) to speed up the computation of geoid heights. | |
| real lon = lon0 + i * dlon; | | | |
| std::cout << lon << " " << g.GeoidHeight(lat, lon) << "\n"; | | | |
| } | | | |
| \endcode | | | |
| * use a GravityCircle as in | | | |
| \code | | | |
| GravityModel g(...); // Create a gravity model | | | |
| double lat = 33, lon0 = 44, dlon = 0.01; | | | |
| GravityCircle c(g.Circle(lat, 0)); // the GravityCircle object | | | |
| for (int i = 0; i <= 100; ++i) { | | | |
| real lon = lon0 + i * dlon; | | | |
| std::cout << lon << " " << c.GeoidHeight(lon) << "\n"; | | | |
| } | | | |
| \endcode | | | |
| * For high-degree models, this will be substantially faster. See \ref | | | |
| * gravityparallel for an example of using GravityCircle (together with | | | |
| * OpenMP) to speed up the computation of geoid heights. | | | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| GravityCircle Circle(real lat, real h, unsigned caps = ALL) const; | | GravityCircle Circle(real lat, real h, unsigned caps = ALL) const; | |
| ///@} | | ///@} | |
| | | | |
| /** \name Inspector functions | | /** \name Inspector functions | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| * @return the NormalGravity object for the reference ellipsoid. | | * @return the NormalGravity object for the reference ellipsoid. | |
| | | | |
End of changes. 3 change blocks. |
| 23 lines changed or deleted | | 9 lines changed or added | |
|
| LambertConformalConic.hpp | | LambertConformalConic.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) | | #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP) | |
| #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP \ | | #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP \ | |
|
| "$Id: 7975cff875e88fd42f81f9e1d7117c1dd36667d2 $" | | "$Id: fcf9176f0a356995138754581297173aa3491693 $" | |
| | | | |
| #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 34 | | skipping to change at line 34 | |
| * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection
s: A | | * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection
s: A | |
| * Working Manual</a>, USGS Professional Paper 1395 (1987), | | * Working Manual</a>, USGS Professional Paper 1395 (1987), | |
| * pp. 107–109. | | * pp. 107–109. | |
| * | | * | |
| * This is a implementation of the equations in Snyder except that divide
d | | * This is a implementation of the equations in Snyder except that divide
d | |
| * differences have been used to transform the expressions into ones whic
h | | * differences have been used to transform the expressions into ones whic
h | |
| * may be evaluated accurately and that Newton's method is used to invert
the | | * may be evaluated accurately and that Newton's method is used to invert
the | |
| * projection. In this implementation, the projection correctly becomes
the | | * projection. In this implementation, the projection correctly becomes
the | |
| * Mercator projection or the polar stereographic projection when the | | * Mercator projection or the polar stereographic projection when the | |
| * standard latitude is the equator or a pole. The accuracy of the | | * standard latitude is the equator or a pole. The accuracy of the | |
|
| * projections is about 10 nm. | | * projections is about 10 nm (10 nanometers). | |
| * | | * | |
| * The ellipsoid parameters, the standard parallels, and the scale on the | | * The ellipsoid parameters, the standard parallels, and the scale on the | |
| * standard parallels are set in the constructor. Internally, the case w
ith | | * standard parallels are set in the constructor. Internally, the case w
ith | |
| * two standard parallels is converted into a single standard parallel, t
he | | * two standard parallels is converted into a single standard parallel, t
he | |
| * latitude of tangency (also the latitude of minimum scale), with a scal
e | | * latitude of tangency (also the latitude of minimum scale), with a scal
e | |
| * specified on this parallel. This latitude is also used as the latitud
e of | | * specified on this parallel. This latitude is also used as the latitud
e of | |
| * origin which is returned by LambertConformalConic::OriginLatitude. Th
e | | * origin which is returned by LambertConformalConic::OriginLatitude. Th
e | |
| * scale on the latitude of origin is given by | | * scale on the latitude of origin is given by | |
| * LambertConformalConic::CentralScale. The case with two distinct stand
ard | | * LambertConformalConic::CentralScale. The case with two distinct stand
ard | |
| * parallels where one is a pole is singular and is disallowed. The cent
ral | | * parallels where one is a pole is singular and is disallowed. The cent
ral | |
| * meridian (which is a trivial shift of the longitude) is specified as t
he | | * meridian (which is a trivial shift of the longitude) is specified as t
he | |
| * \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 | | * \include example-LambertConformalConic.cpp | |
| const double | | | |
| a = GeographicLib::Constants::WGS84_a<double>(), | | | |
| f = 1/298.257222101, // GRS80 | | | |
| lat1 = 40 + 58/60.0, lat2 = 39 + 56/60.0, // standard parallels | | | |
| k1 = 1, // scale | | | |
| lat0 = 39 + 20/60.0, lon0 =-77 - 45/60.0, // origin | | | |
| fe = 600000, fn = 0; // false easting and northin | | | |
| g | | | |
| // Set up basic projection | | | |
| const GeographicLib::LambertConformalConic PASouth(a, f, lat1, lat2, k1) | | | |
| ; | | | |
| double x0, y0; | | | |
| { | | | |
| // Transform origin point | | | |
| PASouth.Forward(lon0, lat0, lon0, x0, y0); | | | |
| x0 -= fe; y0 -= fn; // Combine result with false origin | | | |
| } | | | |
| double lat, lon, x, y; | | | |
| // Sample conversion from geodetic to PASouth grid | | | |
| std::cin >> lat >> lon; | | | |
| PASouth.Forward(lon0, lat, lon, x, y); | | | |
| x -= x0; y -= y0; | | | |
| std::cout << x << " " << y << "\n"; | | | |
| // Sample conversion from PASouth grid to geodetic | | | |
| std::cin >> x >> y; | | | |
| x += x0; y += y0; | | | |
| PASouth.Reverse(lon0, x, y, lat, lon); | | | |
| std::cout << lat << " " << lon << "\n"; | | | |
| \endcode | | | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT LambertConformalConic { | | class GEOGRAPHIC_EXPORT LambertConformalConic { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| real _a, _f, _fm, _e2, _e, _e2m; | | real _a, _f, _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_; | |
| | | | |
| skipping to change at line 251 | | skipping to change at line 224 | |
| * @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). | |
| * @param[out] k scale of projection at point. | | * @param[out] k scale of projection at point. | |
| * | | * | |
| * The latitude origin is given by LambertConformalConic::LatitudeOrigi
n(). | | * The latitude origin is given by LambertConformalConic::LatitudeOrigi
n(). | |
| * No false easting or northing is added and \e lat should be in the ra
nge | | * No false easting or northing is added and \e lat should be in the ra
nge | |
| * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. T
he | | * [-90, 90]; \e lon and \e lon0 should be in the range [-180, 360]. T
he | |
|
| * error in the projection is less than about 10 nm (true distance) and | | * error in the projection is less than about 10 nm (10 nanometers), tr | |
| the | | ue | |
| * errors in the meridian convergence and scale are consistent with thi | | * distance, and the errors in the meridian convergence and scale are | |
| s. | | * consistent with this. The values of \e x and \e y returned for poin | |
| * The values of \e x and \e y returned for points which project to | | ts | |
| * infinity (i.e., one or both of the poles) will be large but finite. | | * which project to infinity (i.e., one or both of the poles) will be l | |
| | | arge | |
| | | * but finite. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Forward(real lon0, real lat, real lon, | | void Forward(real lon0, real lat, real lon, | |
| real& x, real& y, real& gamma, real& k) const throw(); | | real& x, real& y, real& gamma, real& k) const throw(); | |
| | | | |
| /** | | /** | |
| * Reverse projection, from Lambert conformal conic to geographic. | | * Reverse projection, from Lambert conformal conic to geographic. | |
| * | | * | |
| * @param[in] lon0 central meridian longitude (degrees). | | * @param[in] lon0 central meridian longitude (degrees). | |
| * @param[in] x easting of point (meters). | | * @param[in] x easting of point (meters). | |
| * @param[in] y northing of point (meters). | | * @param[in] y northing of point (meters). | |
| * @param[out] lat latitude of point (degrees). | | * @param[out] lat latitude of point (degrees). | |
| * @param[out] lon longitude of point (degrees). | | * @param[out] lon longitude of point (degrees). | |
| * @param[out] gamma meridian convergence at point (degrees). | | * @param[out] gamma meridian convergence at point (degrees). | |
| * @param[out] k scale of projection at point. | | * @param[out] k scale of projection at point. | |
| * | | * | |
| * The latitude origin is given by LambertConformalConic::LatitudeOrigi
n(). | | * The latitude origin is given by LambertConformalConic::LatitudeOrigi
n(). | |
| * No false easting or northing is added. \e lon0 should be in the ran
ge | | * No false easting or northing is added. \e lon0 should be in the ran
ge | |
| * [-180, 360]. The value of \e lon returned is in the range [-180, 18
0). | | * [-180, 360]. The value of \e lon returned is in the range [-180, 18
0). | |
|
| * The error in the projection is less than about 10 nm (true distance) | | * The error in the projection is less than about 10 nm (10 nanometers) | |
| and | | , | |
| * the errors in the meridian convergence and scale are consistent with | | * true distance, and the errors in the meridian convergence and scale | |
| * this. | | are | |
| | | * consistent with this. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Reverse(real lon0, real x, real y, | | void Reverse(real lon0, real x, real y, | |
| real& lat, real& lon, real& gamma, real& k) const throw(); | | real& lat, real& lon, real& gamma, real& k) const throw(); | |
| | | | |
| /** | | /** | |
| * LambertConformalConic::Forward without returning the convergence and | | * LambertConformalConic::Forward without returning the convergence and | |
| * scale. | | * scale. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Forward(real lon0, real lat, real lon, | | void Forward(real lon0, real lat, real lon, | |
| real& x, real& y) const throw() { | | real& x, real& y) const throw() { | |
| | | | |
End of changes. 5 change blocks. |
| 42 lines changed or deleted | | 16 lines changed or added | |
|
| LocalCartesian.hpp | | LocalCartesian.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file LocalCartesian.hpp | | * \file LocalCartesian.hpp | |
| * \brief Header for GeographicLib::LocalCartesian class | | * \brief Header for GeographicLib::LocalCartesian class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | | #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | |
| #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP \ | | #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP \ | |
|
| "$Id: 0200a2653b8473d3fbf1f1382291fbff5294821c $" | | "$Id: f4bfc3dad6836b6107cf78e695349a9e9fa5530d $" | |
| | | | |
| #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 | |
| * lon, height = \e h (measured vertically from the surface of the ellips
oid) | | * lon, height = \e h (measured vertically from the surface of the ellips
oid) | |
| * to local cartesian coordinates (\e x, \e y, \e z). The origin of loca
l | | * to local cartesian coordinates (\e x, \e y, \e z). The origin of loca
l | |
| * cartesian coordinate system is at \e lat = \e lat0, \e lon = \e lon0,
\e h | | * cartesian coordinate system is at \e lat = \e lat0, \e lon = \e lon0,
\e h | |
| * = \e h0. The \e z axis is normal to the ellipsoid; the \e y axis point
s | | * = \e h0. The \e z axis is normal to the ellipsoid; the \e y axis point
s | |
| * due north. The plane \e z = - \e h0 is tangent to the ellipsoid. | | * due north. The plane \e z = - \e h0 is tangent to the ellipsoid. | |
| * | | * | |
| * The conversions all take place via geocentric coordinates using a | | * The conversions all take place via geocentric coordinates using a | |
| * Geocentric object (by default Geocentric::WGS84). | | * Geocentric object (by default Geocentric::WGS84). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-LocalCartesian.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT LocalCartesian { | | class GEOGRAPHIC_EXPORT LocalCartesian { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| 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_; | |
| Geocentric _earth; | | Geocentric _earth; | |
| real _lat0, _lon0, _h0; | | real _lat0, _lon0, _h0; | |
| real _x0, _y0, _z0, _r[dim2_]; | | real _x0, _y0, _z0, _r[dim2_]; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| MGRS.hpp | | MGRS.hpp | |
| /** | | /** | |
| * \file MGRS.hpp | | * \file MGRS.hpp | |
| * \brief Header for GeographicLib::MGRS class | | * \brief Header for GeographicLib::MGRS class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_MGRS_HPP) | | #if !defined(GEOGRAPHICLIB_MGRS_HPP) | |
|
| #define GEOGRAPHICLIB_MGRS_HPP "$Id: 9f5fb4813d4ed429fee1570bf9378ad7b8f495
9b $" | | #define GEOGRAPHICLIB_MGRS_HPP "$Id: c0374fd149f358fa6d0e52533206c1e5b0c49d
ec $" | |
| | | | |
| #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 59 | | skipping to change at line 59 | |
| * - 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) | |
| * suffers from some drawbacks: | | * suffers from some drawbacks: | |
| * - Inconsistent rules are used to determine the whether a particular MG
RS | | * - Inconsistent rules are used to determine the whether a particular MG
RS | |
| * coordinate is legal. A more systematic approach is taken here. | | * coordinate is legal. A more systematic approach is taken here. | |
| * - The underlying projections are not very accurately implemented. | | * - The underlying projections are not very accurately implemented. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-MGRS.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT MGRS { | | class GEOGRAPHIC_EXPORT MGRS { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| // The smallest length s.t., 1.0e7 - eps_ < 1.0e7 (approx 1.9 nm) | | // The smallest length s.t., 1.0e7 - eps_ < 1.0e7 (approx 1.9 nm) | |
| static const real eps_; | | static const real eps_; | |
| // The smallest angle s.t., 90 - eps_ < 90 (approx 50e-12 arcsec) | | // The smallest angle s.t., 90 - eps_ < 90 (approx 50e-12 arcsec) | |
| static const real angeps_; | | static const real angeps_; | |
| static const std::string hemispheres_; | | static const std::string hemispheres_; | |
| static const std::string utmcols_[3]; | | static const std::string utmcols_[3]; | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 168 | |
| * 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 meridians 0E and 90E. | | * about the meridians 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 4 nm to place them \e withi | | * boundaries are silently reduced by about 4 nm (4 nanometers) to plac | |
| n the | | e | |
| * allowed range. (This includes reducing a southern hemisphere northi | | * them \e within the allowed range. (This includes reducing a souther | |
| ng | | n | |
| * of 10000 km by 4 nm so that it is placed in latitude band M.) The U | | * hemisphere northing of 10000 km by 4 nm so that it is placed in lati | |
| TM or | | tude | |
| * UPS coordinates are truncated to requested precision to determine th | | * band M.) The UTM or UPS coordinates are truncated to requested | |
| e | | * precision to determine the MGRS coordinate. Thus in UTM zone 38N, t | |
| * MGRS coordinate. Thus in UTM zone 38N, the square area with easting | | he | |
| in | | * square area with easting in [444 km, 445 km) and northing in [3688 k | |
| * [444 km, 445 km) and northing in [3688 km, 3689 km) maps to MGRS | | m, | |
| * coordinate 38SMB4488 (at \e prec = 2, 1 km), Khulani Sq., Baghdad. | | * 3689 km) maps to MGRS 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–M] for the southern | | * the zone number followed by one of [C–M] for the southern | |
| * hemisphere and [N–X] for the northern hemisphere. For \e zone
= | | * hemisphere and [N–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 | |
| | | | |
End of changes. 3 change blocks. |
| 13 lines changed or deleted | | 17 lines changed or added | |
|
| MagneticCircle.hpp | | MagneticCircle.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file MagneticCircle.hpp | | * \file MagneticCircle.hpp | |
| * \brief Header for GeographicLib::MagneticCircle class | | * \brief Header for GeographicLib::MagneticCircle class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP) | | #if !defined(GEOGRAPHICLIB_MAGNETICCIRCLE_HPP) | |
| #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP \ | | #define GEOGRAPHICLIB_MAGNETICCIRCLE_HPP \ | |
|
| "$Id: 070a0f02ac2dae39473f225ebf9b827ac75c826d $" | | "$Id: 3884656adfb278af41423d4df4826b1b928f55f1 $" | |
| | | | |
| #include <string> | | #include <string> | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/CircularEngine.hpp> | | #include <GeographicLib/CircularEngine.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Geomagnetic field on a circle of latitude | | * \brief Geomagnetic field on a circle of latitude | |
| * | | * | |
| * Evaluate the earth's magnetic field on a circle of constant height and | | * Evaluate the earth's magnetic field on a circle of constant height and | |
| * latitude. This uses a CircleEngine to pre-evaluate the inner sum of t
he | | * latitude. This uses a CircleEngine to pre-evaluate the inner sum of t
he | |
| * spherical harmonic sum, allowing the values of the field at several | | * spherical harmonic sum, allowing the values of the field at several | |
| * different longitudes to be evaluated rapidly. | | * different longitudes to be evaluated rapidly. | |
| * | | * | |
| * Use MagneticModel::Circle to create a MagneticCircle object. (The | | * Use MagneticModel::Circle to create a MagneticCircle object. (The | |
| * constructor for this class is private.) | | * constructor for this class is private.) | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-MagneticCircle.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT MagneticCircle { | | class GEOGRAPHIC_EXPORT MagneticCircle { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| | | | |
| real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0; | | real _a, _f, _lat, _h, _t, _cphi, _sphi, _t1, _dt0; | |
| bool _interpolate; | | bool _interpolate; | |
| CircularEngine _circ0, _circ1; | | CircularEngine _circ0, _circ1; | |
| | | | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| MagneticModel.hpp | | MagneticModel.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file MagneticModel.hpp | | * \file MagneticModel.hpp | |
| * \brief Header for GeographicLib::MagneticModel class | | * \brief Header for GeographicLib::MagneticModel class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_MAGNETICMODEL_HPP) | | #if !defined(GEOGRAPHICLIB_MAGNETICMODEL_HPP) | |
| #define GEOGRAPHICLIB_MAGNETICMODEL_HPP \ | | #define GEOGRAPHICLIB_MAGNETICMODEL_HPP \ | |
|
| "$Id: 4da5b2c9d2a2ced31182528eb47b129520ae484b $" | | "$Id: 7e3fd1db9a29b713c7ce63584e8fbfd2b28914e2 $" | |
| | | | |
| #include <string> | | #include <string> | |
| #include <sstream> | | #include <sstream> | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Geocentric.hpp> | | #include <GeographicLib/Geocentric.hpp> | |
| #include <GeographicLib/SphericalHarmonic.hpp> | | #include <GeographicLib/SphericalHarmonic.hpp> | |
| | | | |
| #if defined(_MSC_VER) | | #if defined(_MSC_VER) | |
| // Squelch warnings about dll vs vector | | // Squelch warnings about dll vs vector | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| * - WMM2010: | | * - WMM2010: | |
| * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml | | * - http://ngdc.noaa.gov/geomag/WMM/DoDWMM.shtml | |
| * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2010/WMM2010COF.zip | | * - http://ngdc.noaa.gov/geomag/WMM/data/WMM2010/WMM2010COF.zip | |
| * - IGRF11: | | * - IGRF11: | |
| * - http://ngdc.noaa.gov/IAGA/vmod/igrf.html | | * - http://ngdc.noaa.gov/IAGA/vmod/igrf.html | |
| * - http://ngdc.noaa.gov/IAGA/vmod/igrf11coeffs.txt | | * - http://ngdc.noaa.gov/IAGA/vmod/igrf11coeffs.txt | |
| * - http://ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz | | * - http://ngdc.noaa.gov/IAGA/vmod/geomag70_linux.tar.gz | |
| * - EMM2010: | | * - EMM2010: | |
| * - http://ngdc.noaa.gov/geomag/EMM/index.html | | * - http://ngdc.noaa.gov/geomag/EMM/index.html | |
| * - http://ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2010_Sph_Windows_Li
nux.zip | | * - http://ngdc.noaa.gov/geomag/EMM/data/geomag/EMM2010_Sph_Windows_Li
nux.zip | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-MagneticModel.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT MagneticModel { | | class GEOGRAPHIC_EXPORT MagneticModel { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| static const int idlength_ = 8; | | static const int idlength_ = 8; | |
| std::string _name, _dir, _description, _date, _filename, _id; | | std::string _name, _dir, _description, _date, _filename, _id; | |
| real _t0, _dt0, _tmin, _tmax, _a, _hmin, _hmax; | | real _t0, _dt0, _tmin, _tmax, _a, _hmin, _hmax; | |
| int _Nmodels; | | int _Nmodels; | |
| SphericalHarmonic::normalization _norm; | | SphericalHarmonic::normalization _norm; | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 169 | |
| * computed efficiently. | | * computed efficiently. | |
| * | | * | |
| * @param[in] t the time (years). | | * @param[in] t the time (years). | |
| * @param[in] lat latitude of the point (degrees). | | * @param[in] lat latitude of the point (degrees). | |
| * @param[in] h the height of the point above the ellipsoid (meters). | | * @param[in] h the height of the point above the ellipsoid (meters). | |
| * @return a MagneticCircle object whose MagneticCircle::operator()(rea
l | | * @return a MagneticCircle object whose MagneticCircle::operator()(rea
l | |
| * lon) member function computes the field at particular values of \e | | * lon) member function computes the field at particular values of \e | |
| * lon. | | * lon. | |
| * | | * | |
| * If the field at several points on a circle of latitude need to be | | * If the field at several points on a circle of latitude need to be | |
|
| * calculated then instead of | | * calculated then creating a MagneticCircle and using its member funct | |
| \code | | ions | |
| MagneticModel m(...); // Create a magnetic model | | * will be substantially faster, especially for high-degree models. | |
| double lat = 33, lon0 = 44, dlon = 0.01, h = 1000, t = 2012; | | | |
| for (int i = 0; i <= 100; ++i) { | | | |
| real | | | |
| lon = lon0 + i * dlon, | | | |
| Bx, By, Bz; | | | |
| m(t, lat, lon, h, Bx, By, Bz); | | | |
| std::cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; | | | |
| } | | | |
| \endcode | | | |
| * use a MagneticCircle as in | | | |
| \code | | | |
| MagneticModel m(...); // Create a magnetic model | | | |
| double lat = 33, lon0 = 44, dlon = 0.01, h = 1000, t = 2012; | | | |
| MagneticCircle c(m.Circle(t, lat, h)); // the MagneticCircle object | | | |
| for (int i = 0; i <= 100; ++i) { | | | |
| real | | | |
| lon = lon0 + i * dlon, Bx, By, Bz; | | | |
| c(lon, Bx, By, Bz); | | | |
| std::cout << lon << " " << Bx << " " << By << " " << Bz << "\n"; | | | |
| } | | | |
| \endcode | | | |
| * For high-degree models, this will be substantially faster. | | | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| MagneticCircle Circle(real t, real lat, real h) const; | | MagneticCircle Circle(real t, real lat, real h) const; | |
| | | | |
| /** | | /** | |
| * Compute various quantities dependent on the magnetic field. | | * Compute various quantities dependent on the magnetic field. | |
| * | | * | |
| * @param[in] Bx the \e x (easterly) component of the magnetic field (n
T). | | * @param[in] Bx the \e x (easterly) component of the magnetic field (n
T). | |
| * @param[in] By the \e y (northerly) component of the magnetic field (
nT). | | * @param[in] By the \e y (northerly) component of the magnetic field (
nT). | |
| * @param[in] Bz the \e z (vertical, up positive) component of the magn
etic | | * @param[in] Bz the \e z (vertical, up positive) component of the magn
etic | |
| * field (nT). | | * field (nT). | |
| | | | |
End of changes. 3 change blocks. |
| 26 lines changed or deleted | | 7 lines changed or added | |
|
| Math.hpp | | Math.hpp | |
| | | | |
| skipping to change at line 15 | | skipping to change at line 15 | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| // Constants.hpp includes Math.hpp. Place this include outside Math.hpp's | | // Constants.hpp includes Math.hpp. Place this include outside Math.hpp's | |
| // include guard to enforce this ordering. | | // include guard to enforce this ordering. | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| #if !defined(GEOGRAPHICLIB_MATH_HPP) | | #if !defined(GEOGRAPHICLIB_MATH_HPP) | |
|
| #define GEOGRAPHICLIB_MATH_HPP "$Id: 0bc5689770853cdf3c6dad20eb38980624ffcd
61 $" | | #define GEOGRAPHICLIB_MATH_HPP "$Id: 045fb188fcc3fe808fed0c9d5fa965861d2735
d1 $" | |
| | | | |
| /** | | /** | |
| * Are C++0X math functions available? | | * Are C++0X math functions available? | |
| **********************************************************************/ | | **********************************************************************/ | |
| #if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH) | | #if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH) | |
| # if defined(__GXX_EXPERIMENTAL_CXX0X__) | | # if defined(__GXX_EXPERIMENTAL_CXX0X__) | |
| # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1 | | # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1 | |
| # else | | # else | |
| # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 0 | | # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 0 | |
| # endif | | # endif | |
| | | | |
| skipping to change at line 49 | | skipping to change at line 49 | |
| * same as double. | | * same as double. | |
| **********************************************************************/ | | **********************************************************************/ | |
| #define GEOGRAPHICLIB_PREC 1 | | #define GEOGRAPHICLIB_PREC 1 | |
| #endif | | #endif | |
| | | | |
| #include <cmath> | | #include <cmath> | |
| #include <limits> | | #include <limits> | |
| #include <algorithm> | | #include <algorithm> | |
| #include <vector> | | #include <vector> | |
| | | | |
|
| /** | | | |
| * \brief Namespace for %GeographicLib | | | |
| * | | | |
| * All of %GeographicLib is defined within the GeographicLib namespace. In | | | |
| * addtiion all the header files are included via %GeographicLib/filename. | | | |
| * This minimizes the likelihood of conflicts with other packages. | | | |
| **********************************************************************/ | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Mathematical functions needed by %GeographicLib | | * \brief Mathematical functions needed by %GeographicLib | |
| * | | * | |
| * Define mathematical functions in order to localize system dependencies
and | | * Define mathematical functions in order to localize system dependencies
and | |
| * to provide generic versions of the functions. In addition define a re
al | | * to provide generic versions of the functions. In addition define a re
al | |
| * type to be used by %GeographicLib. | | * type to be used by %GeographicLib. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Math.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT Math { | | class GEOGRAPHIC_EXPORT Math { | |
| private: | | private: | |
| void dummy() { | | void dummy() { | |
| STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2, | | STATIC_ASSERT(GEOGRAPHICLIB_PREC >= 0 && GEOGRAPHICLIB_PREC <= 2, | |
| "Bad value of precision"); | | "Bad value of precision"); | |
| } | | } | |
| Math(); // Disable constructor | | Math(); // Disable constructor | |
| public: | | public: | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 8 lines changed or deleted | | 4 lines changed or added | |
|
| NormalGravity.hpp | | NormalGravity.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file NormalGravity.hpp | | * \file NormalGravity.hpp | |
| * \brief Header for GeographicLib::NormalGravity class | | * \brief Header for GeographicLib::NormalGravity class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_NORMALGRAVITY_HPP) | | #if !defined(GEOGRAPHICLIB_NORMALGRAVITY_HPP) | |
| #define GEOGRAPHICLIB_NORMALGRAVITY_HPP \ | | #define GEOGRAPHICLIB_NORMALGRAVITY_HPP \ | |
|
| "$Id: 20adceb11eddd1504164ead19cbce2f8784826ed $" | | "$Id: e4b65c9c5787d8ee14f476cbb518fd5007006344 $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Geocentric.hpp> | | #include <GeographicLib/Geocentric.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief The normal gravity of the earth | | * \brief The normal gravity of the earth | |
| * | | * | |
| * "Normal" gravity refers to an idealization of the earth which is model
ed | | * "Normal" gravity refers to an idealization of the earth which is model
ed | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| * acceleration; | | * acceleration; | |
| * - \e X, \e Y, \e Z, geocentric coordinates; | | * - \e X, \e Y, \e Z, geocentric coordinates; | |
| * - \e x, \e y, \e z, local cartesian coordinates used to denote the eas
t, | | * - \e x, \e y, \e z, local cartesian coordinates used to denote the eas
t, | |
| * north and up directions. | | * north and up directions. | |
| * | | * | |
| * References: | | * References: | |
| * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San | | * - W. A. Heiskanen and H. Moritz, Physical Geodesy (Freeman, San | |
| * Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3). | | * Francisco, 1967), Secs. 1-19, 2-7, 2-8 (2-9, 2-10), 6-2 (6-3). | |
| * - H. Moritz, Geodetic Reference System 1980, J. Geod. 54(3), 395-405 | | * - H. Moritz, Geodetic Reference System 1980, J. Geod. 54(3), 395-405 | |
| * (1980) http://dx.doi.org/10.1007/BF02521480 | | * (1980) http://dx.doi.org/10.1007/BF02521480 | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-NormalGravity.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT NormalGravity { | | class GEOGRAPHIC_EXPORT NormalGravity { | |
| private: | | private: | |
| static const int maxit_ = 10; | | static const int maxit_ = 10; | |
| typedef Math::real real; | | typedef Math::real real; | |
| friend class GravityModel; | | friend class GravityModel; | |
| real _a, _GM, _omega, _f, _J2, _omega2, _aomega2; | | real _a, _GM, _omega, _f, _J2, _omega2, _aomega2; | |
| real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _q0, _m, _k, _fstar; | | real _e2, _ep2, _b, _E, _U0, _gammae, _gammap, _q0, _m, _k, _fstar; | |
| Geocentric _earth; | | Geocentric _earth; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| OSGB.hpp | | OSGB.hpp | |
| /** | | /** | |
| * \file OSGB.hpp | | * \file OSGB.hpp | |
| * \brief Header for GeographicLib::OSGB class | | * \brief Header for GeographicLib::OSGB class | |
| * | | * | |
| * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | | * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | |
| * under the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_OSGB_HPP) | | #if !defined(GEOGRAPHICLIB_OSGB_HPP) | |
|
| #define GEOGRAPHICLIB_OSGB_HPP "$Id: 62fc66a3aeb0c2ac3e65b3de36063530995014
20 $" | | #define GEOGRAPHICLIB_OSGB_HPP "$Id: a8dbde4065691daa15563ea55c23eab4b7d8e9
67 $" | |
| | | | |
| #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 42 | | skipping to change at line 42 | |
| * See | | * See | |
| * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/docs/A_Guide_
to_Coordinate_Systems_in_Great_Britain.pdf"> | | * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/docs/A_Guide_
to_Coordinate_Systems_in_Great_Britain.pdf"> | |
| * A guide to coordinate systems in Great Britain</a> | | * A guide to coordinate systems in Great Britain</a> | |
| * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/information/c
oordinatesystemsinfo/guidetonationalgrid/page1.html"> | | * - <a href="http://www.ordnancesurvey.co.uk/oswebsite/gps/information/c
oordinatesystemsinfo/guidetonationalgrid/page1.html"> | |
| * Guide to National Grid</a> | | * Guide to National Grid</a> | |
| * | | * | |
| * \b WARNING: the latitudes and longitudes for the Ordnance Survey grid | | * \b WARNING: the latitudes and longitudes for the Ordnance Survey grid | |
| * system do not use the WGS84 datum. Do not use the values returned by
this | | * system do not use the WGS84 datum. Do not use the values returned by
this | |
| * class in the UTMUPS, MGRS, or Geoid classes without first converting t
he | | * class in the UTMUPS, MGRS, or Geoid classes without first converting t
he | |
| * datum (and vice versa). | | * datum (and vice versa). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-OSGB.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT OSGB { | | class GEOGRAPHIC_EXPORT OSGB { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| static const std::string letters_; | | static const std::string letters_; | |
| static const std::string digits_; | | static const std::string digits_; | |
| static const TransverseMercator OSGBTM_; | | static const TransverseMercator OSGBTM_; | |
| static const real northoffset_; | | static const real northoffset_; | |
| enum { | | enum { | |
| base_ = 10, | | base_ = 10, | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| PolarStereographic.hpp | | PolarStereographic.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) | | #if !defined(GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP) | |
| #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP \ | | #define GEOGRAPHICLIB_POLARSTEREOGRAPHIC_HPP \ | |
|
| "$Id: 53979440f6d23cf95aefe41a2b9ccb8eedf5b811 $" | | "$Id: 4bd816aed80f08d9369cd9fee96df0db2f9eedb6 $" | |
| | | | |
| #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, | |
| * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection
s: A | | * <a href="http://pubs.er.usgs.gov/usgspubs/pp/pp1395"> Map Projection
s: A | |
| * Working Manual</a>, USGS Professional Paper 1395 (1987), | | * Working Manual</a>, USGS Professional Paper 1395 (1987), | |
| * pp. 160–163. | | * pp. 160–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. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-PolarStereographic.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| 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 | |
| real _a, _f, _e2, _e, _e2m, _Cx, _c; | | real _a, _f, _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; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| PolygonArea.hpp | | PolygonArea.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file PolygonArea.hpp | | * \file PolygonArea.hpp | |
| * \brief Header for GeographicLib::PolygonArea class | | * \brief Header for GeographicLib::PolygonArea class | |
| * | | * | |
| * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | | * Copyright (c) Charles Karney (2010, 2011) <charles@karney.com> and licen
sed | |
| * under the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) | | #if !defined(GEOGRAPHICLIB_POLYGONAREA_HPP) | |
| #define GEOGRAPHICLIB_POLYGONAREA_HPP \ | | #define GEOGRAPHICLIB_POLYGONAREA_HPP \ | |
|
| "$Id: c6b922a70d4f5ea75580f4e2746a2148b288a03e $" | | "$Id: 8c532d61c2cec114c7bf224b2f80a1c249748f1b $" | |
| | | | |
| #include <GeographicLib/Geodesic.hpp> | | #include <GeographicLib/Geodesic.hpp> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Accumulator.hpp> | | #include <GeographicLib/Accumulator.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Polygon Areas. | | * \brief Polygon Areas. | |
| * | | * | |
| | | | |
| skipping to change at line 45 | | skipping to change at line 45 | |
| * Sept. 2011; | | * Sept. 2011; | |
| * preprint | | * preprint | |
| * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | | * <a href="http://arxiv.org/abs/1109.4448">arxiv:1109.4448</a>. | |
| * | | * | |
| * This class lets you add vertices one at a time to the polygon. The ar
ea | | * This class lets you add vertices one at a time to the polygon. The ar
ea | |
| * and perimeter are accumulated in two times the standard floating point | | * and perimeter are accumulated in two times the standard floating point | |
| * precision to guard against the loss of accuracy with many-sided polygo
ns. | | * precision to guard against the loss of accuracy with many-sided polygo
ns. | |
| * At any point you can ask for the perimeter and area so far. There's a
n | | * At any point you can ask for the perimeter and area so far. There's a
n | |
| * option to treat the points as defining a polyline instead of a polygon
; in | | * option to treat the points as defining a polyline instead of a polygon
; in | |
| * that case, only the perimeter is computed. | | * that case, only the perimeter is computed. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-PolygonArea.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT PolygonArea { | | class GEOGRAPHIC_EXPORT PolygonArea { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| Geodesic _earth; | | Geodesic _earth; | |
| real _area0; // Full ellipsoid area | | real _area0; // Full ellipsoid area | |
| bool _polyline; // Assume polyline (don't close and skip ar
ea) | | bool _polyline; // Assume polyline (don't close and skip ar
ea) | |
| unsigned _mask; | | unsigned _mask; | |
| unsigned _num; | | unsigned _num; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| SphericalEngine.hpp | | SphericalEngine.hpp | |
| /** | | /** | |
| * \file SphericalEngine.hpp | | * \file SphericalEngine.hpp | |
| * \brief Header for GeographicLib::SphericalEngine class | | * \brief Header for GeographicLib::SphericalEngine class | |
| * | | * | |
|
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un | | * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licen | |
| der | | sed | |
| * the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_SPHERICALENGINE_HPP) | | #if !defined(GEOGRAPHICLIB_SPHERICALENGINE_HPP) | |
| #define GEOGRAPHICLIB_SPHERICALENGINE_HPP \ | | #define GEOGRAPHICLIB_SPHERICALENGINE_HPP \ | |
|
| "$Id: 3410576dbc0276f23077ba3662817e14981ab919 $" | | "$Id: dae9ba0d660c070c0f28715de87ed20f79808793 $" | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <istream> | | #include <istream> | |
| #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) | |
| #endif | | #endif | |
| | | | |
| skipping to change at line 36 | | skipping to change at line 36 | |
| class CircularEngine; | | class CircularEngine; | |
| | | | |
| /** | | /** | |
| * \brief The evaluation engine for SphericalHarmonic | | * \brief The evaluation engine for SphericalHarmonic | |
| * | | * | |
| * This serves as the backend to SphericalHarmonic, SphericalHarmonic1, a
nd | | * This serves as the backend to SphericalHarmonic, SphericalHarmonic1, a
nd | |
| * SphericalHarmonic2. Typically end-users will not have to access this | | * SphericalHarmonic2. Typically end-users will not have to access this | |
| * class directly. | | * class directly. | |
| * | | * | |
| * See SphericalEngine.cpp for more information on the implementation. | | * See SphericalEngine.cpp for more information on the implementation. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-SphericalEngine.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT SphericalEngine { | | class GEOGRAPHIC_EXPORT SphericalEngine { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| // A table of the square roots of integers | | // A table of the square roots of integers | |
| static std::vector<real> root_; | | static std::vector<real> root_; | |
| friend class CircularEngine; // CircularEngine needs access to root_, s
cale_ | | friend class CircularEngine; // CircularEngine needs access to root_, s
cale_ | |
| // An internal scaling of the coefficients to avoid overflow in | | // An internal scaling of the coefficients to avoid overflow in | |
| // intermediate calculations. | | // intermediate calculations. | |
| | | | |
| skipping to change at line 317 | | skipping to change at line 320 | |
| * @param[in] a the normalizing radius. | | * @param[in] a the normalizing radius. | |
| * @result the CircularEngine object. | | * @result the CircularEngine object. | |
| * | | * | |
| * If you need to evaluate the spherical harmonic sum for several point
s | | * If you need to evaluate the spherical harmonic sum for several point
s | |
| * with constant \e f, \e p = sqrt(<i>x</i><sup>2</sup> + | | * with constant \e f, \e p = sqrt(<i>x</i><sup>2</sup> + | |
| * <i>y</i><sup>2</sup>), \e z, and \e a, it is more efficient to const
ruct | | * <i>y</i><sup>2</sup>), \e z, and \e a, it is more efficient to const
ruct | |
| * call SphericalEngine::Circle to give a CircularEngine object and the
n | | * call SphericalEngine::Circle to give a CircularEngine object and the
n | |
| * call CircularEngine::operator()() with arguments <i>x</i>/\e p and | | * call CircularEngine::operator()() with arguments <i>x</i>/\e p and | |
| * <i>y</i>/\e p. | | * <i>y</i>/\e p. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| template<bool gradp, SphericalEngine::normalization norm, int L> | | template<bool gradp, normalization norm, int L> | |
| static CircularEngine Circle(const coeff c[], const real f[], | | static CircularEngine Circle(const coeff c[], const real f[], | |
| real p, real z, real a); | | real p, real z, real a); | |
| /** | | /** | |
| * Check that the static table of square roots is big enough and enlarg
e it | | * Check that the static table of square roots is big enough and enlarg
e it | |
| * if necessary. | | * if necessary. | |
| * | | * | |
| * @param[in] N the maximum degree to be used in SphericalEngine. | | * @param[in] N the maximum degree to be used in SphericalEngine. | |
| * | | * | |
| * Typically, there's no need for an end-user to call this routine, bec
ause | | * Typically, there's no need for an end-user to call this routine, bec
ause | |
| * the constructors for SphericalEngine::coeff do so. However, since t
his | | * the constructors for SphericalEngine::coeff do so. However, since t
his | |
| | | | |
End of changes. 4 change blocks. |
| 5 lines changed or deleted | | 8 lines changed or added | |
|
| SphericalHarmonic.hpp | | SphericalHarmonic.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file SphericalHarmonic.hpp | | * \file SphericalHarmonic.hpp | |
| * \brief Header for GeographicLib::SphericalHarmonic class | | * \brief Header for GeographicLib::SphericalHarmonic class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC_HPP) | | #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC_HPP) | |
| #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP \ | | #define GEOGRAPHICLIB_SPHERICALHARMONIC_HPP \ | |
|
| "$Id: 12b23c05ab8bae57213d6762e45189a7cb46b397 $" | | "$Id: cd1abfd4b08774a17c141bb6fbb07b04d4658791 $" | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/SphericalEngine.hpp> | | #include <GeographicLib/SphericalEngine.hpp> | |
| #include <GeographicLib/CircularEngine.hpp> | | #include <GeographicLib/CircularEngine.hpp> | |
| #include <GeographicLib/Geocentric.hpp> | | #include <GeographicLib/Geocentric.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 61 | | skipping to change at line 61 | |
| * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics | | * - R. E. Deakin, Derivatives of the earth's potentials, Geomatics | |
| * Research Australasia 68, 31-60, (June 1998). | | * Research Australasia 68, 31-60, (June 1998). | |
| * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San | | * - W. A. Heiskanen and H. Moritz, Physical Geodesy, (Freeman, San | |
| * Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.) | | * Francisco, 1967). (See Sec. 1-14, for a definition of Pbar.) | |
| * - S. A. Holmes and W. E. Featherstone, A unified approach to the | | * - S. A. Holmes and W. E. Featherstone, A unified approach to the | |
| * Clenshaw summation and the recursive computation of very high degree | | * Clenshaw summation and the recursive computation of very high degree | |
| * and order normalised associated Legendre functions, J. Geod. 76(5), | | * and order normalised associated Legendre functions, J. Geod. 76(5), | |
| * 279-299 (2002). | | * 279-299 (2002). | |
| * - C. C. Tscherning and K. Poder, Some geodetic applications of Clensha
w | | * - C. C. Tscherning and K. Poder, Some geodetic applications of Clensha
w | |
| * summation, Boll. Geod. Sci. Aff. 41(4), 349-375 (1982). | | * summation, Boll. Geod. Sci. Aff. 41(4), 349-375 (1982). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-SphericalHarmonic.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT SphericalHarmonic { | | class GEOGRAPHIC_EXPORT SphericalHarmonic { | |
| public: | | public: | |
| /** | | /** | |
| * Supported normalizations for the associated Legendre polynomials. | | * Supported normalizations for the associated Legendre polynomials. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| enum normalization { | | enum normalization { | |
| /** | | /** | |
| * Fully normalized associated Legendre polynomials. | | * Fully normalized associated Legendre polynomials. | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 138 | |
| * @param[in] S the coefficients \e S<sub>\e nm</sub>. | | * @param[in] S the coefficients \e S<sub>\e nm</sub>. | |
| * @param[in] N the maximum degree and order of the sum | | * @param[in] N the maximum degree and order of the sum | |
| * @param[in] a the reference radius appearing in the definition of the | | * @param[in] a the reference radius appearing in the definition of the | |
| * sum. | | * sum. | |
| * @param[in] norm the normalization for the associated Legendre | | * @param[in] norm the normalization for the associated Legendre | |
| * polynomials, either SphericalHarmonic::full (the default) or | | * polynomials, either SphericalHarmonic::full (the default) or | |
| * SphericalHarmonic::schmidt. | | * SphericalHarmonic::schmidt. | |
| * | | * | |
| * The coefficients \e C<sub>\e nm</sub> and \e S<sub>\e nm</sub> are | | * The coefficients \e C<sub>\e nm</sub> and \e S<sub>\e nm</sub> are | |
| * stored in the one-dimensional vectors \e C and \e S which must conta
in | | * stored in the one-dimensional vectors \e C and \e S which must conta
in | |
|
| * (\e N + 1)(\e N + 2)/2 elements, stored in "column-major" order. Th | | * (\e N + 1)(\e N + 2)/2 and N (\e N + 1)/2 elements, respectively, st | |
| us | | ored | |
| * for \e N = 3, the order would be: | | * in "column-major" order. Thus for \e N = 3, the order would be: | |
| * <i>C</i><sub>00</sub>, | | * <i>C</i><sub>00</sub>, | |
| * <i>C</i><sub>10</sub>, | | * <i>C</i><sub>10</sub>, | |
| * <i>C</i><sub>20</sub>, | | * <i>C</i><sub>20</sub>, | |
| * <i>C</i><sub>30</sub>, | | * <i>C</i><sub>30</sub>, | |
| * <i>C</i><sub>11</sub>, | | * <i>C</i><sub>11</sub>, | |
| * <i>C</i><sub>21</sub>, | | * <i>C</i><sub>21</sub>, | |
| * <i>C</i><sub>31</sub>, | | * <i>C</i><sub>31</sub>, | |
| * <i>C</i><sub>22</sub>, | | * <i>C</i><sub>22</sub>, | |
| * <i>C</i><sub>32</sub>, | | * <i>C</i><sub>32</sub>, | |
| * <i>C</i><sub>33</sub>. | | * <i>C</i><sub>33</sub>. | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 7 lines changed or added | |
|
| SphericalHarmonic1.hpp | | SphericalHarmonic1.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file SphericalHarmonic1.hpp | | * \file SphericalHarmonic1.hpp | |
| * \brief Header for GeographicLib::SphericalHarmonic1 class | | * \brief Header for GeographicLib::SphericalHarmonic1 class | |
| * | | * | |
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | | * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un
der | |
| * the MIT/X11 License. For more information, see | | * the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP) | | #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP) | |
| #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP \ | | #define GEOGRAPHICLIB_SPHERICALHARMONIC1_HPP \ | |
|
| "$Id: f873848926021872a17b732171bb0bbbba1bb520 $" | | "$Id: 9dd895ded08db0f7fdd82159399da511f40a17e1 $" | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/SphericalEngine.hpp> | | #include <GeographicLib/SphericalEngine.hpp> | |
| #include <GeographicLib/CircularEngine.hpp> | | #include <GeographicLib/CircularEngine.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Spherical Harmonic series with a correction to the coefficients
. | | * \brief Spherical Harmonic series with a correction to the coefficients
. | |
| * | | * | |
| * This classes is similar to SphericalHarmonic, except that the coeffici
ents | | * This classes is similar to SphericalHarmonic, except that the coeffici
ents | |
| * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau | | * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau | |
| * C'<sub>\e nm</sub> (and similarly for \e S<sub>\e nm</sub>). | | * C'<sub>\e nm</sub> (and similarly for \e S<sub>\e nm</sub>). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-SphericalHarmonic1.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT SphericalHarmonic1 { | | class GEOGRAPHIC_EXPORT SphericalHarmonic1 { | |
| public: | | public: | |
| /** | | /** | |
| * Supported normalizations for associate Legendre polynomials. | | * Supported normalizations for associate Legendre polynomials. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| enum normalization { | | enum normalization { | |
| /** | | /** | |
| * Fully normalized associated Legendre polynomials. See | | * Fully normalized associated Legendre polynomials. See | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| SphericalHarmonic2.hpp | | SphericalHarmonic2.hpp | |
| /** | | /** | |
| * \file SphericalHarmonic2.hpp | | * \file SphericalHarmonic2.hpp | |
| * \brief Header for GeographicLib::SphericalHarmonic2 class | | * \brief Header for GeographicLib::SphericalHarmonic2 class | |
| * | | * | |
|
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un | | * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licen | |
| der | | sed | |
| * the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP) | | #if !defined(GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP) | |
| #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP \ | | #define GEOGRAPHICLIB_SPHERICALHARMONIC2_HPP \ | |
|
| "$Id: eb59f9ca6566eedfb06c24652873a69e4784f302 $" | | "$Id: ce4cda614c1966dea65610bc73bc4db562677fa8 $" | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/SphericalEngine.hpp> | | #include <GeographicLib/SphericalEngine.hpp> | |
|
| | | #include <GeographicLib/CircularEngine.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Spherical Harmonic series with two corrections to the coefficie
nts. | | * \brief Spherical Harmonic series with two corrections to the coefficie
nts. | |
| * | | * | |
| * This classes is similar to SphericalHarmonic, except that the coeffici
ents | | * This classes is similar to SphericalHarmonic, except that the coeffici
ents | |
| * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau' | | * \e C<sub>\e nm</sub> are replaced by \e C<sub>\e nm</sub> + \e tau' | |
| * C'<sub>\e nm</sub> + \e tau'' C''<sub>\e nm</sub> (and similarly for \
e | | * C'<sub>\e nm</sub> + \e tau'' C''<sub>\e nm</sub> (and similarly for \
e | |
| * S<sub>\e nm</sub>). | | * S<sub>\e nm</sub>). | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-SphericalHarmonic2.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT SphericalHarmonic2 { | | class GEOGRAPHIC_EXPORT SphericalHarmonic2 { | |
| public: | | public: | |
| /** | | /** | |
| * Supported normalizations for associate Legendre polynomials. | | * Supported normalizations for associate Legendre polynomials. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| enum normalization { | | enum normalization { | |
| /** | | /** | |
| * Fully normalized associated Legendre polynomials. See | | * Fully normalized associated Legendre polynomials. See | |
| | | | |
| skipping to change at line 60 | | skipping to change at line 64 | |
| // These are deprecated... | | // These are deprecated... | |
| full = FULL, | | full = FULL, | |
| schmidt = SCHMIDT, | | schmidt = SCHMIDT, | |
| /// \endcond | | /// \endcond | |
| }; | | }; | |
| | | | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| SphericalEngine::coeff _c[3]; | | SphericalEngine::coeff _c[3]; | |
| real _a; | | real _a; | |
|
| normalization _norm; | | unsigned _norm; | |
| | | | |
| public: | | public: | |
| /** | | /** | |
| * Constructor with a full set of coefficients specified. | | * Constructor with a full set of coefficients specified. | |
| * | | * | |
| * @param[in] C the coefficients \e C<sub>\e nm</sub>. | | * @param[in] C the coefficients \e C<sub>\e nm</sub>. | |
| * @param[in] S the coefficients \e S<sub>\e nm</sub>. | | * @param[in] S the coefficients \e S<sub>\e nm</sub>. | |
| * @param[in] N the maximum degree and order of the sum | | * @param[in] N the maximum degree and order of the sum | |
| * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>. | | * @param[in] C1 the coefficients \e C'<sub>\e nm</sub>. | |
| * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>. | | * @param[in] S1 the coefficients \e S'<sub>\e nm</sub>. | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 9 lines changed or added | |
|
| TransverseMercator.hpp | | TransverseMercator.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) | | #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP) | |
| #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP \ | | #define GEOGRAPHICLIB_TRANSVERSEMERCATOR_HPP \ | |
|
| "$Id: 532c4a657f0355a74397cee3b87ab8f686205526 $" | | "$Id: 565dc83110421e3bc14d7f402359c850c6649c57 $" | |
| | | | |
| #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 45 | | skipping to change at line 45 | |
| * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute,
New | | * ellipsoidal earth to the plane), Royal Prussian Geodetic Institute,
New | |
| * Series 52, 172 pp. (1912). | | * Series 52, 172 pp. (1912). | |
| * - C. F. F. Karney, | | * - C. F. F. Karney, | |
| * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> | | * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> | |
| * Transverse Mercator with an accuracy of a few nanometers,</a> | | * Transverse Mercator with an accuracy of a few nanometers,</a> | |
| * J. Geodesy 85(8), 475-485 (Aug. 2011); | | * J. Geodesy 85(8), 475-485 (Aug. 2011); | |
| * preprint | | * preprint | |
| * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. | | * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. | |
| * | | * | |
| * Krüger's method has been extended from 4th to 6th order. The max
imum | | * Krüger's method has been extended from 4th to 6th order. The max
imum | |
|
| * errors is 5 nm (ground distance) for all positions within 35 degrees o | | * error is 5 nm (5 nanometers), ground distance, for all positions withi | |
| f | | n 35 | |
| * the central meridian. The error in the convergence is 2e-15" and | | * degrees of the central meridian. The error in the convergence is | |
| the | | * 2e-15" and the relative error in the scale is 6e-12%%. See Sec. | |
| * relative error in the scale is 6e-12%%. See Sec. 4 of | | 4 of | |
| * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai
ls. | | * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai
ls. | |
| * The speed penalty in going to 6th order is only about 1%. | | * The speed penalty in going to 6th order is only about 1%. | |
| * TransverseMercatorExact is an alternative implementation of the projec
tion | | * TransverseMercatorExact is an alternative implementation of the projec
tion | |
| * using exact formulas which yield accurate (to 8 nm) results over the | | * using exact formulas which yield accurate (to 8 nm) results over the | |
| * entire ellipsoid. | | * entire ellipsoid. | |
| * | | * | |
| * The ellipsoid parameters and the central scale are set in the construc
tor. | | * The ellipsoid parameters and the central scale are set in the construc
tor. | |
| * The central meridian (which is a trivial shift of the longitude) is | | * The central meridian (which is a trivial shift of the longitude) is | |
| * specified as the \e lon0 argument of the TransverseMercator::Forward a
nd | | * specified as the \e lon0 argument of the TransverseMercator::Forward a
nd | |
| * TransverseMercator::Reverse functions. The latitude of origin is take
n to | | * TransverseMercator::Reverse functions. The latitude of origin is take
n to | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| * However these are can be simply included by the calling function. For | | * However these are can be simply included by the calling function. For | |
| * example, the UTMUPS class applies the false easting and false northing
for | | * example, the UTMUPS class applies the false easting and false northing
for | |
| * the UTM projections. A more complicated example is the British Nation
al | | * the UTM projections. A more complicated example is the British Nation
al | |
| * Grid (<a href="http://www.spatialreference.org/ref/epsg/7405/"> | | * Grid (<a href="http://www.spatialreference.org/ref/epsg/7405/"> | |
| * EPSG:7405</a>) which requires the use of a latitude of origin. This i
s | | * EPSG:7405</a>) which requires the use of a latitude of origin. This i
s | |
| * implemented by the GeographicLib::OSGB class. | | * implemented by the GeographicLib::OSGB class. | |
| * | | * | |
| * See TransverseMercator.cpp for more information on the implementation. | | * See TransverseMercator.cpp for more information on the implementation. | |
| * | | * | |
| * See \ref transversemercator for a discussion of this projection. | | * See \ref transversemercator for a discussion of this projection. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-TransverseMercator.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| 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; | |
| real _a, _f, _k0, _e2, _e, _e2m, _c, _n; | | real _a, _f, _k0, _e2, _e, _e2m, _c, _n; | |
| | | | |
End of changes. 3 change blocks. |
| 6 lines changed or deleted | | 9 lines changed or added | |
|
| TransverseMercatorExact.hpp | | TransverseMercatorExact.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \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 MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) | | #if !defined(GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP) | |
| #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP \ | | #define GEOGRAPHICLIB_TRANSVERSEMERCATOREXACT_HPP \ | |
|
| "$Id: 85d1d4b68c9f3d093838ba3801adbf038c4a1391 $" | | "$Id: 6e85377964a67cffd3f69758de39a7a1d9aae42a $" | |
| | | | |
| #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 38 | | skipping to change at line 38 | |
| * ISBN: 0919870163 | | * ISBN: 0919870163 | |
| * (also appeared as: | | * (also appeared as: | |
| * Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13). | | * Monograph 16, Suppl. No. 1 to Canadian Cartographer, Vol 13). | |
| * - C. F. F. Karney, | | * - C. F. F. Karney, | |
| * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> | | * <a href="http://dx.doi.org/10.1007/s00190-011-0445-3"> | |
| * Transverse Mercator with an accuracy of a few nanometers,</a> | | * Transverse Mercator with an accuracy of a few nanometers,</a> | |
| * J. Geodesy 85(8), 475-485 (Aug. 2011); | | * J. Geodesy 85(8), 475-485 (Aug. 2011); | |
| * preprint | | * preprint | |
| * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. | | * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a>. | |
| * | | * | |
|
| * Lee's gives the correct results for forward and reverse | | * Lee gives the correct results for forward and reverse transformations | |
| * transformations subject to the branch cut rules (see the description o | | * subject to the branch cut rules (see the description of the \e extendp | |
| f | | * argument to the constructor). The maximum error is about 8 nm (8 | |
| * the \e extendp argument to the constructor). The maximum error is abo | | * nanometers), ground distance, for the forward and reverse transformati | |
| ut 8 | | ons. | |
| * nm (ground distance) for the forward and reverse transformations. The | | * The error in the convergence is 2e-15", the relative error in the | |
| * error in the convergence is 2e-15", the relative error in the sca | | * scale is 7e-12%%. See Sec. 3 of | |
| le | | | |
| * is 7e-12%%. See Sec. 3 of | | | |
| * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai
ls. | | * <a href="http://arxiv.org/abs/1002.1417">arXiv:1002.1417</a> for detai
ls. | |
| * The method is "exact" in the sense that the errors are close to the | | * The method is "exact" in the sense that the errors are close to the | |
| * round-off limit and that no changes are needed in the algorithms for t
hem | | * round-off limit and that no changes are needed in the algorithms for t
hem | |
| * to be used with reals of a higher precision. Thus the errors using lo
ng | | * to be used with reals of a higher precision. Thus the errors using lo
ng | |
| * double (with a 64-bit fraction) are about 2000 times smaller than usin
g | | * double (with a 64-bit fraction) are about 2000 times smaller than usin
g | |
| * double (with a 53-bit fraction). | | * double (with a 53-bit fraction). | |
| * | | * | |
| * This algorithm is about 4.5 times slower than the 6th-order Krüge
r | | * This algorithm is about 4.5 times slower than the 6th-order Krüge
r | |
| * method, TransverseMercator, taking about 11 us for a combined forward
and | | * method, TransverseMercator, taking about 11 us for a combined forward
and | |
| * reverse projection on a 2.66 GHz Intel machine (g++, version 4.3.0, -O
3). | | * reverse projection on a 2.66 GHz Intel machine (g++, version 4.3.0, -O
3). | |
| | | | |
| skipping to change at line 70 | | skipping to change at line 70 | |
| * how to include a false easting, false northing, or a latitude of origi
n. | | * how to include a false easting, false northing, or a latitude of origi
n. | |
| * | | * | |
| * See <a href="http://geographiclib.sourceforge.net/tm-grid.kmz" | | * See <a href="http://geographiclib.sourceforge.net/tm-grid.kmz" | |
| * type="application/vnd.google-earth.kmz"> tm-grid.kmz</a>, for an | | * type="application/vnd.google-earth.kmz"> tm-grid.kmz</a>, for an | |
| * illustration of the transverse Mercator grid in Google Earth. | | * illustration of the transverse Mercator grid in Google Earth. | |
| * | | * | |
| * See TransverseMercatorExact.cpp for more information on the | | * See TransverseMercatorExact.cpp for more information on the | |
| * implementation. | | * implementation. | |
| * | | * | |
| * See \ref transversemercator for a discussion of this projection. | | * See \ref transversemercator for a discussion of this projection. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-TransverseMercatorExact.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| 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_; | |
| | | | |
End of changes. 3 change blocks. |
| 10 lines changed or deleted | | 11 lines changed or added | |
|
| UTMUPS.hpp | | UTMUPS.hpp | |
| | | | |
| skipping to change at line 12 | | skipping to change at line 12 | |
| * \file UTMUPS.hpp | | * \file UTMUPS.hpp | |
| * \brief Header for GeographicLib::UTMUPS class | | * \brief Header for GeographicLib::UTMUPS class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
| * and licensed under the MIT/X11 License. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_UTMUPS_HPP) | | #if !defined(GEOGRAPHICLIB_UTMUPS_HPP) | |
| #define GEOGRAPHICLIB_UTMUPS_HPP \ | | #define GEOGRAPHICLIB_UTMUPS_HPP \ | |
|
| "$Id: bfc2e2a500d4adf0cae87cbeaf4e3753e20b3019 $" | | "$Id: 617b521c07044fd4d88b74e716ba7751fb1fdfdc $" | |
| | | | |
| #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 59 | | skipping to change at line 59 | |
| * coordinates these ranges have been extended by 100km in order to provi
de a | | * coordinates these ranges have been extended by 100km in order to provi
de a | |
| * generous overlap between UTM and UPS and between UTM zones. | | * generous overlap between UTM and UPS and between UTM zones. | |
| * | | * | |
| * 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 UTM and UPS. Version 2.4.2 (and | | * also provides conversions to and from UTM and UPS. Version 2.4.2 (and | |
| * earlier) suffers from some drawbacks: | | * earlier) suffers from some drawbacks: | |
| * - Inconsistent rules are used to determine the whether a particular UT
M or | | * - Inconsistent rules are used to determine the whether a particular UT
M or | |
| * UPS coordinate is legal. A more systematic approach is taken here. | | * UPS coordinate is legal. A more systematic approach is taken here. | |
| * - The underlying projections are not very accurately implemented. | | * - The underlying projections are not very accurately implemented. | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-UTMUPS.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT UTMUPS { | | class GEOGRAPHIC_EXPORT UTMUPS { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| static const real falseeasting_[4]; | | static const real falseeasting_[4]; | |
| static const real falsenorthing_[4]; | | static const real falsenorthing_[4]; | |
| static const real mineasting_[4]; | | static const real mineasting_[4]; | |
| static const real maxeasting_[4]; | | static const real maxeasting_[4]; | |
| static const real minnorthing_[4]; | | static const real minnorthing_[4]; | |
| static const real maxnorthing_[4]; | | static const real maxnorthing_[4]; | |
| | | | |
End of changes. 2 change blocks. |
| 1 lines changed or deleted | | 4 lines changed or added | |
|
| Utility.hpp | | Utility.hpp | |
| /** | | /** | |
| * \file Utility.hpp | | * \file Utility.hpp | |
| * \brief Header for GeographicLib::Utility class | | * \brief Header for GeographicLib::Utility class | |
| * | | * | |
|
| * Copyright (c) Charles Karney (2011) <charles@karney.com> and licensed un | | * Copyright (c) Charles Karney (2011, 2012) <charles@karney.com> and licen | |
| der | | sed | |
| * the MIT/X11 License. For more information, see | | * under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_UTILITY_HPP) | | #if !defined(GEOGRAPHICLIB_UTILITY_HPP) | |
| #define GEOGRAPHICLIB_UTILITY_HPP \ | | #define GEOGRAPHICLIB_UTILITY_HPP \ | |
|
| "$Id: a4a9a65ef1b4dc72579b2310257cde0d626480a5 $" | | "$Id: 8a1cdf4f0de95da280d56bbf8ea299dad043f0b2 $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <iomanip> | | #include <iomanip> | |
| #include <vector> | | #include <vector> | |
| #include <string> | | #include <string> | |
| #include <sstream> | | #include <sstream> | |
| #include <algorithm> | | #include <algorithm> | |
| #include <cctype> | | #include <cctype> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Some utility routines for %GeographicLib | | * \brief Some utility routines for %GeographicLib | |
|
| | | * | |
| | | * Example of use: | |
| | | * \include example-Utility.cpp | |
| **********************************************************************/ | | **********************************************************************/ | |
| class GEOGRAPHIC_EXPORT Utility { | | class GEOGRAPHIC_EXPORT Utility { | |
| private: | | private: | |
| static bool gregorian(int y, int m, int d) { | | static bool gregorian(int y, int m, int d) { | |
| // The original cut over to the Gregorian calendar in Pope Gregory XI
II's | | // The original cut over to the Gregorian calendar in Pope Gregory XI
II's | |
| // time had 1582-10-04 followed by 1582-10-15. Here we implement the | | // time had 1582-10-04 followed by 1582-10-15. Here we implement the | |
| // switch over used by the English-speaking world where 1752-09-02 wa
s | | // switch over used by the English-speaking world where 1752-09-02 wa
s | |
| // followed by 1752-09-14. We also assume that the year always begins | | // followed by 1752-09-14. We also assume that the year always begins | |
| // with January 1, whereas in reality it often was reckoned to begin
in | | // with January 1, whereas in reality it often was reckoned to begin
in | |
| // March. | | // March. | |
| | | | |
| skipping to change at line 379 | | skipping to change at line 382 | |
| static inline void readarray(std::istream& str, | | static inline void readarray(std::istream& str, | |
| IntT array[], size_t num) { | | IntT array[], size_t num) { | |
| if (sizeof(IntT) == sizeof(ExtT) && | | if (sizeof(IntT) == sizeof(ExtT) && | |
| std::numeric_limits<IntT>::is_integer == | | std::numeric_limits<IntT>::is_integer == | |
| std::numeric_limits<ExtT>::is_integer) { | | std::numeric_limits<ExtT>::is_integer) { | |
| // Data is compatible (aside from the issue of endian-ness). | | // Data is compatible (aside from the issue of endian-ness). | |
| str.read(reinterpret_cast<char *>(array), num * sizeof(ExtT)); | | str.read(reinterpret_cast<char *>(array), num * sizeof(ExtT)); | |
| if (!str.good()) | | if (!str.good()) | |
| throw GeographicErr("Failure reading data"); | | throw GeographicErr("Failure reading data"); | |
| if (bigendp != Math::bigendian) { // endian mismatch -> swap bytes | | if (bigendp != Math::bigendian) { // endian mismatch -> swap bytes | |
|
| for (int i = num; i--;) | | for (size_t i = num; i--;) | |
| array[i] = Math::swab<IntT>(array[i]); | | array[i] = Math::swab<IntT>(array[i]); | |
| } | | } | |
| } else { | | } else { | |
| const int bufsize = 1024; // read this many values at a time | | const int bufsize = 1024; // read this many values at a time | |
| ExtT buffer[bufsize]; // temporary buffer | | ExtT buffer[bufsize]; // temporary buffer | |
| int k = int(num); // data values left to read | | int k = int(num); // data values left to read | |
| int i = 0; // index into output array | | int i = 0; // index into output array | |
| while (k) { | | while (k) { | |
|
| int num = (std::min)(k, bufsize); | | int n = (std::min)(k, bufsize); | |
| str.read(reinterpret_cast<char *>(buffer), num * sizeof(ExtT)); | | str.read(reinterpret_cast<char *>(buffer), n * sizeof(ExtT)); | |
| if (!str.good()) | | if (!str.good()) | |
| throw GeographicErr("Failure reading data"); | | throw GeographicErr("Failure reading data"); | |
|
| for (int j = 0; j < num; ++j) | | for (int j = 0; j < n; ++j) | |
| // fix endian-ness and cast to IntT | | // fix endian-ness and cast to IntT | |
| array[i++] = IntT(bigendp == Math::bigendian ? buffer[j] : | | array[i++] = IntT(bigendp == Math::bigendian ? buffer[j] : | |
| Math::swab<IntT>(buffer[j])); | | Math::swab<IntT>(buffer[j])); | |
|
| k -= num; | | k -= n; | |
| } | | } | |
| } | | } | |
| return; | | return; | |
| } | | } | |
| | | | |
| /** | | /** | |
| * Read data of type ExtT from a binary stream to a vector array of typ
e | | * Read data of type ExtT from a binary stream to a vector array of typ
e | |
| * IntT. The data in the file is in (bigendp ? big : little)-endian | | * IntT. The data in the file is in (bigendp ? big : little)-endian | |
| * format. | | * format. | |
| * | | * | |
| | | | |
End of changes. 7 change blocks. |
| 9 lines changed or deleted | | 12 lines changed or added | |
|