Ignore:
Timestamp:
04/08/16 15:40:57 (8 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/unexported/geodesie.h

    r3 r15  
    1313
    1414#ifndef M_PI
    15 #   define M_PI 3.14159265358979323846
     15#define M_PI 3.14159265358979323846
    1616#endif
    1717#ifndef M_PI_2
    18 #   define M_PI_2 1.57079632679489661923
     18#define M_PI_2 1.57079632679489661923
    1919#endif
    2020#ifndef M_PI_4
    21 #   define M_PI_4 0.78539816339744830962
     21#define M_PI_4 0.78539816339744830962
    2222#endif
    2323
    2424////////////////////////////////////////////////////////////////////////
    2525struct Matrice {
    26     Matrice(const Matrice & A);
    27     Matrice();
    28     void Apply(double v0, double v1, double v2, double & Mv0, double & Mv1, double & Mv2);
    29     double c0_l0;double c1_l0;double c2_l0;
    30     double c0_l1;double c1_l1;double c2_l1;
    31     double c0_l2;double c1_l2;double c2_l2;
     26  Matrice(const Matrice &A);
     27  Matrice();
     28  void Apply(double v0, double v1, double v2, double &Mv0, double &Mv1,
     29             double &Mv2);
     30  double c0_l0;
     31  double c1_l0;
     32  double c2_l0;
     33  double c0_l1;
     34  double c1_l1;
     35  double c2_l1;
     36  double c0_l2;
     37  double c1_l2;
     38  double c2_l2;
    3239}; // class
    3340
    3441Matrice TransMat(const Matrice A);
    3542
    36 Matrice ProdMat(const Matrice A,const Matrice B);
    37 void Write(const Matrice A,std::ostream& out);
     43Matrice ProdMat(const Matrice A, const Matrice B);
     44void Write(const Matrice A, std::ostream &out);
    3845
    3946////////////////////////////////////////////////////////////////////////
    4047class Raf98 {
    41 private :
    42     std::vector<double> m_dvalues;
    43     double LitGrille(unsigned int c,unsigned int l) const;
    44 public :
    45     ~Raf98();
    46     Raf98() {}
    47     bool Load(const std::string & s);
    48     bool Interpol(double longitude/*deg*/, double latitude/*deg*/, double* Hwgs84) const;
     48private:
     49  std::vector<double> m_dvalues;
     50  double LitGrille(unsigned int c, unsigned int l) const;
     51
     52public:
     53  ~Raf98();
     54  Raf98() {}
     55  bool Load(const std::string &s);
     56  bool Interpol(double longitude /*deg*/, double latitude /*deg*/,
     57                double *Hwgs84) const;
    4958}; // class
    5059////////////////////////////////////////////////////////////////////////
    5160
    5261////////////////////////////////////////////////////////////////////////
    53 inline double Deg2Rad(double deg) {return deg*M_PI/180.0;}
    54 inline double Rad2Deg(double rad) {return rad*180.0/M_PI;}
     62inline double Deg2Rad(double deg) { return deg * M_PI / 180.0; }
     63inline double Rad2Deg(double rad) { return rad * 180.0 / M_PI; }
    5564////////////////////////////////////////////////////////////////////////
    5665
    57 const double a_Lambert93=6378137;
    58 const double f_Lambert93=1 / 298.257222101;
    59 const double e_Lambert93=sqrt(f_Lambert93*(2-f_Lambert93));
    60 const double lambda0_Lambert93=Deg2Rad(3.0);//degres
    61 const double phi0_Lambert93=Deg2Rad(46.5);
    62 const double phi1_Lambert93=Deg2Rad(44.0);
    63 const double phi2_Lambert93=Deg2Rad(49.0);//degres
    64 const double X0_Lambert93=700000;//
    65 const double Y0_Lambert93=6600000;//
     66const double a_Lambert93 = 6378137;
     67const double f_Lambert93 = 1 / 298.257222101;
     68const double e_Lambert93 = sqrt(f_Lambert93 * (2 - f_Lambert93));
     69const double lambda0_Lambert93 = Deg2Rad(3.0); // degres
     70const double phi0_Lambert93 = Deg2Rad(46.5);
     71const double phi1_Lambert93 = Deg2Rad(44.0);
     72const double phi2_Lambert93 = Deg2Rad(49.0); // degres
     73const double X0_Lambert93 = 700000;  //
     74const double Y0_Lambert93 = 6600000; //
    6675const double n_Lambert93 = 0.7256077650;
    6776const double c_Lambert93 = 11754255.426;
     
    7079
    7180const double GRS_a = 6378137;
    72 const double GRS_f = 1/298.257222101;
    73 const double GRS_b = GRS_a*(1-GRS_f);
    74 const double GRS_e = sqrt((pow(GRS_a,2) - pow(GRS_b,2)) / pow(GRS_a,2));
     81const double GRS_f = 1 / 298.257222101;
     82const double GRS_b = GRS_a * (1 - GRS_f);
     83const double GRS_e = sqrt((pow(GRS_a, 2) - pow(GRS_b, 2)) / pow(GRS_a, 2));
    7584
    7685////////////////////////////////////////////////////////////////////////
    77 void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out);
    78 void Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,double& E,double& N,double& h);
    79 void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he);
    80 void Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out);
     86void Geographique_2_Lambert93(const Raf98 &raf98, double lambda, double phi,
     87                              double he, Matrice in, double &E, double &N,
     88                              double &h, Matrice &out);
     89void Geographique_2_Lambert93(const Raf98 &raf98, double lambda, double phi,
     90                              double he, double &E, double &N, double &h);
     91void Lambert93_2_Geographique(const Raf98 &raf98, double E, double N, double h,
     92                              double &lambda, double &phi, double &he);
     93void Lambert93_2_Geographique(const Raf98 &raf98, double E, double N, double h,
     94                              Matrice in, double &lambda, double &phi,
     95                              double &he, Matrice &out);
    8196/** Convert from geographique to ECEF.
    8297 * @param[in] longitude Longitude in radian.
     
    8499 * @param[in] he Height in meter.
    85100 */
    86 void Geographique_2_ECEF(double longitude, double latitude, double he, double& x, double& y, double& z);
     101void Geographique_2_ECEF(double longitude, double latitude, double he,
     102                         double &x, double &y, double &z);
    87103/** Convert from ECEF two ENU.
    88104 * @param[in] lon0 Longitude of the origin in radian.
     
    90106 * @param[in] he0 Height of the origin in radian.
    91107 */
    92 void ECEF_2_ENU(double x,double y,double z,double& e,double& n,double& u,double lon0,double lat0,double he0);
     108void ECEF_2_ENU(double x, double y, double z, double &e, double &n, double &u,
     109                double lon0, double lat0, double he0);
    93110////////////////////////////////////////////////////////////////////////
    94111
    95 //ALGO0001
    96 double LatitueIsometrique(double latitude,double e);
    97 //ALGO0002
    98 double LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon);
     112// ALGO0001
     113double LatitueIsometrique(double latitude, double e);
     114// ALGO0002
     115double LatitueIsometrique2Lat(double latitude_iso, double e, double epsilon);
    99116
    100 //ALGO0003
    101 void Geo2ProjLambert(
    102     double lambda,double phi,
    103     double n, double c,double e,
    104     double lambdac,double xs,double ys,
    105     double& X,double& Y);
    106 //ALGO0004
    107 void Proj2GeoLambert(
    108     double X,double Y,
    109     double n, double c,double e,
    110     double lambdac,double xs,double ys,
    111     double epsilon,
    112     double& lambda,double& phi);
     117// ALGO0003
     118void Geo2ProjLambert(double lambda, double phi, double n, double c, double e,
     119                     double lambdac, double xs, double ys, double &X,
     120                     double &Y);
     121// ALGO0004
     122void Proj2GeoLambert(double X, double Y, double n, double c, double e,
     123                     double lambdac, double xs, double ys, double epsilon,
     124                     double &lambda, double &phi);
    113125
    114126double ConvMerApp(double longitude);
     
    118130*/
    119131template <typename _T1, typename _T2>
    120 void cartesianToPolar(const _T1 x, const _T1 y, _T2 & r, _T2 & theta) {
    121     r = std::sqrt(x*x + y*y);
    122     theta = std::atan2(x, y);
     132void cartesianToPolar(const _T1 x, const _T1 y, _T2 &r, _T2 &theta) {
     133  r = std::sqrt(x * x + y * y);
     134  theta = std::atan2(x, y);
    123135}
    124136
     
    127139*/
    128140template <typename _T1, typename _T2>
    129 void polarToCartesian(const _T1 r, const _T1 theta, _T2 & x, _T2 & y) {
    130     x = r * std::cos(theta);
    131     y = r * std::sin(theta);
     141void polarToCartesian(const _T1 r, const _T1 theta, _T2 &x, _T2 &y) {
     142  x = r * std::cos(theta);
     143  y = r * std::sin(theta);
    132144}
    133145
    134146/**
    135 Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta, phi)
     147Converts Cartesian (x, y, z) coordinates to spherical coordinates (r, theta,
     148phi)
    136149Angles expressed in radians.
    137150*/
    138151template <typename _T1, typename _T2>
    139 void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 & r, _T2 & theta, _T2 & phi) {
    140     r = std::sqrt(x*x + y*y + z*z);
    141     theta = std::acos(z / r);
    142     phi = std::atan2(y, x);
     152void cartesianToSpherical(const _T1 x, const _T1 y, const _T1 z, _T2 &r,
     153                          _T2 &theta, _T2 &phi) {
     154  r = std::sqrt(x * x + y * y + z * z);
     155  theta = std::acos(z / r);
     156  phi = std::atan2(y, x);
    143157}
    144158
    145159/**
    146 Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z) coordinates.
     160Converts spherical coordinates (r, theta, phi) to Cartesian (x, y, z)
     161coordinates.
    147162Angles expressed in radians.
    148163*/
    149164template <typename _T1, typename _T2>
    150 void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 & x, _T2 & y, _T2 & z) {
    151     x = r * std::sin(theta) * std::cos(phi);
    152     y = r * std::sin(theta) * std::sin(phi);
    153     z = r * std::cos(theta);
     165void sphericalToCartesian(const _T1 r, const _T1 theta, const _T1 phi, _T2 &x,
     166                          _T2 &y, _T2 &z) {
     167  x = r * std::sin(theta) * std::cos(phi);
     168  y = r * std::sin(theta) * std::sin(phi);
     169  z = r * std::cos(theta);
    154170}
    155171
Note: See TracChangeset for help on using the changeset viewer.