Constants.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_CONSTANTS_HPP)
11 #define GEOGRAPHICLIB_CONSTANTS_HPP 1
12 
13 #include <GeographicLib/Config.h>
14 
21 #define GEOGRAPHICLIB_VERSION_NUM(a,b,c) ((((a) * 10000 + (b)) * 100) + (c))
22 
34 #define GEOGRAPHICLIB_VERSION \
35  GEOGRAPHICLIB_VERSION_NUM(GEOGRAPHICLIB_VERSION_MAJOR, \
36  GEOGRAPHICLIB_VERSION_MINOR, \
37  GEOGRAPHICLIB_VERSION_PATCH)
38 
43 #if !defined(GEOGRAPHICLIB_HAS_STATIC_ASSERT)
44 # if __cplusplus >= 201103 || defined(__GXX_EXPERIMENTAL_CXX0X__)
45 # define GEOGRAPHICLIB_HAS_STATIC_ASSERT 1
46 # elif defined(_MSC_VER) && _MSC_VER >= 1600
47 // For reference, here is a table of Visual Studio and _MSC_VER
48 // correspondences:
49 //
50 // _MSC_VER Visual Studio
51 // 1100 vc5
52 // 1200 vc6
53 // 1300 vc7
54 // 1310 vc7.1 (2003)
55 // 1400 vc8 (2005)
56 // 1500 vc9 (2008)
57 // 1600 vc10 (2010)
58 // 1700 vc11 (2012)
59 // 1800 vc12 (2013)
60 // 1900 vc14 (2015)
61 // 1910+ vc15 (2017)
62 # define GEOGRAPHICLIB_HAS_STATIC_ASSERT 1
63 # else
64 # define GEOGRAPHICLIB_HAS_STATIC_ASSERT 0
65 # endif
66 #endif
67 
72 #if !defined(GEOGRAPHICLIB_STATIC_ASSERT)
73 # if GEOGRAPHICLIB_HAS_STATIC_ASSERT
74 # define GEOGRAPHICLIB_STATIC_ASSERT static_assert
75 # else
76 # define GEOGRAPHICLIB_STATIC_ASSERT(cond,reason) \
77  { enum{ GEOGRAPHICLIB_STATIC_ASSERT_ENUM = 1/int(cond) }; }
78 # endif
79 #endif
80 
81 #if defined(_MSC_VER) && defined(GEOGRAPHICLIB_SHARED_LIB) && \
82  GEOGRAPHICLIB_SHARED_LIB
83 # if GEOGRAPHICLIB_SHARED_LIB > 1
84 # error GEOGRAPHICLIB_SHARED_LIB must be 0 or 1
85 # elif defined(GeographicLib_EXPORTS)
86 # define GEOGRAPHICLIB_EXPORT __declspec(dllexport)
87 # else
88 # define GEOGRAPHICLIB_EXPORT __declspec(dllimport)
89 # endif
90 #else
91 # define GEOGRAPHICLIB_EXPORT
92 #endif
93 
94 // Use GEOGRAPHICLIB_DEPRECATED to mark functions, types or variables as
95 // deprecated. Code inspired by Apache Subversion's svn_types.h file (via
96 // MPFR).
97 #if defined(__GNUC__)
98 # if __GNUC__ > 4
99 # define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated(msg)))
100 # else
101 # define GEOGRAPHICLIB_DEPRECATED(msg) __attribute__((deprecated))
102 # endif
103 #elif defined(_MSC_VER) && _MSC_VER >= 1300
104 # define GEOGRAPHICLIB_DEPRECATED(msg) __declspec(deprecated(msg))
105 #else
106 # define GEOGRAPHICLIB_DEPRECATED(msg)
107 #endif
108 
109 #include <stdexcept>
110 #include <string>
111 #include <GeographicLib/Math.hpp>
112 
120 namespace GeographicLib {
121 
132  private:
133  typedef Math::real real;
134  Constants(); // Disable constructor
135 
136  public:
140  static Math::real degree() { return Math::degree(); }
145  { return Math::degree() / 60; }
150  { return Math::degree() / 3600; }
151 
154 
159  template<typename T> static T WGS84_a()
160  { return 6378137 * meter<T>(); }
164  static Math::real WGS84_a() { return WGS84_a<real>(); }
169  template<typename T> static T WGS84_f() {
170  // Evaluating this as 1000000000 / T(298257223563LL) reduces the
171  // round-off error by about 10%. However, expressing the flattening as
172  // 1/298.257223563 is well ingrained.
173  return 1 / ( T(298257223563LL) / 1000000000 );
174  }
178  static Math::real WGS84_f() { return WGS84_f<real>(); }
184  template<typename T> static T WGS84_GM()
185  { return T(3986004) * 100000000 + 41800000; }
189  static Math::real WGS84_GM() { return WGS84_GM<real>(); }
195  template<typename T> static T WGS84_omega()
196  { return 7292115 / (T(1000000) * 100000); }
200  static Math::real WGS84_omega() { return WGS84_omega<real>(); }
205  template<typename T> static T GRS80_a()
206  { return 6378137 * meter<T>(); }
210  static Math::real GRS80_a() { return GRS80_a<real>(); }
216  template<typename T> static T GRS80_GM()
217  { return T(3986005) * 100000000; }
221  static Math::real GRS80_GM() { return GRS80_GM<real>(); }
234  template<typename T> static T GRS80_omega()
235  { return 7292115 / (T(1000000) * 100000); }
239  static Math::real GRS80_omega() { return GRS80_omega<real>(); }
245  template<typename T> static T GRS80_J2()
246  { return T(108263) / 100000000; }
250  static Math::real GRS80_J2() { return GRS80_J2<real>(); }
255  template<typename T> static T UTM_k0()
256  {return T(9996) / 10000; }
260  static Math::real UTM_k0() { return UTM_k0<real>(); }
265  template<typename T> static T UPS_k0()
266  { return T(994) / 1000; }
270  static Math::real UPS_k0() { return UPS_k0<real>(); }
272 
275 
283  template<typename T> static T meter() { return T(1); }
287  static Math::real meter() { return meter<real>(); }
292  { return 1000 * meter<real>(); }
298  { return 1852 * meter<real>(); }
299 
307  template<typename T> static T square_meter()
308  { return meter<real>() * meter<real>(); }
313  { return square_meter<real>(); }
318  { return 10000 * square_meter<real>(); }
323  { return kilometer() * kilometer(); }
328  { return nauticalmile() * nauticalmile(); }
330 
333 
337  static Math::real foot()
338  { return real(254 * 12) / 10000 * meter<real>(); }
342  static Math::real yard() { return 3 * foot(); }
346  static Math::real fathom() { return 2 * yard(); }
350  static Math::real chain() { return 22 * yard(); }
354  static Math::real furlong() { return 10 * chain(); }
358  static Math::real mile() { return 8 * furlong(); }
362  static Math::real acre() { return chain() * furlong(); }
366  static Math::real square_mile() { return mile() * mile(); }
368 
371 
376  { return real(1200) / 3937 * meter<real>(); }
378  };
379 
389  class GeographicErr : public std::runtime_error {
390  public:
391 
398  GeographicErr(const std::string& msg) : std::runtime_error(msg) {}
399  };
400 
401 } // namespace GeographicLib
402 
403 #endif // GEOGRAPHICLIB_CONSTANTS_HPP
GeographicLib::Constants::GRS80_a
static T GRS80_a()
Definition: Constants.hpp:205
GeographicLib::Constants::kilometer
static Math::real kilometer()
Definition: Constants.hpp:291
GeographicLib::Constants::WGS84_omega
static Math::real WGS84_omega()
Definition: Constants.hpp:200
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::Constants::furlong
static Math::real furlong()
Definition: Constants.hpp:354
GeographicLib::Constants::WGS84_a
static Math::real WGS84_a()
Definition: Constants.hpp:164
GeographicLib::Constants::arcsecond
static Math::real arcsecond()
Definition: Constants.hpp:149
GeographicLib::Constants::acre
static Math::real acre()
Definition: Constants.hpp:362
real
float real
Definition: datatypes.h:10
T
Eigen::Triplet< double > T
Definition: Tutorial_sparse_example.cpp:6
GeographicLib::Constants::square_kilometer
static Math::real square_kilometer()
Definition: Constants.hpp:322
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
GeographicLib::Constants::mile
static Math::real mile()
Definition: Constants.hpp:358
GeographicLib::GeographicErr
Exception handling for GeographicLib.
Definition: Constants.hpp:389
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::Constants::WGS84_omega
static T WGS84_omega()
Definition: Constants.hpp:195
GeographicLib::Constants::chain
static Math::real chain()
Definition: Constants.hpp:350
GeographicLib::Math::degree
static T degree()
Definition: Math.hpp:216
GeographicLib::Constants::WGS84_GM
static T WGS84_GM()
Definition: Constants.hpp:184
GeographicLib::Constants::hectare
static Math::real hectare()
Definition: Constants.hpp:317
GeographicLib::Constants::WGS84_GM
static Math::real WGS84_GM()
Definition: Constants.hpp:189
GeographicLib::Constants::GRS80_J2
static Math::real GRS80_J2()
Definition: Constants.hpp:250
GeographicLib::Constants::square_meter
static T square_meter()
Definition: Constants.hpp:307
GeographicLib::Constants::UPS_k0
static Math::real UPS_k0()
Definition: Constants.hpp:270
GeographicLib::Constants::UTM_k0
static T UTM_k0()
Definition: Constants.hpp:255
GeographicLib::Constants::arcminute
static Math::real arcminute()
Definition: Constants.hpp:144
Eigen::Triplet< double >
GeographicLib::Constants::nauticalmile
static Math::real nauticalmile()
Definition: Constants.hpp:297
GeographicLib::Constants::UPS_k0
static T UPS_k0()
Definition: Constants.hpp:265
GeographicLib::Constants::meter
static Math::real meter()
Definition: Constants.hpp:287
GeographicLib::GeographicErr::GeographicErr
GeographicErr(const std::string &msg)
Definition: Constants.hpp:398
GeographicLib::Constants::foot
static Math::real foot()
Definition: Constants.hpp:337
Math.hpp
Header for GeographicLib::Math class.
GeographicLib::Constants::square_meter
static Math::real square_meter()
Definition: Constants.hpp:312
GeographicLib::Constants::square_nauticalmile
static Math::real square_nauticalmile()
Definition: Constants.hpp:327
Config.h
GeographicLib::Constants::WGS84_a
static T WGS84_a()
Definition: Constants.hpp:159
GeographicLib::Constants::meter
static T meter()
Definition: Constants.hpp:283
GeographicLib::Constants::GRS80_a
static Math::real GRS80_a()
Definition: Constants.hpp:210
GeographicLib::Constants::yard
static Math::real yard()
Definition: Constants.hpp:342
GeographicLib::Constants::GRS80_J2
static T GRS80_J2()
Definition: Constants.hpp:245
std
Definition: BFloat16.h:88
GeographicLib::Constants::degree
static Math::real degree()
Definition: Constants.hpp:140
GeographicLib::Constants::WGS84_f
static Math::real WGS84_f()
Definition: Constants.hpp:178
GeographicLib::Constants::WGS84_f
static T WGS84_f()
Definition: Constants.hpp:169
GeographicLib::Constants::GRS80_omega
static Math::real GRS80_omega()
Definition: Constants.hpp:239
GeographicLib::Constants::real
Math::real real
Definition: Constants.hpp:133
GeographicLib::Constants::GRS80_GM
static T GRS80_GM()
Definition: Constants.hpp:216
GeographicLib::Constants::GRS80_omega
static T GRS80_omega()
Definition: Constants.hpp:234
GeographicLib::Constants::square_mile
static Math::real square_mile()
Definition: Constants.hpp:366
GeographicLib::Constants::surveyfoot
static Math::real surveyfoot()
Definition: Constants.hpp:375
GeographicLib::Constants::GRS80_GM
static Math::real GRS80_GM()
Definition: Constants.hpp:221
GeographicLib::Constants::fathom
static Math::real fathom()
Definition: Constants.hpp:346
GeographicLib::Constants::UTM_k0
static Math::real UTM_k0()
Definition: Constants.hpp:260
GeographicLib::Constants
Constants needed by GeographicLib
Definition: Constants.hpp:131
pybind11.msg
msg
Definition: wrap/pybind11/pybind11/__init__.py:6


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:18