Main MRPT website > C++ reference for MRPT 1.9.9
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-2017, 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 
15 namespace mrpt
16 {
17 namespace topography
18 {
19 /** \addtogroup mrpt_topography_grp
20  * @{ */
21 
22 /** @name Data structures
23  @{ */
24 
25 /** A coordinate that is stored as a simple "decimal" angle in degrees, but can
26  * be retrieved/set in the form of DEGREES + arc-MINUTES + arc-SECONDS.
27  */
28 struct TCoords
29 {
30  // Only keep one of the possible representations:
31  /** Also obtained directly through the double(void) operator using a TCoords
32  * anywhere were a double is expected. */
33  double decimal_value;
34 
35  inline TCoords(const int _deg, const int _min, const double _sec)
36  {
37  setDegMinSec(_deg, _min, _sec);
38  }
39  inline TCoords(const double dec) { setFromDecimal(dec); }
40  inline TCoords() { setFromDecimal(0); }
41  /** Automatic conversion to a double value (read-only) */
42  inline operator double(void) const { return decimal_value; }
43  /** Automatic conversion to a double value (read-only) */
44  inline operator double&(void) { return decimal_value; }
45  /** Set from a decimal value (XX.YYYYY) in degrees. */
46  inline void setFromDecimal(const double dec) { decimal_value = dec; }
47  /** Get the decimal value (XX.YYYYY), in degrees - you can also use the
48  * automatic conversion between TCoords and a double. */
49  inline double getDecimalValue() const { return decimal_value; }
50  /** Return the Deg Min' Sec'' representation of this value. */
51  inline void getDegMinSec(int& degrees, int& minutes, double& seconds) const
52  {
53  double aux = std::abs(decimal_value);
54  degrees = (int)aux;
55  minutes = (int)((aux - degrees) * 60.0f);
56  seconds = ((aux - degrees) * 60.0f - minutes) * 60.0f;
57  if (decimal_value < 0) degrees = -degrees;
58  }
59 
60  /** Set the coordinate from its Deg Min' Deg'' parts. */
61  inline void setDegMinSec(
62  const int degrees, const int minutes, const double seconds)
63  {
64  decimal_value = std::abs(degrees) + minutes / 60.0 + seconds / 3600.0;
65  if (degrees < 0) decimal_value = -decimal_value;
66  }
67 
68  /** Return a std::string in the format "DEGdeg MIN' SEC''" */
69  inline std::string getAsString() const
70  {
71  int deg, min;
72  double sec;
73  getDegMinSec(deg, min, sec);
74  return mrpt::format("%ddeg %d' %.04f''", deg, min, sec);
75  }
76 };
77 
78 bool operator==(const TCoords& a, const TCoords& o);
79 bool operator!=(const TCoords& a, const TCoords& o);
80 
81 std::ostream& operator<<(std::ostream& out, const TCoords& o);
82 
83 struct TEllipsoid
84 {
85  inline TEllipsoid() : sa(6378137.0), sb(6356752.314245), name("WGS84") {}
86  inline TEllipsoid(
87  const double _sa, const double _sb, const std::string& _name)
88  : sa(_sa), sb(_sb), name(_name)
89  {
90  }
91 
92  /** largest semiaxis of the reference ellipsoid (in meters) */
93  double sa;
94  /** smallest semiaxis of the reference ellipsoid (in meters) */
95  double sb;
96  /** the ellipsoid name */
98 
99  static inline TEllipsoid Ellipsoid_WGS84()
100  {
101  return TEllipsoid(6378137.000, 6356752.314245, "WGS84");
102  }
103  static inline TEllipsoid Ellipsoid_WGS72()
104  {
105  return TEllipsoid(6378135.000, 6356750.519915, "WGS72");
106  }
107  static inline TEllipsoid Ellipsoid_WGS66()
108  {
109  return TEllipsoid(6378145.000, 6356759.769356, "WGS66");
110  }
112  {
113  return TEllipsoid(6376896.000, 6355834.846700, "Walbeck_1817");
114  }
116  {
117  return TEllipsoid(6378160.000, 6356774.720000, "Sudamericano_1969");
118  }
120  {
121  return TEllipsoid(
122  6378157.500, 6356772.200000, "Nuevo_Internacional_1967");
123  }
125  {
126  return TEllipsoid(
127  6378150.000, 6356768.337303, "Mercury_Modificado_1968");
128  }
130  {
131  return TEllipsoid(6378166.000, 6356784.283666, "Mercury_1960");
132  }
134  {
135  return TEllipsoid(6378245.000, 6356863.018800, "Krasovsky_1940");
136  }
138  {
139  return TEllipsoid(6378388.000, 6356911.946130, "Internacional_1924");
140  }
142  {
143  return TEllipsoid(6378388.000, 6356911.946130, "Internacional_1909");
144  }
146  {
147  return TEllipsoid(6378270.000, 6356794.343479, "Hough_1960");
148  }
150  {
151  return TEllipsoid(6378200.000, 6356818.170000, "Helmert_1906");
152  }
154  {
155  return TEllipsoid(6378388.000, 6356911.946130, "Hayford_1909");
156  }
157  static inline TEllipsoid Ellipsoid_GRS80()
158  {
159  return TEllipsoid(6378137.000, 6356752.314140, "GRS80");
160  }
162  {
163  return TEllipsoid(6378150.000, 6356768.330000, "Fischer_1968");
164  }
166  {
167  return TEllipsoid(6378166.000, 6356784.280000, "Fischer_1960");
168  }
170  {
171  return TEllipsoid(6378249.145, 6356514.869550, "Clarke_1880");
172  }
174  {
175  return TEllipsoid(6378206.400, 6356583.800000, "Clarke_1866");
176  }
178  {
179  return TEllipsoid(6377397.155, 6356078.962840, "Bessel_1841");
180  }
182  {
183  return TEllipsoid(6377340.189, 6356034.447900, "Airy_Modificado_1965");
184  }
186  {
187  return TEllipsoid(6377563.396, 6356256.910000, "Airy_1830");
188  }
189 };
190 
193 
194 /** A set of geodetic coordinates: latitude, longitude and height, defined over
195  * a given geoid (typically, WGS84) */
197 {
198  TGeodeticCoords() : lat(0), lon(0), height(0) {}
199  TGeodeticCoords(const double _lat, const double _lon, const double _height)
200  : lat(_lat), lon(_lon), height(_height)
201  {
202  }
203 
204  inline bool isClear() const
205  {
206  return lat.getDecimalValue() == 0 && lon.getDecimalValue() == 0 &&
207  height == 0;
208  }
209 
210  /** Latitude (in degrees) */
212  /** Longitude (in degrees) */
214  /** Geodetic height (in meters) */
215  double height;
216 };
217 
218 bool operator==(const TGeodeticCoords& a, const TGeodeticCoords& o);
219 bool operator!=(const TGeodeticCoords& a, const TGeodeticCoords& o);
220 
221 /** Parameters for a topographic transfomation
222  * \sa TDatum10Params, transform7params
223  */
225 {
226  /** Deltas (X,Y,Z) */
227  double dX, dY, dZ;
228  /** Rotation components (in secs) */
229  double Rx, Ry, Rz;
230  /** Scale factor (in ppm) (Scale is 1+dS/1e6) */
231  double dS;
232 
234  const double _dX, const double _dY, const double _dZ, const double _Rx,
235  const double _Ry, const double _Rz, const double _dS)
236  : dX(_dX), dY(_dY), dZ(_dZ)
237  {
238  Rx = mrpt::utils::DEG2RAD(_Rx / 60 / 60);
239  Ry = mrpt::utils::DEG2RAD(_Ry / 60 / 60);
240  Rz = mrpt::utils::DEG2RAD(_Rz / 60 / 60);
241  dS = _dS * 1e-6;
242  }
243 };
244 
246 {
247  /** Deltas (X,Y,Z) */
248  double dX, dY, dZ;
249  double m11, m12, m13, m21, m22, m23, m31, m32, m33;
250  /** Scale factor (in ppm) (Scale is 1+dS/1e6) */
251  double dS;
252 
254  const double _dX, const double _dY, const double _dZ, const double _m11,
255  const double _m12, const double _m13, const double _m21,
256  const double _m22, const double _m23, const double _m31,
257  const double _m32, const double _m33, const double _dS)
258  : dX(_dX),
259  dY(_dY),
260  dZ(_dZ),
261  m11(_m11),
262  m12(_m12),
263  m13(_m13),
264  m21(_m21),
265  m22(_m22),
266  m23(_m23),
267  m31(_m31),
268  m32(_m32),
269  m33(_m33)
270  {
271  dS = _dS * 1e-6;
272  }
273 };
274 
275 /** Parameters for a topographic transfomation
276  * \sa TDatum7Params, transform10params
277  */
279 {
280  /** Deltas (X,Y,Z) */
281  double dX, dY, dZ;
282  /** To be substracted to the input point */
283  double Xp, Yp, Zp;
284  /** Rotation components */
285  double Rx, Ry, Rz;
286  /** Scale factor (Scale is 1+dS) */
287  double dS;
288 
290  const double _dX, const double _dY, const double _dZ, const double _Xp,
291  const double _Yp, const double _Zp, const double _Rx, const double _Ry,
292  const double _Rz, const double _dS)
293  : dX(_dX), dY(_dY), dZ(_dZ), Xp(_Xp), Yp(_Yp), Zp(_Zp)
294  {
295  Rx = mrpt::utils::DEG2RAD(_Rx / 60 / 60);
296  Ry = mrpt::utils::DEG2RAD(_Ry / 60 / 60);
297  Rz = mrpt::utils::DEG2RAD(_Rz / 60 / 60);
298  dS = _dS * 1e-6;
299  }
300 };
301 
302 /** Parameters for a topographic transfomation
303  * \sa TDatumHelmert3D, transformHelmert2D
304  */
306 {
307  /** Deltas [X,Y] */
308  double dX, dY;
309  double alpha; // The rotation about Z-axis (degrees)
310  double dS; // Scale factor (Scale is 1+dS)
311  double Xp, Yp; // Coordinates of the rotation point
312 
314  const double _dX, const double _dY, const double _alpha,
315  const double _dS, const double _Xp, const double _Yp)
316  : dX(_dX), dY(_dY), Xp(_Xp), Yp(_Yp)
317  {
318  alpha = mrpt::utils::DEG2RAD(_alpha);
319  dS = _dS * 1e-6;
320  }
321 };
322 
324 {
325  double a, b, c, d;
326 
328  const double _a, const double _b, const double _c, const double _d)
329  : a(_a), b(_b), c(_c), d(_d)
330  {
331  }
332 };
333 
334 /** Parameters for a topographic transfomation
335  * \sa TDatumHelmert2D, transformHelmert3D
336  */
338 {
339  /** Deltas (X,Y,Z) */
340  double dX, dY, dZ;
341  /** Rotation components */
342  double Rx, Ry, Rz;
343  /** Scale factor (Scale is 1+dS) */
344  double dS;
345 
347  const double _dX, const double _dY, const double _dZ, const double _Rx,
348  const double _Ry, const double _Rz, const double _dS)
349  : dX(_dX), dY(_dY), dZ(_dZ)
350  {
351  Rx = mrpt::utils::DEG2RAD(_Rx / 60 / 60);
352  Ry = mrpt::utils::DEG2RAD(_Ry / 60 / 60);
353  Rz = mrpt::utils::DEG2RAD(_Rz / 60 / 60);
354  dS = _dS * 1e-6;
355  }
356 };
357 
358 /** Parameters for a topographic transfomation
359  * \sa TDatumHelmert2D, transformHelmert3D
360  */
362 {
363  double a, b, c, d, e, f, g;
364 
366  const double _a, const double _b, const double _c, const double _d,
367  const double _e, const double _f, const double _g)
368  : a(_a), b(_b), c(_c), d(_d), e(_e), f(_f), g(_g)
369  {
370  }
371 };
372 
373 /** Parameters for a topographic transfomation
374  * \sa transform1D
375  */
377 {
378  /** Deltas (X,Y,Z) */
379  double dX, dY, DZ;
380  /** Scale factor (Scale is 1+dS) */
381  double dS;
382 
384  const double _dX, const double _dY, const double _DZ, const double _dS)
385  : dX(_dX), dY(_dY), DZ(_DZ)
386  {
387  dS = _dS * 1e-6;
388  }
389 };
390 
391 /** Parameters for a topographic transfomation
392  * \sa transform1D
393  */
395 {
396  /** Deltas (X,Y,Z) */
397  double dX, dY;
398  /** Scale factor in X and Y */
399  double dSx, dSy;
400  /** Distortion angle */
401  double beta;
402 
404  const double _dX, const double _dY, const double _dSx,
405  const double _dSy, const double _beta)
406  : dX(_dX), dY(_dY)
407  {
408  dSx = _dSx * 1e-6;
409  dSy = _dSy * 1e-6;
410  beta = mrpt::utils::DEG2RAD(_beta / 60 / 60);
411  }
412 };
413 
414 /** @} */
415 
416 /** @} */ // end of grouping
417 
418 } // End of namespace
419 
420 } // End of namespace
421 
422 #endif
double sa
largest semiaxis of the reference ellipsoid (in meters)
Definition: data_types.h:93
GLclampf GLclampf GLclampf alpha
Definition: glext.h:3525
static TEllipsoid Ellipsoid_Fischer_1968()
Definition: data_types.h:161
double getDecimalValue() const
Get the decimal value (XX.YYYYY), in degrees - you can also use the automatic conversion between TCoo...
Definition: data_types.h:49
static TEllipsoid Ellipsoid_Fischer_1960()
Definition: data_types.h:165
double dX
Deltas (X,Y,Z)
Definition: data_types.h:227
double dX
Deltas (X,Y,Z)
Definition: data_types.h:281
static TEllipsoid Ellipsoid_Sudamericano_1969()
Definition: data_types.h:115
#define min(a, b)
static TEllipsoid Ellipsoid_Airy_1830()
Definition: data_types.h:185
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
TDatum1DTransf(const double _dX, const double _dY, const double _DZ, const double _dS)
Definition: data_types.h:383
double dS
Scale factor (in ppm) (Scale is 1+dS/1e6)
Definition: data_types.h:251
double DEG2RAD(const double x)
Degrees to radians.
Parameters for a topographic transfomation.
Definition: data_types.h:337
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:233
Parameters for a topographic transfomation.
Definition: data_types.h:305
double Rx
Rotation components.
Definition: data_types.h:285
std::string name
the ellipsoid name
Definition: data_types.h:97
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:346
A set of geodetic coordinates: latitude, longitude and height, defined over a given geoid (typically...
Definition: data_types.h:196
double dS
Scale factor (in ppm) (Scale is 1+dS/1e6)
Definition: data_types.h:231
TEllipsoid(const double _sa, const double _sb, const std::string &_name)
Definition: data_types.h:86
bool operator!=(const TCoords &a, const TCoords &o)
Definition: conversions.cpp:28
bool operator==(const TCoords &a, const TCoords &o)
Definition: conversions.cpp:24
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:381
static TEllipsoid Ellipsoid_Krasovsky_1940()
Definition: data_types.h:133
double Xp
To be substracted to the input point.
Definition: data_types.h:283
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:51
double Rx
Rotation components.
Definition: data_types.h:342
void setFromDecimal(const double dec)
Set from a decimal value (XX.YYYYY) in degrees.
Definition: data_types.h:46
A coordinate that is stored as a simple "decimal" angle in degrees, but can be retrieved/set in the f...
Definition: data_types.h:28
double dSx
Scale factor in X and Y.
Definition: data_types.h:399
std::string getAsString() const
Return a std::string in the format "DEGdeg MIN&#39; SEC&#39;&#39;".
Definition: data_types.h:69
TDatumHelmert2D_TOPCON(const double _a, const double _b, const double _c, const double _d)
Definition: data_types.h:327
double Rx
Rotation components (in secs)
Definition: data_types.h:229
Parameters for a topographic transfomation.
Definition: data_types.h:361
static TEllipsoid Ellipsoid_WGS66()
Definition: data_types.h:107
double sb
smallest semiaxis of the reference ellipsoid (in meters)
Definition: data_types.h:95
Parameters for a topographic transfomation.
Definition: data_types.h:376
static TEllipsoid Ellipsoid_Nuevo_Internacional_1967()
Definition: data_types.h:119
TCoords lon
Longitude (in degrees)
Definition: data_types.h:213
static TEllipsoid Ellipsoid_Helmert_1906()
Definition: data_types.h:149
mrpt::math::TPoint3D TGeocentricCoords
Definition: data_types.h:192
static TEllipsoid Ellipsoid_Internacional_1909()
Definition: data_types.h:141
const GLubyte * c
Definition: glext.h:6313
static TEllipsoid Ellipsoid_Mercury_1960()
Definition: data_types.h:129
static TEllipsoid Ellipsoid_Mercury_Modificado_1968()
Definition: data_types.h:124
static TEllipsoid Ellipsoid_WGS72()
Definition: data_types.h:103
GLubyte g
Definition: glext.h:6279
GLubyte GLubyte b
Definition: glext.h:6279
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:287
static TEllipsoid Ellipsoid_Hough_1960()
Definition: data_types.h:145
static TEllipsoid Ellipsoid_Walbeck_1817()
Definition: data_types.h:111
static TEllipsoid Ellipsoid_Clarke_1880()
Definition: data_types.h:169
static TEllipsoid Ellipsoid_GRS80()
Definition: data_types.h:157
GLsizei const GLchar ** string
Definition: glext.h:4101
double dS
Scale factor (Scale is 1+dS)
Definition: data_types.h:344
static TEllipsoid Ellipsoid_WGS84()
Definition: data_types.h:99
TCoords(const int _deg, const int _min, const double _sec)
Definition: data_types.h:35
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:289
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
TCoords(const double dec)
Definition: data_types.h:39
TGeodeticCoords(const double _lat, const double _lon, const double _height)
Definition: data_types.h:199
TDatumTransfInterpolation(const double _dX, const double _dY, const double _dSx, const double _dSy, const double _beta)
Definition: data_types.h:403
static TEllipsoid Ellipsoid_Hayford_1909()
Definition: data_types.h:153
Parameters for a topographic transfomation.
Definition: data_types.h:278
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:253
TDatumHelmert2D(const double _dX, const double _dY, const double _alpha, const double _dS, const double _Xp, const double _Yp)
Definition: data_types.h:313
std::ostream & operator<<(std::ostream &out, const TCoords &o)
Definition: conversions.cpp:53
double dX
Deltas (X,Y,Z)
Definition: data_types.h:340
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:61
GLuint const GLchar * name
Definition: glext.h:4054
double height
Geodetic height (in meters)
Definition: data_types.h:215
static TEllipsoid Ellipsoid_Clarke_1866()
Definition: data_types.h:173
mrpt::math::TPoint3D TUTMCoords
Definition: data_types.h:191
static TEllipsoid Ellipsoid_Bessel_1841()
Definition: data_types.h:177
typedef void(APIENTRYP PFNGLBLENDCOLORPROC)(GLclampf red
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:365
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:33
static TEllipsoid Ellipsoid_Internacional_1924()
Definition: data_types.h:137
GLenum GLsizei GLsizei height
Definition: glext.h:3554
Parameters for a topographic transfomation.
Definition: data_types.h:224
Parameters for a topographic transfomation.
Definition: data_types.h:394
GLubyte GLubyte GLubyte a
Definition: glext.h:6279
TCoords lat
Latitude (in degrees)
Definition: data_types.h:211
static TEllipsoid Ellipsoid_Airy_Modificado_1965()
Definition: data_types.h:181
double dX
Deltas (X,Y,Z)
Definition: data_types.h:379



Page generated by Doxygen 1.8.14 for MRPT 1.9.9 Git: ae4571287 Thu Nov 23 00:06:53 2017 +0100 at dom oct 27 23:51:55 CET 2019