Main MRPT website > C++ reference
MRPT logo
data_types.h
Go to the documentation of this file.
1 /* +---------------------------------------------------------------------------+
2  | Mobile Robot Programming Toolkit (MRPT) |
3  | http://www.mrpt.org/ |
4  | |
5  | Copyright (c) 2005-2014, Individual contributors, see AUTHORS file |
6  | See: http://www.mrpt.org/Authors - All rights reserved. |
7  | Released under BSD License. See details in http://www.mrpt.org/License |
8  +---------------------------------------------------------------------------+ */
9 #ifndef data_types_H
10 #define data_types_H
11 
12 #include <mrpt/utils/utils_defs.h>
14 
16 
17 namespace mrpt
18 {
19  namespace topography
20  {
21  using namespace std;
22  using namespace mrpt::utils;
23 
24  /** \addtogroup mrpt_topography_grp
25  * @{ */
26 
27  /** @name Data structures
28  @{ */
29 
30  /** A coordinate that is stored as a simple "decimal" angle in degrees, but can be retrieved/set in the form of DEGREES + arc-MINUTES + arc-SECONDS.
31  */
33  {
34  // Only keep one of the possible representations:
35  double decimal_value; //!< Also obtained directly through the double(void) operator using a TCoords anywhere were a double is expected.
36 
37  inline TCoords( const int _deg, const int _min, const double _sec ) { setDegMinSec(_deg,_min,_sec); }
38  inline TCoords( const double dec ) { setFromDecimal(dec); }
39  inline TCoords() { setFromDecimal(0); }
40 
41  /** Automatic conversion to a double value (read-only) */
42  inline operator double(void) const { return decimal_value; }
43 
44  /** Automatic conversion to a double value (read-only) */
45  inline operator double& (void) { return decimal_value; }
46 
47  /** Set from a decimal value (XX.YYYYY) in degrees. */
48  inline void setFromDecimal( const double dec ) { decimal_value = dec; }
49 
50  /** Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoords and a double. */
51  inline double getDecimalValue() const { return decimal_value; }
52 
53  /** Return the Deg Min' Sec'' representation of this value. */
54  inline void getDegMinSec( int &degrees, int &minutes, double &seconds) const
55  {
56  double aux = std::abs(decimal_value);
57  degrees = (int)aux;
58  minutes = (int)((aux - degrees)*60.0f);
59  seconds = ((aux - degrees)*60.0f - minutes)*60.0f;
60  if( decimal_value<0 ) degrees = -degrees;
61  }
62 
63  /** Set the coordinate from its Deg Min' Deg'' parts. */
64  inline void setDegMinSec(const int degrees, const int minutes, const double seconds)
65  {
66  decimal_value = std::abs(degrees)+minutes/60.0+seconds/3600.0;
67  if(degrees<0) decimal_value = - decimal_value;
68  }
69 
70  /** Return a string in the format "DEGdeg MIN' SEC''" */
71  inline std::string getAsString() const
72  {
73  int deg,min;
74  double sec;
75  getDegMinSec( deg,min,sec);
76  return mrpt::format("%ddeg %d' %.04f''",deg,min,sec );
77  }
78 
79  };
80 
81  bool TOPO_IMPEXP operator ==(const TCoords &a, const TCoords &o);
82  bool TOPO_IMPEXP operator !=(const TCoords &a, const TCoords &o);
83 
84  std::ostream TOPO_IMPEXP & operator<<( std::ostream& out, const TCoords &o );
85 
87  {
88  inline TEllipsoid() : sa( 6378137.0 ), sb( 6356752.314245 ), name("WGS84") {}
89  inline TEllipsoid( const double _sa, const double _sb, const string _name ) : sa(_sa), sb(_sb), name(_name) {}
90 
91  double sa; //!< largest semiaxis of the reference ellipsoid (in meters)
92  double sb; //!< smallest semiaxis of the reference ellipsoid (in meters)
93  string name; //!< the ellipsoid name
94 
95 
96  static inline TEllipsoid Ellipsoid_WGS84() { return TEllipsoid( 6378137.000, 6356752.314245, "WGS84" ); }
97  static inline TEllipsoid Ellipsoid_WGS72() { return TEllipsoid( 6378135.000, 6356750.519915, "WGS72" ); }
98  static inline TEllipsoid Ellipsoid_WGS66() { return TEllipsoid( 6378145.000, 6356759.769356, "WGS66" ); }
99  static inline TEllipsoid Ellipsoid_Walbeck_1817() { return TEllipsoid( 6376896.000, 6355834.846700, "Walbeck_1817" ); }
100  static inline TEllipsoid Ellipsoid_Sudamericano_1969() { return TEllipsoid( 6378160.000, 6356774.720000, "Sudamericano_1969" ); }
101  static inline TEllipsoid Ellipsoid_Nuevo_Internacional_1967() {return TEllipsoid( 6378157.500, 6356772.200000, "Nuevo_Internacional_1967" ); }
102  static inline TEllipsoid Ellipsoid_Mercury_Modificado_1968() { return TEllipsoid( 6378150.000, 6356768.337303, "Mercury_Modificado_1968" ); }
103  static inline TEllipsoid Ellipsoid_Mercury_1960() { return TEllipsoid( 6378166.000, 6356784.283666, "Mercury_1960" ); }
104  static inline TEllipsoid Ellipsoid_Krasovsky_1940() { return TEllipsoid( 6378245.000, 6356863.018800, "Krasovsky_1940" ); }
105  static inline TEllipsoid Ellipsoid_Internacional_1924() { return TEllipsoid( 6378388.000, 6356911.946130, "Internacional_1924" ); }
106  static inline TEllipsoid Ellipsoid_Internacional_1909() { return TEllipsoid( 6378388.000, 6356911.946130, "Internacional_1909" ); }
107  static inline TEllipsoid Ellipsoid_Hough_1960() { return TEllipsoid( 6378270.000, 6356794.343479, "Hough_1960" ); }
108  static inline TEllipsoid Ellipsoid_Helmert_1906() { return TEllipsoid( 6378200.000, 6356818.170000, "Helmert_1906" ); }
109  static inline TEllipsoid Ellipsoid_Hayford_1909() { return TEllipsoid( 6378388.000, 6356911.946130, "Hayford_1909" ); }
110  static inline TEllipsoid Ellipsoid_GRS80() { return TEllipsoid( 6378137.000, 6356752.314140, "GRS80" ); }
111  static inline TEllipsoid Ellipsoid_Fischer_1968() { return TEllipsoid( 6378150.000, 6356768.330000, "Fischer_1968" ); }
112  static inline TEllipsoid Ellipsoid_Fischer_1960() { return TEllipsoid( 6378166.000, 6356784.280000, "Fischer_1960" ); }
113  static inline TEllipsoid Ellipsoid_Clarke_1880() { return TEllipsoid( 6378249.145, 6356514.869550, "Clarke_1880" ); }
114  static inline TEllipsoid Ellipsoid_Clarke_1866() { return TEllipsoid( 6378206.400, 6356583.800000, "Clarke_1866" ); }
115  static inline TEllipsoid Ellipsoid_Bessel_1841() { return TEllipsoid( 6377397.155, 6356078.962840, "Bessel_1841" ); }
116  static inline TEllipsoid Ellipsoid_Airy_Modificado_1965() { return TEllipsoid( 6377340.189, 6356034.447900, "Airy_Modificado_1965" ); }
117  static inline TEllipsoid Ellipsoid_Airy_1830() { return TEllipsoid( 6377563.396, 6356256.910000, "Airy_1830" ); }
118  };
119 
120 
123 
124  /** A set of geodetic coordinates: latitude, longitude and height, defined over a given geoid (typically, WGS84) */
126  {
127  TGeodeticCoords() : lat(0),lon(0),height(0) {}
128  TGeodeticCoords(const double _lat, const double _lon, const double _height) : lat(_lat),lon(_lon),height(_height) {}
129 
130  inline bool isClear() const { return lat.getDecimalValue()==0 && lon.getDecimalValue()==0 && height==0; }
131 
132  TCoords lat; //!< Latitude (in degrees)
133  TCoords lon; //!< Longitude (in degrees)
134  double height; //!< Geodetic height (in meters)
135 
136  };
137 
138  bool TOPO_IMPEXP operator ==(const TGeodeticCoords &a, const TGeodeticCoords &o);
139  bool TOPO_IMPEXP operator !=(const TGeodeticCoords &a, const TGeodeticCoords &o);
140 
141  /** Parameters for a topographic transfomation
142  * \sa TDatum10Params, transform7params
143  */
145  {
146  double dX, dY, dZ; //!< Deltas (X,Y,Z)
147  double Rx, Ry, Rz; //!< Rotation components (in secs)
148  double dS; //!< Scale factor (in ppm) (Scale is 1+dS/1e6)
149 
151  const double _dX, const double _dY, const double _dZ,
152  const double _Rx, const double _Ry, const double _Rz,
153  const double _dS ) :
154  dX(_dX), dY(_dY), dZ(_dZ)
155  {
156  Rx = DEG2RAD(_Rx/60/60);
157  Ry = DEG2RAD(_Ry/60/60);
158  Rz = DEG2RAD(_Rz/60/60);
159  dS = _dS*1e-6;
160  }
161  };
162 
164  {
165  double dX, dY, dZ; //!< Deltas (X,Y,Z)
166  double m11, m12, m13, m21, m22, m23, m31, m32, m33;
167  double dS; //!< Scale factor (in ppm) (Scale is 1+dS/1e6)
168 
170  const double _dX, const double _dY, const double _dZ,
171  const double _m11, const double _m12, const double _m13,
172  const double _m21, const double _m22, const double _m23,
173  const double _m31, const double _m32, const double _m33,
174  const double _dS ) :
175  dX(_dX), dY(_dY), dZ(_dZ), m11(_m11), m12(_m12), m13(_m13), m21(_m21), m22(_m22), m23(_m23), m31(_m31), m32(_m32), m33(_m33)
176  {
177  dS = _dS*1e-6;
178  }
179  };
180 
181 
182  /** Parameters for a topographic transfomation
183  * \sa TDatum7Params, transform10params
184  */
186  {
187  double dX, dY, dZ; //!< Deltas (X,Y,Z)
188  double Xp, Yp, Zp; //!< To be substracted to the input point
189  double Rx, Ry, Rz; //!< Rotation components
190  double dS; //!< Scale factor (Scale is 1+dS)
191 
193  const double _dX, const double _dY, const double _dZ,
194  const double _Xp, const double _Yp, const double _Zp,
195  const double _Rx, const double _Ry, const double _Rz,
196  const double _dS ) :
197  dX(_dX), dY(_dY), dZ(_dZ), Xp(_Xp), Yp(_Yp), Zp(_Zp)
198  {
199  Rx = DEG2RAD(_Rx/60/60);
200  Ry = DEG2RAD(_Ry/60/60);
201  Rz = DEG2RAD(_Rz/60/60);
202  dS = _dS*1e-6;
203  }
204  };
205 
206  /** Parameters for a topographic transfomation
207  * \sa TDatumHelmert3D, transformHelmert2D
208  */
210  {
211  double dX, dY; //!< Deltas [X,Y]
212  double alpha; // The rotation about Z-axis (degrees)
213  double dS; // Scale factor (Scale is 1+dS)
214  double Xp, Yp; // Coordinates of the rotation point
215 
217  const double _dX, const double _dY,
218  const double _alpha, const double _dS,
219  const double _Xp, const double _Yp ) :
220  dX(_dX), dY(_dY), Xp(_Xp), Yp(_Yp)
221  {
222  alpha = DEG2RAD(_alpha);
223  dS = _dS*1e-6;
224  }
225  };
226 
228  {
229  double a,b,c,d;
230 
232  const double _a, const double _b,
233  const double _c, const double _d ) :
234  a(_a), b(_b), c(_c), d(_d) {}
235 
236  };
237 
238  /** Parameters for a topographic transfomation
239  * \sa TDatumHelmert2D, transformHelmert3D
240  */
242  {
243  double dX, dY, dZ; //!< Deltas (X,Y,Z)
244  double Rx, Ry, Rz; //!< Rotation components
245  double dS; //!< Scale factor (Scale is 1+dS)
246 
248  const double _dX, const double _dY, const double _dZ,
249  const double _Rx, const double _Ry, const double _Rz,
250  const double _dS ) :
251  dX(_dX), dY(_dY), dZ(_dZ)
252  {
253  Rx = DEG2RAD(_Rx/60/60);
254  Ry = DEG2RAD(_Ry/60/60);
255  Rz = DEG2RAD(_Rz/60/60);
256  dS = _dS*1e-6;
257  }
258  };
259 
260  /** Parameters for a topographic transfomation
261  * \sa TDatumHelmert2D, transformHelmert3D
262  */
264  {
265  double a,b,c,d,e,f,g;
266 
268  const double _a, const double _b, const double _c,
269  const double _d, const double _e, const double _f, const double _g ) :
270  a(_a), b(_b), c(_c), d(_d), e(_e), f(_f), g(_g) { }
271  };
272 
273  /** Parameters for a topographic transfomation
274  * \sa transform1D
275  */
277  {
278  double dX, dY, DZ; //!< Deltas (X,Y,Z)
279  double dS; //!< Scale factor (Scale is 1+dS)
280 
282  const double _dX, const double _dY, const double _DZ,
283  const double _dS ) :
284  dX(_dX), dY(_dY), DZ(_DZ)
285  {
286  dS = _dS*1e-6;
287  }
288  };
289 
290  /** Parameters for a topographic transfomation
291  * \sa transform1D
292  */
294  {
295  double dX, dY; //!< Deltas (X,Y,Z)
296  double dSx, dSy; //!< Scale factor in X and Y
297  double beta; //!< Distortion angle
298 
300  const double _dX, const double _dY,
301  const double _dSx, const double _dSy, const double _beta ) :
302  dX(_dX), dY(_dY)
303  {
304  dSx = _dSx*1e-6;
305  dSy = _dSy*1e-6;
306  beta = DEG2RAD(_beta/60/60);
307  }
308  };
309 
310  /** @} */
311 
312  /** @} */ // end of grouping
313 
314  } // End of namespace
315 
316 } // End of namespace
317 
318 #endif
double dZ
Deltas (X,Y,Z)
Definition: data_types.h:146
double sa
largest semiaxis of the reference ellipsoid (in meters)
Definition: data_types.h:91
static TEllipsoid Ellipsoid_Fischer_1968()
Definition: data_types.h:111
double getDecimalValue() const
Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoo...
Definition: data_types.h:51
static TEllipsoid Ellipsoid_Fischer_1960()
Definition: data_types.h:112
bool TOPO_IMPEXP operator==(const TCoords &a, const TCoords &o)
Classes for serialization, sockets, ini-file manipulation, streams, list of properties-values, timewatch, extensions to STL.
Definition: zip.h:16
static TEllipsoid Ellipsoid_Sudamericano_1969()
Definition: data_types.h:100
static TEllipsoid Ellipsoid_Airy_1830()
Definition: data_types.h:117
TDatum1DTransf(const double _dX, const double _dY, const double _DZ, const double _dS)
Definition: data_types.h:281
double dS
Scale factor (in ppm) (Scale is 1+dS/1e6)
Definition: data_types.h:167
Parameters for a topographic transfomation.
Definition: data_types.h:241
TDatum7Params(const double _dX, const double _dY, const double _dZ, const double _Rx, const double _Ry, const double _Rz, const double _dS)
Definition: data_types.h:150
Parameters for a topographic transfomation.
Definition: data_types.h:209
double dZ
Deltas (X,Y,Z)
Definition: data_types.h:187
double Rz
Rotation components.
Definition: data_types.h:244
TDatumHelmert3D(const double _dX, const double _dY, const double _dZ, const double _Rx, const double _Ry, const double _Rz, const double _dS)
Definition: data_types.h:247
A set of geodetic coordinates: latitude, longitude and height, defined over a given geoid (typically...
Definition: data_types.h:125
double Rz
Rotation components (in secs)
Definition: data_types.h:147
double dS
Scale factor (in ppm) (Scale is 1+dS/1e6)
Definition: data_types.h:148
double dSy
Scale factor in X and Y.
Definition: data_types.h:296
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:279
string name
the ellipsoid name
Definition: data_types.h:93
TEllipsoid(const double _sa, const double _sb, const string _name)
Definition: data_types.h:89
STL namespace.
static TEllipsoid Ellipsoid_Krasovsky_1940()
Definition: data_types.h:104
void getDegMinSec(int &degrees, int &minutes, double &seconds) const
Return the Deg Min&#39; Sec&#39;&#39; representation of this value.
Definition: data_types.h:54
void setFromDecimal(const double dec)
Set from a decimal value (XX.YYYYY) in degrees.
Definition: data_types.h:48
A coordinate that is stored as a simple "decimal" angle in degrees, but can be retrieved/set in the f...
Definition: data_types.h:32
std::string getAsString() const
Return a string in the format "DEGdeg MIN&#39; SEC&#39;&#39;".
Definition: data_types.h:71
double DZ
Deltas (X,Y,Z)
Definition: data_types.h:278
TDatumHelmert2D_TOPCON(const double _a, const double _b, const double _c, const double _d)
Definition: data_types.h:231
Parameters for a topographic transfomation.
Definition: data_types.h:263
static TEllipsoid Ellipsoid_WGS66()
Definition: data_types.h:98
double sb
smallest semiaxis of the reference ellipsoid (in meters)
Definition: data_types.h:92
Parameters for a topographic transfomation.
Definition: data_types.h:276
double Rz
Rotation components.
Definition: data_types.h:189
static TEllipsoid Ellipsoid_Nuevo_Internacional_1967()
Definition: data_types.h:101
TCoords lon
Longitude (in degrees)
Definition: data_types.h:133
static TEllipsoid Ellipsoid_Helmert_1906()
Definition: data_types.h:108
mrpt::math::TPoint3D TGeocentricCoords
Definition: data_types.h:122
static TEllipsoid Ellipsoid_Internacional_1909()
Definition: data_types.h:106
double Zp
To be substracted to the input point.
Definition: data_types.h:188
static TEllipsoid Ellipsoid_Mercury_1960()
Definition: data_types.h:103
static TEllipsoid Ellipsoid_Mercury_Modificado_1968()
Definition: data_types.h:102
static TEllipsoid Ellipsoid_WGS72()
Definition: data_types.h:97
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:190
static TEllipsoid Ellipsoid_Hough_1960()
Definition: data_types.h:107
static TEllipsoid Ellipsoid_Walbeck_1817()
Definition: data_types.h:99
static TEllipsoid Ellipsoid_Clarke_1880()
Definition: data_types.h:113
static TEllipsoid Ellipsoid_GRS80()
Definition: data_types.h:110
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
T abs(T x)
Definition: nanoflann.hpp:214
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:245
static TEllipsoid Ellipsoid_WGS84()
Definition: data_types.h:96
TCoords(const int _deg, const int _min, const double _sec)
Definition: data_types.h:37
std::ostream TOPO_IMPEXP & operator<<(std::ostream &out, const TCoords &o)
TDatum10Params(const double _dX, const double _dY, const double _dZ, const double _Xp, const double _Yp, const double _Zp, const double _Rx, const double _Ry, const double _Rz, const double _dS)
Definition: data_types.h:192
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TCoords(const double dec)
Definition: data_types.h:38
TGeodeticCoords(const double _lat, const double _lon, const double _height)
Definition: data_types.h:128
double dZ
Deltas (X,Y,Z)
Definition: data_types.h:243
TDatumTransfInterpolation(const double _dX, const double _dY, const double _dSx, const double _dSy, const double _beta)
Definition: data_types.h:299
static TEllipsoid Ellipsoid_Hayford_1909()
Definition: data_types.h:109
Parameters for a topographic transfomation.
Definition: data_types.h:185
TDatum7Params_TOPCON(const double _dX, const double _dY, const double _dZ, const double _m11, const double _m12, const double _m13, const double _m21, const double _m22, const double _m23, const double _m31, const double _m32, const double _m33, const double _dS)
Definition: data_types.h:169
TDatumHelmert2D(const double _dX, const double _dY, const double _alpha, const double _dS, const double _Xp, const double _Yp)
Definition: data_types.h:216
void setDegMinSec(const int degrees, const int minutes, const double seconds)
Set the coordinate from its Deg Min&#39; Deg&#39;&#39; parts.
Definition: data_types.h:64
double height
Geodetic height (in meters)
Definition: data_types.h:134
static TEllipsoid Ellipsoid_Clarke_1866()
Definition: data_types.h:114
mrpt::math::TPoint3D TUTMCoords
Definition: data_types.h:121
static TEllipsoid Ellipsoid_Bessel_1841()
Definition: data_types.h:115
TDatumHelmert3D_TOPCON(const double _a, const double _b, const double _c, const double _d, const double _e, const double _f, const double _g)
Definition: data_types.h:267
Lightweight 3D point.
double decimal_value
Also obtained directly through the double(void) operator using a TCoords anywhere were a double is ex...
Definition: data_types.h:35
static TEllipsoid Ellipsoid_Internacional_1924()
Definition: data_types.h:105
Parameters for a topographic transfomation.
Definition: data_types.h:144
Parameters for a topographic transfomation.
Definition: data_types.h:293
TCoords lat
Latitude (in degrees)
Definition: data_types.h:132
bool TOPO_IMPEXP operator!=(const TCoords &a, const TCoords &o)
static TEllipsoid Ellipsoid_Airy_Modificado_1965()
Definition: data_types.h:116



Page generated by Doxygen 1.8.14 for MRPT 1.1.0 SVN: at lun oct 28 00:54:49 CET 2019 Hosted on:
SourceForge.net Logo