| CassiniSoldner.hpp | | CassiniSoldner.hpp | |
| /** | | /** | |
| * \file CassiniSoldner.hpp | | * \file CassiniSoldner.hpp | |
| * \brief Header for GeographicLib::CassiniSoldner class | | * \brief Header for GeographicLib::CassiniSoldner class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> and | |
|
| * licensed under the LGPL. For more information, see | | * licensed under the 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 "$Id: 4ef919febf6e2388065e651dd606
b0bf3b7443ce $" | | #define GEOGRAPHICLIB_CASSINISOLDNER_HPP "$Id: ffa72d53546c2066064723afc1f0
a4c6dfadc2f0 $" | |
| | | | |
| #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 69 | | skipping to change at line 69 | |
| * respectively, (\e lat1, \e lon1) and (\e lat, \e lon). | | * respectively, (\e lat1, \e lon1) and (\e lat, \e lon). | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| class GEOGRAPHIC_EXPORT CassiniSoldner { | | class GEOGRAPHIC_EXPORT CassiniSoldner { | |
| private: | | private: | |
| typedef Math::real real; | | typedef Math::real real; | |
| const Geodesic _earth; | | const Geodesic _earth; | |
| GeodesicLine _meridian; | | GeodesicLine _meridian; | |
| real _sbet0, _cbet0; | | real _sbet0, _cbet0; | |
| static const real eps1_; | | static const real eps1_; | |
|
| static const real eps2_; | | static const real tiny_; | |
| static const unsigned maxit_ = 10; | | static const unsigned maxit_ = 10; | |
| | | | |
| // The following private helper functions are copied from Geodesic. | | // The following private helper functions are copied from Geodesic. | |
| static inline real AngNormalize(real x) throw() { | | static inline real AngNormalize(real x) throw() { | |
| // Place angle in [-180, 180). Assumes x is in [-540, 540). | | // Place angle in [-180, 180). Assumes x is in [-540, 540). | |
| return x >= 180 ? x - 360 : x < -180 ? x + 360 : x; | | return x >= 180 ? x - 360 : x < -180 ? x + 360 : x; | |
| } | | } | |
| static inline real AngRound(real x) throw() { | | static inline real AngRound(real x) throw() { | |
| // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | | // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | |
| // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | | // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | |
| | | | |
End of changes. 3 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|
| Constants.hpp | | Constants.hpp | |
| /** | | /** | |
| * \file Constants.hpp | | * \file Constants.hpp | |
| * \brief Header for GeographicLib::Constants class | | * \brief Header for GeographicLib::Constants class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
|
| * and licensed under the LGPL. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) | | #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP) | |
|
| #define GEOGRAPHICLIB_CONSTANTS_HPP "$Id: 4aca66343d10b60147ea54b9ede6cc7f0
5e0916d $" | | #define GEOGRAPHICLIB_CONSTANTS_HPP "$Id: d38ac71ad012dd3652e229545db677f1a
5e24899 $" | |
| | | | |
| #include <GeographicLib/Config.h> | | #include <GeographicLib/Config.h> | |
| | | | |
| /** | | /** | |
| * Are C++0X math functions available? | | * Are C++0X math functions available? | |
| **********************************************************************/ | | **********************************************************************/ | |
| #if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH) | | #if !defined(GEOGRAPHICLIB_CPLUSPLUS0X_MATH) | |
| # if defined(__GXX_EXPERIMENTAL_CXX0X__) | | # if defined(__GXX_EXPERIMENTAL_CXX0X__) | |
| # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1 | | # define GEOGRAPHICLIB_CPLUSPLUS0X_MATH 1 | |
| # else | | # else | |
| | | | |
| skipping to change at line 192 | | skipping to change at line 192 | |
| T a = (std::max)(x, y), | | T a = (std::max)(x, y), | |
| b = (std::min)(x, y) / (a ? a : 1); | | b = (std::min)(x, y) / (a ? a : 1); | |
| return a * std::sqrt(1 + b * b); | | return a * std::sqrt(1 + b * b); | |
| } | | } | |
| #elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH | | #elif GEOGRAPHICLIB_CPLUSPLUS0X_MATH | |
| template<typename T> | | template<typename T> | |
| static inline T hypot(T x, T y) throw() { return std::hypot(x, y); } | | static inline T hypot(T x, T y) throw() { return std::hypot(x, y); } | |
| #elif defined(_MSC_VER) | | #elif defined(_MSC_VER) | |
| static inline double hypot(double x, double y) throw() | | static inline double hypot(double x, double y) throw() | |
| { return _hypot(x, y); } | | { return _hypot(x, y); } | |
|
| | | #if (_MSC_VER < 1400) | |
| | | // Visual C++ 7.1/VS .NET 2003 does not have _hypotf() | |
| | | static inline float hypot(float x, float y) throw() | |
| | | { return float(_hypot(x, y)); } | |
| | | #else | |
| static inline float hypot(float x, float y) throw() | | static inline float hypot(float x, float y) throw() | |
| { return _hypotf(x, y); } | | { return _hypotf(x, y); } | |
|
| | | #endif | |
| #if defined(HAVE_LONG_DOUBLE) | | #if defined(HAVE_LONG_DOUBLE) | |
| static inline long double hypot(long double x, long double y) throw() | | static inline long double hypot(long double x, long double y) throw() | |
| { return _hypot(x, y); } | | { return _hypot(x, y); } | |
| #endif | | #endif | |
| #else | | #else | |
| // Use overloading to define generic versions | | // Use overloading to define generic versions | |
| static inline double hypot(double x, double y) throw() | | static inline double hypot(double x, double y) throw() | |
| { return ::hypot(x, y); } | | { return ::hypot(x, y); } | |
| static inline float hypot(float x, float y) throw() | | static inline float hypot(float x, float y) throw() | |
| { return ::hypotf(x, y); } | | { return ::hypotf(x, y); } | |
| | | | |
End of changes. 4 change blocks. |
| 2 lines changed or deleted | | 8 lines changed or added | |
|
| Geocentric.hpp | | Geocentric.hpp | |
| /** | | /** | |
| * \file Geocentric.hpp | | * \file Geocentric.hpp | |
| * \brief Header for GeographicLib::Geocentric class | | * \brief Header for GeographicLib::Geocentric class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
|
| * and licensed under the LGPL. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | | #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP) | |
|
| #define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: 9a894a0d79bd444c60cfb3b4ecf4981c
1d3dd757 $" | | #define GEOGRAPHICLIB_GEOCENTRIC_HPP "$Id: 8f8b1d77b1719a8254cc7b3a7c148273
1f175b08 $" | |
| | | | |
| #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 116 | | skipping to change at line 116 | |
| * | | * | |
| * @param[in] lat latitude of point (degrees). | | * @param[in] lat latitude of point (degrees). | |
| * @param[in] lon longitude of point (degrees). | | * @param[in] lon longitude of point (degrees). | |
| * @param[in] h height of point above the ellipsoid (meters). | | * @param[in] h height of point above the ellipsoid (meters). | |
| * @param[out] x geocentric coordinate (meters). | | * @param[out] x geocentric coordinate (meters). | |
| * @param[out] y geocentric coordinate (meters). | | * @param[out] y geocentric coordinate (meters). | |
| * @param[out] z geocentric coordinate (meters). | | * @param[out] z geocentric coordinate (meters). | |
| * @param[out] M if the length of the vector is 9, fill with the rotati
on | | * @param[out] M if the length of the vector is 9, fill with the rotati
on | |
| * matrix in row-major order. | | * matrix in row-major order. | |
| * | | * | |
|
| * Pre-multiplying a unit vector in local cartesian coordinates (east, | | * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can | |
| * north, up) by \e M transforms the vector to geocentric coordinates. | | * express \e v as \e column vectors in one of two ways | |
| | | * - in east, north, up coordinates (where the components are relative | |
| | | to a | |
| | | * local coordinate system at (\e lat, \e lon, \e h)); call this | |
| | | * representation \e v1. | |
| | | * - in geocentric \e x, \e y, \e z coordinates; call this representati | |
| | | on | |
| | | * \e v0. | |
| | | * . | |
| | | * Then we have \e v0 = \e M . \e v1. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Forward(real lat, real lon, real h, real& x, real& y, real& z, | | void Forward(real lat, real lon, real h, real& x, real& y, real& z, | |
| std::vector<real>& M) | | std::vector<real>& M) | |
| const throw() { | | const throw() { | |
| if (M.end() == M.begin() + dim2_) { | | if (M.end() == M.begin() + dim2_) { | |
| real t[dim2_]; | | real t[dim2_]; | |
| IntForward(lat, lon, h, x, y, z, t); | | IntForward(lat, lon, h, x, y, z, t); | |
| copy(t, t + dim2_, M.begin()); | | copy(t, t + dim2_, M.begin()); | |
| } else | | } else | |
| IntForward(lat, lon, h, x, y, z, NULL); | | IntForward(lat, lon, h, x, y, z, NULL); | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 173 | |
| * | | * | |
| * @param[in] x geocentric coordinate (meters). | | * @param[in] x geocentric coordinate (meters). | |
| * @param[in] y geocentric coordinate (meters). | | * @param[in] y geocentric coordinate (meters). | |
| * @param[in] z geocentric coordinate (meters). | | * @param[in] z geocentric coordinate (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] h height of point above the ellipsoid (meters). | | * @param[out] h height of point above the ellipsoid (meters). | |
| * @param[out] M if the length of the vector is 9, fill with the rotati
on | | * @param[out] M if the length of the vector is 9, fill with the rotati
on | |
| * matrix in row-major order. | | * matrix in row-major order. | |
| * | | * | |
|
| * Pre-multiplying a unit vector in geocentric coordinates by the trans | | * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can | |
| pose | | * express \e v as \e column vectors in one of two ways | |
| * of \e M transforms the vector to local cartesian coordinates (east, | | * - in east, north, up coordinates (where the components are relative | |
| * north, up). | | to a | |
| | | * local coordinate system at (\e lat, \e lon, \e h)); call this | |
| | | * representation \e v1. | |
| | | * - in geocentric \e x, \e y, \e z coordinates; call this representati | |
| | | on | |
| | | * \e v0. | |
| | | * . | |
| | | * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose o | |
| | | f \e | |
| | | * M. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | | void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | |
| std::vector<real>& M) | | std::vector<real>& M) | |
| const throw() { | | const throw() { | |
| if (M.end() == M.begin() + dim2_) { | | if (M.end() == M.begin() + dim2_) { | |
| real t[dim2_]; | | real t[dim2_]; | |
| IntReverse(x, y, z, lat, lon, h, t); | | IntReverse(x, y, z, lat, lon, h, t); | |
| copy(t, t + dim2_, M.begin()); | | copy(t, t + dim2_, M.begin()); | |
| } else | | } else | |
| IntReverse(x, y, z, lat, lon, h, NULL); | | IntReverse(x, y, z, lat, lon, h, NULL); | |
| | | | |
End of changes. 4 change blocks. |
| 8 lines changed or deleted | | 26 lines changed or added | |
|
| Geodesic.hpp | | Geodesic.hpp | |
| /** | | /** | |
| * \file Geodesic.hpp | | * \file Geodesic.hpp | |
| * \brief Header for GeographicLib::Geodesic class | | * \brief Header for GeographicLib::Geodesic class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | |
|
| * and licensed under the LGPL. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESIC_HPP) | |
|
| #define GEOGRAPHICLIB_GEODESIC_HPP "$Id: d93e74a8d3eadc56d947c54b86978191f9
1bf758 $" | | #define GEOGRAPHICLIB_GEODESIC_HPP "$Id: 08483b14e89af4913976c07a8a2fb1770e
a54454 $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| #if !defined(GEOD_ORD) | | #if !defined(GEOD_ORD) | |
| /** | | /** | |
| * The order of the expansions used by Geodesic. | | * The order of the expansions used by Geodesic. | |
| **********************************************************************/ | | **********************************************************************/ | |
| #define GEOD_ORD (GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 3
: 7) | | #define GEOD_ORD (GEOGRAPHICLIB_PREC == 1 ? 6 : GEOGRAPHICLIB_PREC == 0 ? 3
: 7) | |
| #endif | | #endif | |
| | | | |
| | | | |
| skipping to change at line 132 | | skipping to change at line 132 | |
| static const int nA2_ = GEOD_ORD; | | static const int nA2_ = GEOD_ORD; | |
| static const int nC2_ = GEOD_ORD; | | static const int nC2_ = GEOD_ORD; | |
| static const int nA3_ = GEOD_ORD; | | static const int nA3_ = GEOD_ORD; | |
| static const int nA3x_ = nA3_; | | static const int nA3x_ = nA3_; | |
| static const int nC3_ = GEOD_ORD; | | static const int nC3_ = GEOD_ORD; | |
| static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; | | static const int nC3x_ = (nC3_ * (nC3_ - 1)) / 2; | |
| static const int nC4_ = GEOD_ORD; | | static const int nC4_ = GEOD_ORD; | |
| static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; | | static const int nC4x_ = (nC4_ * (nC4_ + 1)) / 2; | |
| static const unsigned maxit_ = 50; | | static const unsigned maxit_ = 50; | |
| | | | |
|
| void Lengths(real eps, real sig12, | | static const real tiny_; | |
| real ssig1, real csig1, real ssig2, real csig2, | | | |
| real cbet1, real cbet2, | | | |
| real& s12s, real& m12a, real& m0, | | | |
| bool scalep, real& M12, real& M21, | | | |
| real tc[], real zc[]) const throw(); | | | |
| static real Astroid(real R, real z) throw(); | | | |
| real InverseStart(real sbet1, real cbet1, real sbet2, real cbet2, | | | |
| real lam12, | | | |
| real& salp1, real& calp1, | | | |
| real& salp2, real& calp2, | | | |
| real C1a[], real C2a[]) const throw(); | | | |
| real Lambda12(real sbet1, real cbet1, real sbet2, real cbet2, | | | |
| real salp1, real calp1, | | | |
| real& salp2, real& calp2, real& sig12, | | | |
| real& ssig1, real& csig1, real& ssig2, real& csig2, | | | |
| real& eps, real& domg12, bool diffp, real& dlam12, | | | |
| real C1a[], real C2a[], real C3a[]) | | | |
| const throw(); | | | |
| | | | |
| static const real eps2_; | | | |
| static const real tol0_; | | static const real tol0_; | |
| static const real tol1_; | | static const real tol1_; | |
| static const real tol2_; | | static const real tol2_; | |
| static const real xthresh_; | | static const real xthresh_; | |
|
| const real _a, _f, _r, _f1, _e2, _ep2, _n, _b, _c2, _etol2; | | | |
| real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_]; | | enum captype { | |
| | | CAP_NONE = 0U, | |
| | | CAP_C1 = 1U<<0, | |
| | | CAP_C1p = 1U<<1, | |
| | | CAP_C2 = 1U<<2, | |
| | | CAP_C3 = 1U<<3, | |
| | | CAP_C4 = 1U<<4, | |
| | | CAP_ALL = 0x1FU, | |
| | | OUT_ALL = 0x7F80U, | |
| | | }; | |
| | | | |
| static real SinCosSeries(bool sinp, | | static real SinCosSeries(bool sinp, | |
| real sinx, real cosx, const real c[], int n) | | real sinx, real cosx, const real c[], int n) | |
| throw(); | | throw(); | |
| static inline real AngNormalize(real x) throw() { | | static inline real AngNormalize(real x) throw() { | |
| // Place angle in [-180, 180). Assumes x is in [-540, 540). | | // Place angle in [-180, 180). Assumes x is in [-540, 540). | |
| return x >= 180 ? x - 360 : x < -180 ? x + 360 : x; | | return x >= 180 ? x - 360 : x < -180 ? x + 360 : x; | |
| } | | } | |
| static inline real AngRound(real x) throw() { | | static inline real AngRound(real x) throw() { | |
| // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | | // The makes the smallest gap in x = 1/16 - nextafter(1/16, 0) = 1/2^
57 | |
| // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | | // for reals = 0.7 pm on the earth if x is an angle in degrees. (Thi
s | |
| | | | |
| skipping to change at line 183 | | skipping to change at line 173 | |
| volatile real y = std::abs(x); | | volatile real y = std::abs(x); | |
| // The compiler mustn't "simplify" z - (z - y) to y | | // The compiler mustn't "simplify" z - (z - y) to y | |
| y = y < z ? z - (z - y) : y; | | y = y < z ? z - (z - y) : y; | |
| return x < 0 ? -y : y; | | return x < 0 ? -y : y; | |
| } | | } | |
| static inline void SinCosNorm(real& sinx, real& cosx) throw() { | | static inline void SinCosNorm(real& sinx, real& cosx) throw() { | |
| real r = Math::hypot(sinx, cosx); | | real r = Math::hypot(sinx, cosx); | |
| sinx /= r; | | sinx /= r; | |
| cosx /= r; | | cosx /= r; | |
| } | | } | |
|
| | | static real Astroid(real x, real y) throw(); | |
| | | | |
| | | // _r is OBSOLETE, can be removed | |
| | | const real _a, _f, _r, _f1, _e2, _ep2, _n, _b, _c2, _etol2; | |
| | | real _A3x[nA3x_], _C3x[nC3x_], _C4x[nC4x_]; | |
| | | | |
| | | void Lengths(real eps, real sig12, | |
| | | real ssig1, real csig1, real ssig2, real csig2, | |
| | | real cbet1, real cbet2, | |
| | | real& s12s, real& m12a, real& m0, | |
| | | bool scalep, real& M12, real& M21, | |
| | | real C1a[], real C2a[]) const throw(); | |
| | | real InverseStart(real sbet1, real cbet1, real sbet2, real cbet2, | |
| | | real lam12, | |
| | | real& salp1, real& calp1, | |
| | | real& salp2, real& calp2, | |
| | | real C1a[], real C2a[]) const throw(); | |
| | | real Lambda12(real sbet1, real cbet1, real sbet2, real cbet2, | |
| | | real salp1, real calp1, | |
| | | real& salp2, real& calp2, real& sig12, | |
| | | real& ssig1, real& csig1, real& ssig2, real& csig2, | |
| | | real& eps, real& domg12, bool diffp, real& dlam12, | |
| | | real C1a[], real C2a[], real C3a[]) | |
| | | const throw(); | |
| | | | |
| // These are Maxima generated functions to provide series approximation
s to | | // These are Maxima generated functions to provide series approximation
s to | |
| // the integrals for the ellipsoidal geodesic. | | // the integrals for the ellipsoidal geodesic. | |
| static real A1m1f(real eps) throw(); | | static real A1m1f(real eps) throw(); | |
| static void C1f(real eps, real c[]) throw(); | | static void C1f(real eps, real c[]) throw(); | |
| static void C1pf(real eps, real c[]) throw(); | | static void C1pf(real eps, real c[]) throw(); | |
| static real A2m1f(real eps) throw(); | | static real A2m1f(real eps) throw(); | |
| static void C2f(real eps, real c[]) throw(); | | static void C2f(real eps, real c[]) throw(); | |
|
| | | | |
| void A3coeff() throw(); | | void A3coeff() throw(); | |
| real A3f(real eps) const throw(); | | real A3f(real eps) const throw(); | |
| void C3coeff() throw(); | | void C3coeff() throw(); | |
| void C3f(real eps, real c[]) const throw(); | | void C3f(real eps, real c[]) const throw(); | |
| void C4coeff() throw(); | | void C4coeff() throw(); | |
| void C4f(real k2, real c[]) const throw(); | | void C4f(real k2, real c[]) const throw(); | |
| | | | |
|
| enum captype { | | | |
| CAP_NONE = 0U, | | | |
| CAP_C1 = 1U<<0, | | | |
| CAP_C1p = 1U<<1, | | | |
| CAP_C2 = 1U<<2, | | | |
| CAP_C3 = 1U<<3, | | | |
| CAP_C4 = 1U<<4, | | | |
| CAP_ALL = 0x1FU, | | | |
| OUT_ALL = 0x7F80U, | | | |
| }; | | | |
| public: | | public: | |
| | | | |
| /** | | /** | |
| * Bit masks for what calculations to do. These masks do double duty. | | * Bit masks for what calculations to do. These masks do double duty. | |
| * They signify to the GeodesicLine::GeodesicLine constructor and to | | * They signify to the GeodesicLine::GeodesicLine constructor and to | |
| * Geodesic::Line what capabilities should be included in the GeodesicL
ine | | * Geodesic::Line what capabilities should be included in the GeodesicL
ine | |
| * object. They also specify which results to return in the general | | * object. They also specify which results to return in the general | |
| * routines Geodesic::GenDirect and Geodesic::GenInverse routines. | | * routines Geodesic::GenDirect and Geodesic::GenInverse routines. | |
| * GeodesicLine::mask is a duplication of this enum. | | * GeodesicLine::mask is a duplication of this enum. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| | | | |
| skipping to change at line 595 | | skipping to change at line 601 | |
| * @param[out] M12 geodesic scale of point 2 relative to point 1 | | * @param[out] M12 geodesic scale of point 2 relative to point 1 | |
| * (dimensionless). | | * (dimensionless). | |
| * @param[out] M21 geodesic scale of point 1 relative to point 2 | | * @param[out] M21 geodesic scale of point 1 relative to point 2 | |
| * (dimensionless). | | * (dimensionless). | |
| * @param[out] S12 area under the geodesic (meters<sup>2</sup>). | | * @param[out] S12 area under the geodesic (meters<sup>2</sup>). | |
| * @return \e a12 arc length of between point 1 and point 2 (degrees). | | * @return \e a12 arc length of between point 1 and point 2 (degrees). | |
| * | | * | |
| * If either point is at a pole, the azimuth is defined by keeping the | | * If either point is at a pole, the azimuth is defined by keeping the | |
| * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and | | * longitude fixed and writing \e lat = 90 - \e eps or -90 + \e eps and | |
| * taking the limit \e eps -> 0 from above. If the routine fails to | | * taking the limit \e eps -> 0 from above. If the routine fails to | |
|
| * converge, then all the requested outputs are set to Math::NaN(). Th | | * converge, then all the requested outputs are set to Math::NaN(). (T | |
| is | | est | |
| * is not expected to happen with ellipsoidal models of the earth; plea | | * for such results with Math::isnan.) This is not expected to happen | |
| se | | with | |
| * report all cases where this occurs. | | * ellipsoidal models of the earth; please report all cases where this | |
| | | * occurs. | |
| * | | * | |
| * The following functions are overloaded versions of Geodesic::Inverse | | * The following functions are overloaded versions of Geodesic::Inverse | |
| * which omit some of the output parameters. Note, however, that the a
rc | | * which omit some of the output parameters. Note, however, that the a
rc | |
| * length is always computed and returned as the function value. | | * length is always computed and returned as the function value. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real Inverse(real lat1, real lon1, real lat2, real lon2, | | Math::real Inverse(real lat1, real lon1, real lat2, real lon2, | |
| real& s12, real& azi1, real& azi2, real& m12, | | real& s12, real& azi1, real& azi2, real& m12, | |
| real& M12, real& M21, real& S12) const throw() { | | real& M12, real& M21, real& S12) const throw() { | |
| return GenInverse(lat1, lon1, lat2, lon2, | | return GenInverse(lat1, lon1, lat2, lon2, | |
| DISTANCE | AZIMUTH | | | DISTANCE | AZIMUTH | | |
| | | | |
| skipping to change at line 720 | | skipping to change at line 727 | |
| * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2. | | * - \e outmask |= Geodesic::AZIMUTH for the latitude \e azi2. | |
| * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e | | * - \e outmask |= Geodesic::REDUCEDLENGTH for the reduced length \e | |
| * m12. | | * m12. | |
| * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e | | * - \e outmask |= Geodesic::GEODESICSCALE for the geodesic scales \e | |
| * M12 and \e M21. | | * M12 and \e M21. | |
| * - \e outmask |= Geodesic::AREA for the area \e S12. | | * - \e outmask |= Geodesic::AREA for the area \e S12. | |
| * . | | * . | |
| * The arc length is always computed and returned as the function value
. | | * The arc length is always computed and returned as the function value
. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real GenInverse(real lat1, real lon1, real lat2, real lon2, | | Math::real GenInverse(real lat1, real lon1, real lat2, real lon2, | |
|
| unsigned outmask, | | unsigned outmask, | |
| real& s12, real& azi1, real& azi2, | | real& s12, real& azi1, real& azi2, | |
| real& m12, real& M12, real& M21, real& S12) | | real& m12, real& M12, real& M21, real& S12) | |
| const throw(); | | const throw(); | |
| ///@} | | ///@} | |
| | | | |
| /** \name Interface to GeodesicLine. | | /** \name Interface to GeodesicLine. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| * Set up to do a series of ranges. | | * Set up to do a series of ranges. | |
| * | | * | |
| | | | |
End of changes. 9 change blocks. |
| 43 lines changed or deleted | | 50 lines changed or added | |
|
| GeodesicLine.hpp | | GeodesicLine.hpp | |
| /** | | /** | |
| * \file GeodesicLine.hpp | | * \file GeodesicLine.hpp | |
| * \brief Header for GeographicLib::GeodesicLine class | | * \brief Header for GeographicLib::GeodesicLine class | |
| * | | * | |
| * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | | * Copyright (c) Charles Karney (2009, 2010, 2011) <charles@karney.com> | |
|
| * and licensed under the LGPL. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | | #if !defined(GEOGRAPHICLIB_GEODESICLINE_HPP) | |
|
| #define GEOGRAPHICLIB_GEODESICLINE_HPP "$Id: 7621f104dea2ed253fbcf6173ffc8f
2c23c3d67b $" | | #define GEOGRAPHICLIB_GEODESICLINE_HPP "$Id: 592ae103b61c941eff6b856e0b20fe
973e5656e1 $" | |
| | | | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| #include <GeographicLib/Geodesic.hpp> | | #include <GeographicLib/Geodesic.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief A geodesic line. | | * \brief A geodesic line. | |
| * | | * | |
| * GeodesicLine facilitates the determination of a series of points on a | | * GeodesicLine facilitates the determination of a series of points on a | |
| | | | |
| skipping to change at line 95 | | skipping to change at line 95 | |
| static const int nC3_ = Geodesic::nC3_; | | static const int nC3_ = Geodesic::nC3_; | |
| static const int nC4_ = Geodesic::nC4_; | | static const int nC4_ = Geodesic::nC4_; | |
| | | | |
| real _lat1, _lon1, _azi1; | | real _lat1, _lon1, _azi1; | |
| real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, | | real _a, _f, _b, _c2, _f1, _salp0, _calp0, _k2, | |
| _salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1, | | _salp1, _calp1, _ssig1, _csig1, _stau1, _ctau1, _somg1, _comg1, | |
| _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; | | _A1m1, _A2m1, _A3c, _B11, _B21, _B31, _A4, _B41; | |
| // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused | | // index zero elements of _C1a, _C1pa, _C2a, _C3a are unused | |
| real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_], | | real _C1a[nC1_ + 1], _C1pa[nC1p_ + 1], _C2a[nC2_ + 1], _C3a[nC3_], | |
| _C4a[nC4_]; // all the elements of _C4a are used | | _C4a[nC4_]; // all the elements of _C4a are used | |
|
| bool _areap; | | bool _areap; // _areap is OBSOLETE, can be removed | |
| unsigned _caps; | | unsigned _caps; | |
| | | | |
| enum captype { | | enum captype { | |
| CAP_NONE = Geodesic::CAP_NONE, | | CAP_NONE = Geodesic::CAP_NONE, | |
| CAP_C1 = Geodesic::CAP_C1, | | CAP_C1 = Geodesic::CAP_C1, | |
| CAP_C1p = Geodesic::CAP_C1p, | | CAP_C1p = Geodesic::CAP_C1p, | |
| CAP_C2 = Geodesic::CAP_C2, | | CAP_C2 = Geodesic::CAP_C2, | |
| CAP_C3 = Geodesic::CAP_C3, | | CAP_C3 = Geodesic::CAP_C3, | |
| CAP_C4 = Geodesic::CAP_C4, | | CAP_C4 = Geodesic::CAP_C4, | |
| CAP_ALL = Geodesic::CAP_ALL, | | CAP_ALL = Geodesic::CAP_ALL, | |
| | | | |
| skipping to change at line 535 | | skipping to change at line 535 | |
| ///@{ | | ///@{ | |
| | | | |
| /** | | /** | |
| * @return true if the object has been initialized. | | * @return true if the object has been initialized. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| bool Init() const throw() { return _caps != 0U; } | | bool Init() const throw() { return _caps != 0U; } | |
| | | | |
| /** | | /** | |
| * @return \e lat1 the latitude of point 1 (degrees). | | * @return \e lat1 the latitude of point 1 (degrees). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| Math::real Latitude() const throw() { return Init() ? _lat1 : Math::NaN | | Math::real Latitude() const throw() | |
| (); } | | { return Init() ? _lat1 : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * @return \e lon1 the longitude of point 1 (degrees). | | * @return \e lon1 the longitude of point 1 (degrees). | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real Longitude() const throw() | | Math::real Longitude() const throw() | |
|
| { return Init() ? _lon1 : Math::NaN(); } | | { return Init() ? _lon1 : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * @return \e azi1 the azimuth (degrees) of the geodesic line at point
1. | | * @return \e azi1 the azimuth (degrees) of the geodesic line at point
1. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| Math::real Azimuth() const throw() { return Init() ? _azi1 : Math::NaN( | | Math::real Azimuth() const throw() | |
| ); } | | { return Init() ? _azi1 : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * @return \e azi0 the azimuth (degrees) of the geodesic line as it cro
sses | | * @return \e azi0 the azimuth (degrees) of the geodesic line as it cro
sses | |
| * the equator in a northward direction. | | * the equator in a northward direction. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real EquatorialAzimuth() const throw() { | | Math::real EquatorialAzimuth() const throw() { | |
| return Init() ? | | return Init() ? | |
|
| atan2(_salp0, _calp0) / Math::degree<real>() : Math::NaN(); | | atan2(_salp0, _calp0) / Math::degree<real>() : Math::NaN<real>(); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * @return \e a1 the arc length (degrees) between the northward equator
ial | | * @return \e a1 the arc length (degrees) between the northward equator
ial | |
| * crossing and point 1. | | * crossing and point 1. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real EquatorialArc() const throw() { | | Math::real EquatorialArc() const throw() { | |
| return Init() ? | | return Init() ? | |
|
| atan2(_ssig1, _csig1) / Math::degree<real>() : Math::NaN(); | | atan2(_ssig1, _csig1) / Math::degree<real>() : Math::NaN<real>(); | |
| } | | } | |
| | | | |
| /** | | /** | |
| * @return \e a the equatorial radius of the ellipsoid (meters). This
is | | * @return \e a the equatorial radius of the ellipsoid (meters). This
is | |
| * the value inherited from the Geodesic object used in the construct
or. | | * the value inherited from the Geodesic object used in the construct
or. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| Math::real MajorRadius() const throw() { return Init() ? _a : Math::NaN | | Math::real MajorRadius() const throw() | |
| (); } | | { return Init() ? _a : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * @return \e f the flattening of the ellipsoid. This is the value | | * @return \e f the flattening of the ellipsoid. This is the value | |
| * inherited from the Geodesic object used in the constructor. | | * inherited from the Geodesic object used in the constructor. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
|
| Math::real Flattening() const throw() { return Init() ? _f : Math::NaN( | | Math::real Flattening() const throw() | |
| ); } | | { return Init() ? _f : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * <b>DEPRECATED</b> | | * <b>DEPRECATED</b> | |
| * @return \e r the inverse flattening of the ellipsoid. | | * @return \e r the inverse flattening of the ellipsoid. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| Math::real InverseFlattening() const throw() | | Math::real InverseFlattening() const throw() | |
|
| { return Init() ? 1/_f : Math::NaN(); } | | { return Init() ? 1/_f : Math::NaN<real>(); } | |
| | | | |
| /** | | /** | |
| * @return \e caps the computational capabilities that this object was | | * @return \e caps the computational capabilities that this object was | |
| * constructed with. LATITUDE and AZIMUTH are always included. | | * constructed with. LATITUDE and AZIMUTH are always included. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| unsigned Capabilities() const throw() { return _caps; } | | unsigned Capabilities() const throw() { return _caps; } | |
| | | | |
| /** | | /** | |
| * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. | | * @param[in] testcaps a set of bitor'ed GeodesicLine::mask values. | |
| * @return true if the GeodesicLine object has all these capabilities. | | * @return true if the GeodesicLine object has all these capabilities. | |
| | | | |
End of changes. 11 change blocks. |
| 15 lines changed or deleted | | 15 lines changed or added | |
|
| LocalCartesian.hpp | | LocalCartesian.hpp | |
| /** | | /** | |
| * \file LocalCartesian.hpp | | * \file LocalCartesian.hpp | |
| * \brief Header for GeographicLib::LocalCartesian class | | * \brief Header for GeographicLib::LocalCartesian class | |
| * | | * | |
| * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | | * Copyright (c) Charles Karney (2008, 2009, 2010, 2011) <charles@karney.co
m> | |
|
| * and licensed under the LGPL. For more information, see | | * and licensed under the MIT/X11 License. For more information, see | |
| * http://geographiclib.sourceforge.net/ | | * http://geographiclib.sourceforge.net/ | |
| **********************************************************************/ | | **********************************************************************/ | |
| | | | |
| #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | | #if !defined(GEOGRAPHICLIB_LOCALCARTESIAN_HPP) | |
|
| #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: 1f16fc06cd148ecb87836a52fad1
2dc36a69a52b $" | | #define GEOGRAPHICLIB_LOCALCARTESIAN_HPP "$Id: 7ec9e1a810dc0eb527d0e20c69df
60ac1a2ba499 $" | |
| | | | |
| #include <GeographicLib/Geocentric.hpp> | | #include <GeographicLib/Geocentric.hpp> | |
| #include <GeographicLib/Constants.hpp> | | #include <GeographicLib/Constants.hpp> | |
| | | | |
| namespace GeographicLib { | | namespace GeographicLib { | |
| | | | |
| /** | | /** | |
| * \brief Local Cartesian coordinates | | * \brief Local Cartesian coordinates | |
| * | | * | |
| * Convert between geodetic coordinates latitude = \e lat, longitude = \e | | * Convert between geodetic coordinates latitude = \e lat, longitude = \e | |
| | | | |
| skipping to change at line 115 | | skipping to change at line 115 | |
| * | | * | |
| * @param[in] lat latitude of point (degrees). | | * @param[in] lat latitude of point (degrees). | |
| * @param[in] lon longitude of point (degrees). | | * @param[in] lon longitude of point (degrees). | |
| * @param[in] h height of point above the ellipsoid (meters). | | * @param[in] h height of point above the ellipsoid (meters). | |
| * @param[out] x local cartesian coordinate (meters). | | * @param[out] x local cartesian coordinate (meters). | |
| * @param[out] y local cartesian coordinate (meters). | | * @param[out] y local cartesian coordinate (meters). | |
| * @param[out] z local cartesian coordinate (meters). | | * @param[out] z local cartesian coordinate (meters). | |
| * @param[out] M if the length of the vector is 9, fill with the rotati
on | | * @param[out] M if the length of the vector is 9, fill with the rotati
on | |
| * matrix in row-major order. | | * matrix in row-major order. | |
| * | | * | |
|
| * Pre-multiplying a unit vector in local cartesian coordinates at (lat | | * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can | |
| , | | * express \e v as \e column vectors in one of two ways | |
| * lon, h) by \e M transforms the vector to local cartesian coordinates | | * - in east, north, up coordinates (where the components are relative | |
| at | | to a | |
| * (lat0, lon0, h0). | | * local coordinate system at (\e lat, \e lon, \e h)); call this | |
| | | * representation \e v1. | |
| | | * - in \e x, \e y, \e z coordinates (where the components are relative | |
| | | to | |
| | | * the local coordinate system at (\e lat0, \e lon0, \e h0)); call th | |
| | | is | |
| | | * representation \e v0. | |
| | | * . | |
| | | * Then we have \e v0 = \e M . \e v1. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Forward(real lat, real lon, real h, real& x, real& y, real& z, | | void Forward(real lat, real lon, real h, real& x, real& y, real& z, | |
| std::vector<real>& M) | | std::vector<real>& M) | |
| const throw() { | | const throw() { | |
| if (M.end() == M.begin() + dim2_) { | | if (M.end() == M.begin() + dim2_) { | |
| real t[dim2_]; | | real t[dim2_]; | |
| IntForward(lat, lon, h, x, y, z, t); | | IntForward(lat, lon, h, x, y, z, t); | |
| copy(t, t + dim2_, M.begin()); | | copy(t, t + dim2_, M.begin()); | |
| } else | | } else | |
| IntForward(lat, lon, h, x, y, z, NULL); | | IntForward(lat, lon, h, x, y, z, NULL); | |
| | | | |
| skipping to change at line 160 | | skipping to change at line 167 | |
| * | | * | |
| * @param[in] x local cartesian coordinate (meters). | | * @param[in] x local cartesian coordinate (meters). | |
| * @param[in] y local cartesian coordinate (meters). | | * @param[in] y local cartesian coordinate (meters). | |
| * @param[in] z local cartesian coordinate (meters). | | * @param[in] z local cartesian coordinate (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] h height of point above the ellipsoid (meters). | | * @param[out] h height of point above the ellipsoid (meters). | |
| * @param[out] M if the length of the vector is 9, fill with the rotati
on | | * @param[out] M if the length of the vector is 9, fill with the rotati
on | |
| * matrix in row-major order. | | * matrix in row-major order. | |
| * | | * | |
|
| * Pre-multiplying a unit vector in local cartesian coordinates at (lat | | * Let \e v be a unit vector located at (\e lat, \e lon, \e h). We can | |
| 0, | | * express \e v as \e column vectors in one of two ways | |
| * lon0, h0) by the transpose of \e M transforms the vector to local | | * - in east, north, up coordinates (where the components are relative | |
| * cartesian coordinates at (lat, lon, h). | | to a | |
| | | * local coordinate system at (\e lat, \e lon, \e h)); call this | |
| | | * representation \e v1. | |
| | | * - in \e x, \e y, \e z coordinates (where the components are relative | |
| | | to | |
| | | * the local coordinate system at (\e lat0, \e lon0, \e h0)); call th | |
| | | is | |
| | | * representation \e v0. | |
| | | * . | |
| | | * Then we have \e v1 = \e M^T . \e v0, where \e M^T is the transpose o | |
| | | f \e | |
| | | * M. | |
| **********************************************************************
/ | | **********************************************************************
/ | |
| void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | | void Reverse(real x, real y, real z, real& lat, real& lon, real& h, | |
| std::vector<real>& M) | | std::vector<real>& M) | |
| const throw() { | | const throw() { | |
| if (M.end() == M.begin() + dim2_) { | | if (M.end() == M.begin() + dim2_) { | |
| real t[dim2_]; | | real t[dim2_]; | |
| IntReverse(x, y, z, lat, lon, h, t); | | IntReverse(x, y, z, lat, lon, h, t); | |
| copy(t, t + dim2_, M.begin()); | | copy(t, t + dim2_, M.begin()); | |
| } else | | } else | |
| IntReverse(x, y, z, lat, lon, h, NULL); | | IntReverse(x, y, z, lat, lon, h, NULL); | |
| | | | |
End of changes. 4 change blocks. |
| 11 lines changed or deleted | | 30 lines changed or added | |
|