Changeset 208 in pacpusframework


Ignore:
Timestamp:
11/06/13 11:22:15 (11 years ago)
Author:
Marek Kurdej
Message:

Minor: Geodesie.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/Pacpus/PacpusTools/geodesie.h

    r198 r208  
    44// %}
    55/// @file
     6/// @author  Marek Kurdej <firstname.surname@utc.fr>
    67/// @author  Jean Laneurit <firstname.surname@utc.fr>
    78/// @date    April, 2010
     
    1718#include "PacpusToolsConfig.h"
    1819
    19 //#include <boost/math/constants/constants.hpp>
     20#include <boost/math/constants/constants.hpp>
    2021#include <cmath>
    2122#include <iostream>
     
    2526#include <QVector3D>
    2627
    27 namespace Geodesie {
    28 
    29 #ifndef M_PI
    30 #   define M_PI 3.14159265358979323846
    31 #endif
    32 #ifndef M_PI_2
    33 #   define M_PI_2 1.57079632679489661923
    34 #endif
    35 #ifndef M_PI_4
    36 #   define M_PI_4 0.78539816339744830962
    37 #endif
     28namespace Geodesie
     29{
    3830
    3931/// 9x9 matrix ???
     
    10698inline double Deg2Rad(double deg)
    10799{
    108     return deg * M_PI / 180.0;
     100    using namespace ::boost::math::constants;
     101    return deg * pi<double>() / 180.0;
    109102}
    110103
    111104inline double Rad2Deg(double rad)
    112105{
    113     return rad * 180.0 / M_PI;
     106    using namespace ::boost::math::constants;
     107    return rad * 180.0 / pi<double>();
    114108}
    115109
  • trunk/src/PacpusTools/src/geodesie.cpp

    r198 r208  
    22// This file is part of the PACPUS framework distributed under the
    33// CECILL-C License, Version 1.0.
     4/// @author  Marek Kurdej <firstname.surname@utc.fr>
    45/// @author  Jean Laneurit <firstname.surname@utc.fr>
    56/// @date    April, 2010
     
    1011#include <fstream>
    1112
    12 //using boost::math::constants::pi;
     13using boost::math::constants::pi;
     14using boost::math::constants::half_pi;
    1315
    1416#ifdef _MSC_VER
     
    1618#endif //_MSC_VER
    1719
    18 namespace Geodesie {
    19 /// ////////////////////////////////////////////////////////////////////
    20 Matrice::Matrice(const Matrice & A) {
     20namespace Geodesie
     21{
     22
     23/// ////////////////////////////////////////////////////////////////////
     24Matrice::Matrice(const Matrice & A)
     25{
    2126    c0_l0=A.c0_l0;c1_l0=A.c1_l0;c2_l0=A.c2_l0;
    2227    c0_l1=A.c0_l1;c1_l1=A.c1_l1;c2_l1=A.c2_l1;
    2328    c0_l2=A.c0_l2;c1_l2=A.c1_l2;c2_l2=A.c2_l2;
    2429}
    25 /// ////////////////////////////////////////////////////////////////////
    26 Matrice::Matrice() {
     30
     31/// ////////////////////////////////////////////////////////////////////
     32Matrice::Matrice()
     33{
    2734    c0_l0=0.0;c1_l0=0.0;c2_l0=0.0;
    2835    c0_l1=0.0;c1_l1=0.0;c2_l1=0.0;
    2936    c0_l2=0.0;c1_l2=0.0;c2_l2=0.0;
    3037}
    31 /// ////////////////////////////////////////////////////////////////////
    32 void Matrice::Apply(double v0,double v1,double v2, double& Mv0,double& Mv1,double& Mv2) {
     38
     39/// ////////////////////////////////////////////////////////////////////
     40void Matrice::Apply(double v0,double v1,double v2, double& Mv0,double& Mv1,double& Mv2)
     41{
    3342    Mv0 = c0_l0*v0 + c1_l0*v1 + c2_l0*v2;
    3443    Mv1 = c0_l1*v0 + c1_l1*v1 + c2_l1*v2;
    3544    Mv2 = c0_l2*v0 + c1_l2*v1 + c2_l2*v2;
    3645}
    37 /// ////////////////////////////////////////////////////////////////////
    38 Matrice ProdMat(const Matrice A, const Matrice B) {
     46
     47/// ////////////////////////////////////////////////////////////////////
     48Matrice ProdMat(const Matrice A, const Matrice B)
     49{
    3950    Matrice out;
    4051
     
    5465
    5566/// ////////////////////////////////////////////////////////////////////
    56 Matrice TransMat(const Matrice A) {
     67Matrice TransMat(const Matrice A)
     68{
    5769    Matrice out;
    5870    out.c0_l0=A.c0_l0 ; out.c1_l0 = A.c0_l1 ; out.c2_l0 = A.c0_l2 ;
     
    112124    return true;
    113125}
    114 /// ////////////////////////////////////////////////////////////////////
    115 double Raf98::LitGrille(unsigned int c,unsigned int l) const{
     126
     127/// ////////////////////////////////////////////////////////////////////
     128double Raf98::LitGrille(unsigned int c,unsigned int l) const
     129{
    116130    const unsigned int w=421;
    117131    //    const unsigned int h=381;
    118132    return m_dvalues.at(c+l*w);
    119133}
    120 /// ////////////////////////////////////////////////////////////////////
    121 bool Raf98::Load(const std::string & sin) {
    122     std::ifstream in(sin.c_str());
     134
     135/// ////////////////////////////////////////////////////////////////////
     136bool Raf98::Load(const std::string & s)
     137{
     138    std::ifstream in(s.c_str());
    123139    unsigned int w = 421;
    124140    unsigned int h = 381;
     
    161177/// ////////////////////////////////////////////////////////////////////
    162178//ALGO0001
    163 double Geodesie::LatitueIsometrique(double latitude,double e) {
    164     double li;
    165     li = log(tan(M_PI_4 + latitude/2.)) + e*log( (1-e*sin(latitude))/(1+e*sin(latitude)) )/2;
     179double Geodesie::LatitueIsometrique(double latitude, double e)
     180{
     181    using ::std::log;
     182    using ::std::sin;
     183    using ::std::tan;
     184
     185    double li = log(tan(pi<double>() / 4. + latitude/2.)) + e*log( (1-e*sin(latitude))/(1+e*sin(latitude)) )/2;
    166186    return li;
    167187}
     
    169189/// ////////////////////////////////////////////////////////////////////
    170190//ALGO0002
    171 double Geodesie::LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon) {
    172     double latitude_i=2*atan(exp(latitude_iso)) - M_PI_2;
    173     double latitude_ip1=latitude_i+epsilon*2;
    174     while (fabs(latitude_i-latitude_ip1)>epsilon) {
    175         latitude_i=latitude_ip1;
    176         latitude_ip1=2*atan(
     191double Geodesie::LatitueIsometrique2Lat(double latitude_iso,double e,double epsilon)
     192{
     193    using ::std::atan;
     194    using ::std::exp;
     195    using ::std::abs;
     196    using ::std::log;
     197    using ::std::sin;
     198
     199    double latitude_i = 2 * atan(exp(latitude_iso)) - half_pi<double>();
     200    double latitude_ip1 = latitude_i + epsilon * 2;
     201    while (abs(latitude_i-latitude_ip1) > epsilon) {
     202        latitude_i = latitude_ip1;
     203        latitude_ip1 = 2 * atan(
    177204                    exp(e*0.5*
    178205                        log(
     
    181208                        )
    182209                    *exp(latitude_iso)
    183                     ) - M_PI_2;
     210                    ) - half_pi<double>();
    184211    }
    185212    return latitude_ip1;
     
    222249
    223250////////////////////////////////////////////////////////////////////
    224 void Geodesie::Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out) {
     251void Geodesie::Geographique_2_Lambert93(const Raf98& raf98,double lambda,double phi,double he,Matrice in,double& E,double& N,double& h,Matrice& out)
     252{
    225253    Matrice passage;
    226254    double conv=Geodesie::ConvMerApp(lambda);
     
    263291    h=he-diff_h;
    264292}
    265 /**
    266     Converts Lambert93 coordinates (East, North, Height) into geographical coordinates in radians (Longitude = Rad2Deg(lambda), Latitude = Rad2Deg(phi), Height)
    267 */
     293
     294/// Converts Lambert93 coordinates (East, North, Height) into geographical coordinates in radians (Longitude = Rad2Deg(lambda), Latitude = Rad2Deg(phi), Height)
    268295void Geodesie::Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,double& lambda,double& phi,double& he) {
    269296    Geodesie::Proj2GeoLambert(
     
    278305    he=h+diff_h;
    279306}
     307
    280308////////////////////////////////////////////////////////////////////////
    281309void Geodesie::Lambert93_2_Geographique(const Raf98& raf98,double E,double N,double h,Matrice in,double& lambda,double& phi,double& he,Matrice& out) {
     
    348376}
    349377
    350 QMatrix4x4 Geodesie::yprenuToMatrix(QVector3D angle, QVector3D position) {
    351 
     378QMatrix4x4 Geodesie::yprenuToMatrix(QVector3D angle, QVector3D position)
     379{
    352380    float c1 = cos(angle.x());
    353381    float c2 = cos(angle.y());
Note: See TracChangeset for help on using the changeset viewer.