source: pacpusframework/branches/0.0.x/include/Pacpus/PacpusTools/geodesie.h

Last change on this file was 311, checked in by DHERBOMEZ Gérald, 10 years ago

Add the dllexport/dllimport macro to geodesie functions (for Windows olny)

  • Property svn:keywords set to Id
File size: 6.7 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 Jean Laneurit <firstname.surname@utc.fr>
7/// @date April, 2010
8/// @version $Id: geodesie.h 311 2014-07-23 16:01:08Z gdherbom $
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 "Pacpus\kernel\PacpusToolsConfig.h"
22
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 PACPUSTOOLS_API 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 PACPUSTOOLS_API TransMat(const Matrice A);
72
73Matrice PACPUSTOOLS_API ProdMat(const Matrice A,const Matrice B);
74void Write(const Matrice A,std::ostream& out);
75
76////////////////////////////////////////////////////////////////////////
77/// @todo Documentation
78class PACPUSTOOLS_API 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 longitudeDegrees, double latitudeDegrees, double * heightMetersWgs84) 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 PACPUSTOOLS_API Deg2Rad(double deg) {return deg*M_PI/180.0;}
105inline double PACPUSTOOLS_API 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 PACPUSTOOLS_API Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out);
129void PACPUSTOOLS_API Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,double& E,double& N,double& h);
130void PACPUSTOOLS_API Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he);
131void PACPUSTOOLS_API 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.
136void PACPUSTOOLS_API Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
137/// Convert from ECEF two ENU.
138/// @param[in] lon0 Longitude of the origin in radian.
139/// @param[in] lat0 Latitude of the origin in radian.
140/// @param[in] he0 Height of the origin in radian.
141void PACPUSTOOLS_API ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0);
142////////////////////////////////////////////////////////////////////////
143
144///ALGO0001
145/// @todo Rename
146double PACPUSTOOLS_API LatitueIsometrique(double latitude,double e);
147///ALGO0002
148/// @todo Rename
149double PACPUSTOOLS_API LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon);
150
151///ALGO0003
152void PACPUSTOOLS_API Geo2ProjLambert(
153 double lambda,double phi,
154 double n, double c,double e,
155 double lambdac,double xs,double ys,
156 double& X,double& Y);
157///ALGO0004
158void PACPUSTOOLS_API Proj2GeoLambert(
159 double X,double Y,
160 double n, double c,double e,
161 double lambdac,double xs,double ys,
162 double epsilon,
163 double& lambda,double& phi);
164
165double PACPUSTOOLS_API ConvMerApp(double longitude);
166
167/// Converts Cartesian (x, y) coordinates to polar coordinates (r, theta)
168template <typename _T1, typename _T2>
169void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) {
170 r = std::sqrt(x*x + y*y);
171 theta = std::atan2(x, y);
172}
173
174/// Converts polar coordinates (r, theta) to Cartesian (x, y) coordinates
175template <typename _T1, typename _T2>
176void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) {
177 x = r * std::cos(theta);
178 y = r * std::sin(theta);
179}
180
181/// Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
182/// Angles expressed in radians.
183template <typename _T1, typename _T2>
184void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) {
185 r = std::sqrt(x*x + y*y + z*z);
186 theta = std::acos(z / r);
187 phi = std::atan2(y, x);
188}
189
190/// Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
191/// Angles expressed in radians.
192template <typename _T1, typename _T2>
193void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) {
194 x = r * std::sin(theta) * std::cos(phi);
195 y = r * std::sin(theta) * std::sin(phi);
196 z = r * std::cos(theta);
197}
198
199} // namespace Geodesie
200
201#endif // GEODESIE_H
Note: See TracBrowser for help on using the repository browser.