source: pacpusframework/trunk/include/Pacpus/PacpusTools/geodesie.h@ 222

Last change on this file since 222 was 220, checked in by Marek Kurdej, 11 years ago

Update: using directive.

  • Property svn:executable set to *
File size: 7.7 KB
RevLine 
[89]1// %pacpus:license{
2// This file is part of the PACPUS framework distributed under the
3// CECILL-C License, Version 1.0.
4// %}
5/// @file
[208]6/// @author Marek Kurdej <firstname.surname@utc.fr>
[162]7/// @author Jean Laneurit <firstname.surname@utc.fr>
8/// @date April, 2010
[89]9/// @version $Id: geodesie.h 75 2013-01-10 17:04:19Z kurdejma $
10/// @copyright Copyright (c) UTC/CNRS Heudiasyc 2006 - 2013. All rights reserved.
11/// @brief Brief description.
12///
13/// Detailed description.
14
15#ifndef GEODESIE_H
16#define GEODESIE_H
17
[198]18#include "PacpusToolsConfig.h"
19
[210]20#include <Pacpus/kernel/pacpus.h>
21
[208]22#include <boost/math/constants/constants.hpp>
[213]23#include <boost/operators.hpp>
[89]24#include <cmath>
25#include <iostream>
26#include <vector>
27
[212]28class QMatrix4x4;
29class QVector3D;
[99]30
[209]31namespace Geodesy
[208]32{
[89]33
[211]34/// 3x3 matrix ???
[89]35///
36/// @todo Documentation
37/// @todo Rewrite!
[162]38struct PACPUSTOOLS_API Matrice
[213]39 : boost::multipliable<Matrice>
[89]40{
41 /// Copy ctor
[210]42 Matrice(Matrice const& A);
[89]43 /// Ctor
44 Matrice();
[213]45 /// Ctor
46 Matrice(
47 double l0c0, double l0c1, double l0c2,
48 double l1c0, double l1c1, double l1c2,
49 double l2c0, double l2c1, double l2c2
50 );
51
[89]52 /// @todo Documentation
[210]53 void Apply(double v0, double v1, double v2, double& Mv0, double& Mv1, double& Mv2);
[89]54
[213]55 Matrice& operator*=(Matrice const& other);
56
[89]57 /// @todo Documentation
58 double c0_l0;
59 /// @todo Documentation
60 double c1_l0;
61 /// @todo Documentation
62 double c2_l0;
63
64 /// @todo Documentation
65 double c0_l1;
66 /// @todo Documentation
67 double c1_l1;
68 /// @todo Documentation
69 double c2_l1;
70
71 /// @todo Documentation
72 double c0_l2;
73 /// @todo Documentation
74 double c1_l2;
75 /// @todo Documentation
76 double c2_l2;
77};
78
[210]79PACPUSTOOLS_API Matrice TransMat(Matrice const& A);
[213]80PACPUSTOOLS_API PACPUS_DEPRECATED_MSG(Matrice ProdMat(Matrice const& A, Matrice const& B), "use Matrice::operator *");
[210]81PACPUSTOOLS_API PACPUS_DEPRECATED_MSG(void Write(Matrice const& A, std::ostream& out), "use operator<<");
82PACPUSTOOLS_API std::ostream& operator<<(std::ostream& os, Matrice const& A);
[89]83
84////////////////////////////////////////////////////////////////////////
85/// @todo Documentation
[162]86class PACPUSTOOLS_API Raf98
[89]87{
88public:
89 /// Ctor of Raf98 class.
[210]90 Raf98();
91
[89]92 /// Dtor of Raf98 class.
93 ~Raf98();
[210]94
[89]95 /// @todo Documentation
[211]96 /// @param filepath Path to the input file with RAF98 data.
97 bool Load(const std::string& filepath);
[210]98
[89]99 /// @todo Documentation
100 /// @param longitude [degrees]
101 /// @param latitude [degrees]
102 /// @param Hwgs84 Output: interpolated altitude using WGS84 geoid model [meters]
[210]103 bool Interpol(double longitude /*deg*/, double latitude /*deg*/, double* Hwgs84) const;
104
[89]105private:
106 std::vector<double> m_dvalues;
[210]107 double LitGrille(unsigned int c, unsigned int l) const;
[89]108};
109
110////////////////////////////////////////////////////////////////////////
111
112////////////////////////////////////////////////////////////////////////
[149]113inline double Deg2Rad(double deg)
114{
[211]115 using ::boost::math::constants::pi;
[208]116 return deg * pi<double>() / 180.0;
[149]117}
118
119inline double Rad2Deg(double rad)
120{
[211]121 using ::boost::math::constants::pi;
[208]122 return rad * 180.0 / pi<double>();
[149]123}
124
[89]125////////////////////////////////////////////////////////////////////////
126
[210]127const double a_Lambert93 = 6378137;
128const double f_Lambert93 = 1 / 298.257222101;
129const double e_Lambert93 = sqrt(f_Lambert93 * (2 - f_Lambert93));
130const double lambda0_Lambert93 = Deg2Rad(3.0); //degres
131const double phi0_Lambert93 = Deg2Rad(46.5);
132const double phi1_Lambert93 = Deg2Rad(44.0);
133const double phi2_Lambert93 = Deg2Rad(49.0); //degres
134const double X0_Lambert93 = 700000; //
135const double Y0_Lambert93 = 6600000; //
[89]136const double n_Lambert93 = 0.7256077650;
137const double c_Lambert93 = 11754255.426;
138const double xs_Lambert93 = 700000;
139const double ys_Lambert93 = 12655612.050;
140
141const double GRS_a = 6378137;
[210]142const double GRS_f = 1 / 298.257222101;
143const double GRS_b = GRS_a * (1 - GRS_f);
144const double GRS_e = sqrt((pow(GRS_a, 2) - pow(GRS_b, 2)) / pow(GRS_a, 2));
[89]145
146////////////////////////////////////////////////////////////////////////
[210]147PACPUSTOOLS_API void Geographique_2_Lambert93(const Raf98& raf98, double lambda, double phi, double he, Matrice in, double& E, double& N, double& h, Matrice& out);
148PACPUSTOOLS_API void Geographique_2_Lambert93(const Raf98& raf98, double lambda, double phi, double he, double& E, double& N, double& h);
149PACPUSTOOLS_API void Lambert93_2_Geographique(const Raf98& raf98, double E, double N, double h, double& lambda, double& phi, double& he);
150PACPUSTOOLS_API void Lambert93_2_Geographique(const Raf98& raf98, double E, double N, double h, Matrice in, double& lambda, double& phi, double& he, Matrice& out);
[89]151/** Convert from geographique to ECEF.
152 * @param[in] longitude Longitude in radian.
153 * @param[in] latitude Latitude in radian.
154 * @param[in] he Height in meter.
155 */
[162]156PACPUSTOOLS_API void Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
[89]157/** Convert from ECEF two ENU.
158 * @param[in] lon0 Longitude of the origin in radian.
159 * @param[in] lat0 Latitude of the origin in radian.
160 * @param[in] he0 Height of the origin in radian.
161 */
[210]162PACPUSTOOLS_API void ECEF_2_ENU(double x, double y, double z, double& e, double& n, double& u, double lon0, double lat0, double he0);
[89]163////////////////////////////////////////////////////////////////////////
164
165///ALGO0001
166/// @todo Rename
[210]167PACPUSTOOLS_API double LatitueIsometrique(double latitude, double e);
[89]168///ALGO0002
169/// @todo Rename
[210]170PACPUSTOOLS_API double LatitueIsometrique2Lat(double latitude_iso, double e, double epsilon);
[89]171
172///ALGO0003
[162]173PACPUSTOOLS_API void Geo2ProjLambert(
[210]174 double lambda, double phi,
175 double n, double c, double e,
176 double lambdac, double xs, double ys,
177 double& X, double& Y);
[89]178///ALGO0004
[162]179PACPUSTOOLS_API void Proj2GeoLambert(
[210]180 double X, double Y,
181 double n, double c, double e,
182 double lambdac, double xs, double ys,
[89]183 double epsilon,
[210]184 double& lambda, double& phi);
[89]185
[162]186PACPUSTOOLS_API double ConvMerApp(double longitude);
[89]187
[211]188/// Converts Cartesian (x, y) coordinates to polar coordinates (r, theta)
[89]189template <typename _T1, typename _T2>
[210]190void cartesianToPolar(const _T1 x, const _T1 y, _T2& r, _T2& theta)
191{
[220]192 using ::std::atan2;
193 using ::std::sqrt;
194
195 r = sqrt(x * x + y * y);
196 theta = atan2(x, y);
[89]197}
198
[211]199/// Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates
[89]200template <typename _T1, typename _T2>
[210]201void polarToCartesian(const _T1 r, const _T1 theta, _T2& x, _T2& y)
202{
[220]203 using ::std::cos;
204 using ::std::sin;
205
206 x = r * cos(theta);
207 y = r * sin(theta);
[89]208}
209
[211]210/// Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
211/// Angles expressed in radians.
[89]212template <typename _T1, typename _T2>
[210]213void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2& r, _T2& theta, _T2& phi)
214{
[220]215 using ::std::acos;
216 using ::std::atan2;
217 using ::std::sqrt;
218
219 r = sqrt(x * x + y * y + z * z);
220 theta = acos(z / r);
221 phi = atan2(y, x);
[89]222}
223
[211]224/// Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
225/// Angles expressed in radians.
[89]226template <typename _T1, typename _T2>
[210]227void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2& x, _T2& y, _T2& z)
228{
[220]229 using ::std::cos;
230 using ::std::sin;
231
232 x = r * sin(theta) * cos(phi);
233 y = r * sin(theta) * sin(phi);
234 z = r * cos(theta);
[89]235}
236
[212]237PACPUSTOOLS_API QMatrix4x4 yprenuToMatrix(QVector3D angle, QVector3D position);
[99]238
[209]239} // namespace Geodesy
240
241namespace Geodesie
242{
[210]243using namespace Geodesy;
[89]244} // namespace Geodesie
245
246#endif // GEODESIE_H
Note: See TracBrowser for help on using the repository browser.