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

Last change on this file since 67 was 67, checked in by Marek Kurdej, 12 years ago

Documentation: file info.
Fixed: problem with includes in PacpusPluginInterface.h.

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