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

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

Minor: Geodesie.

  • Property svn:executable set to *
File size: 6.9 KB
Line 
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
6/// @author Marek Kurdej <firstname.surname@utc.fr>
7/// @author Jean Laneurit <firstname.surname@utc.fr>
8/// @date April, 2010
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
18#include "PacpusToolsConfig.h"
19
20#include <boost/math/constants/constants.hpp>
21#include <cmath>
22#include <iostream>
23#include <vector>
24
25#include <QMatrix4x4>
26#include <QVector3D>
27
28namespace Geodesie
29{
30
31/// 9x9 matrix ???
32///
33/// @todo Documentation
34/// @todo Rewrite!
35struct PACPUSTOOLS_API Matrice
36{
37 /// Copy ctor
38 Matrice(const Matrice & A);
39 /// Ctor
40 Matrice();
41 /// @todo Documentation
42 void Apply(double v0, double v1, double v2, double & Mv0, double & Mv1, double & Mv2);
43
44 /// @todo Documentation
45 double c0_l0;
46 /// @todo Documentation
47 double c1_l0;
48 /// @todo Documentation
49 double c2_l0;
50
51 /// @todo Documentation
52 double c0_l1;
53 /// @todo Documentation
54 double c1_l1;
55 /// @todo Documentation
56 double c2_l1;
57
58 /// @todo Documentation
59 double c0_l2;
60 /// @todo Documentation
61 double c1_l2;
62 /// @todo Documentation
63 double c2_l2;
64};
65
66PACPUSTOOLS_API Matrice TransMat(const Matrice A);
67PACPUSTOOLS_API Matrice ProdMat(const Matrice A, const Matrice B);
68PACPUSTOOLS_API void Write(const Matrice A, std::ostream & out);
69
70////////////////////////////////////////////////////////////////////////
71/// @todo Documentation
72class PACPUSTOOLS_API Raf98
73{
74public:
75 /// Ctor of Raf98 class.
76 Raf98() {}
77 /// Dtor of Raf98 class.
78 ~Raf98();
79
80 /// @todo Documentation
81 /// @param s filepath
82 bool Load(const std::string & s);
83
84 /// @todo Documentation
85 /// @param longitude [degrees]
86 /// @param latitude [degrees]
87 /// @param Hwgs84 Output: interpolated altitude using WGS84 geoid model [meters]
88 bool Interpol(double longitude/*deg*/, double latitude/*deg*/, double* Hwgs84) const;
89
90private:
91 std::vector<double> m_dvalues;
92 double LitGrille(unsigned int c,unsigned int l) const;
93};
94
95////////////////////////////////////////////////////////////////////////
96
97////////////////////////////////////////////////////////////////////////
98inline double Deg2Rad(double deg)
99{
100 using namespace ::boost::math::constants;
101 return deg * pi<double>() / 180.0;
102}
103
104inline double Rad2Deg(double rad)
105{
106 using namespace ::boost::math::constants;
107 return rad * 180.0 / pi<double>();
108}
109
110////////////////////////////////////////////////////////////////////////
111
112const double a_Lambert93=6378137;
113const double f_Lambert93=1 / 298.257222101;
114const double e_Lambert93=sqrt(f_Lambert93*(2-f_Lambert93));
115const double lambda0_Lambert93=Deg2Rad(3.0);//degres
116const double phi0_Lambert93=Deg2Rad(46.5);
117const double phi1_Lambert93=Deg2Rad(44.0);
118const double phi2_Lambert93=Deg2Rad(49.0);//degres
119const double X0_Lambert93=700000;//
120const double Y0_Lambert93=6600000;//
121const double n_Lambert93 = 0.7256077650;
122const double c_Lambert93 = 11754255.426;
123const double xs_Lambert93 = 700000;
124const double ys_Lambert93 = 12655612.050;
125
126const double GRS_a = 6378137;
127const double GRS_f = 1/298.257222101;
128const double GRS_b = GRS_a*(1-GRS_f);
129const double GRS_e = sqrt((pow(GRS_a,2) - pow(GRS_b,2)) / pow(GRS_a,2));
130
131////////////////////////////////////////////////////////////////////////
132PACPUSTOOLS_API void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out);
133PACPUSTOOLS_API void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,double& E,double& N,double& h);
134PACPUSTOOLS_API void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he);
135PACPUSTOOLS_API void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out);
136/** Convert from geographique to ECEF.
137 * @param[in] longitude Longitude in radian.
138 * @param[in] latitude Latitude in radian.
139 * @param[in] he Height in meter.
140 */
141PACPUSTOOLS_API void Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
142/** Convert from ECEF two ENU.
143 * @param[in] lon0 Longitude of the origin in radian.
144 * @param[in] lat0 Latitude of the origin in radian.
145 * @param[in] he0 Height of the origin in radian.
146 */
147PACPUSTOOLS_API void ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0);
148////////////////////////////////////////////////////////////////////////
149
150///ALGO0001
151/// @todo Rename
152PACPUSTOOLS_API double LatitueIsometrique(double latitude,double e);
153///ALGO0002
154/// @todo Rename
155PACPUSTOOLS_API double LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon);
156
157///ALGO0003
158PACPUSTOOLS_API void Geo2ProjLambert(
159 double lambda,double phi,
160 double n, double c,double e,
161 double lambdac,double xs,double ys,
162 double& X,double& Y);
163///ALGO0004
164PACPUSTOOLS_API void Proj2GeoLambert(
165 double X,double Y,
166 double n, double c,double e,
167 double lambdac,double xs,double ys,
168 double epsilon,
169 double& lambda,double& phi);
170
171PACPUSTOOLS_API double ConvMerApp(double longitude);
172
173/**
174Converts Cartesian (x, y) coordinates to polar coordinates (r, theta)
175*/
176template <typename _T1, typename _T2>
177void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) {
178 r = std::sqrt(x*x + y*y);
179 theta = std::atan2(x, y);
180}
181
182/**
183Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates
184*/
185template <typename _T1, typename _T2>
186void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) {
187 x = r * std::cos(theta);
188 y = r * std::sin(theta);
189}
190
191/**
192Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
193Angles expressed in radians.
194*/
195template <typename _T1, typename _T2>
196void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) {
197 r = std::sqrt(x*x + y*y + z*z);
198 theta = std::acos(z / r);
199 phi = std::atan2(y, x);
200}
201
202/**
203Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
204Angles expressed in radians.
205*/
206template <typename _T1, typename _T2>
207void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) {
208 x = r * std::sin(theta) * std::cos(phi);
209 y = r * std::sin(theta) * std::sin(phi);
210 z = r * std::cos(theta);
211}
212
213PACPUSTOOLS_API QMatrix4x4 yprenuToMatrix(QVector3D angle, QVector3D position);
214
215} // namespace Geodesie
216
217#endif // GEODESIE_H
Note: See TracBrowser for help on using the repository browser.