source: pacpusframework/branches/2.0-beta1/include/Pacpus/PacpusTools/geodesie.h@ 99

Last change on this file since 99 was 99, checked in by morasjul, 11 years ago

Add function Geodesie::yprenuToMatrix

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