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



Page generated by Doxygen 1.8.14 for MRPT 1.5.6 Git: 4c65e8431 Tue Apr 24 08:18:17 2018 +0200 at lun oct 28 01:35:26 CET 2019