paparazzi-commits
[Top][All Lists]

## [paparazzi-commits] [4349] add conversion between geocentric and geodeti

 From: Gautier Hattenberger Subject: [paparazzi-commits] [4349] add conversion between geocentric and geodetic latitude Date: Fri, 27 Nov 2009 13:36:28 +0000

```Revision: 4349
http://svn.sv.gnu.org/viewvc/?view=rev&root=paparazzi&revision=4349
Author:   gautier
Date:     2009-11-27 13:36:28 +0000 (Fri, 27 Nov 2009)
Log Message:
-----------
add conversion between geocentric and geodetic latitude

Modified Paths:
--------------
paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.c
paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.h

Modified: paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.c
===================================================================
--- paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.c    2009-11-27
13:35:15 UTC (rev 4348)
+++ paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.c    2009-11-27
13:36:28 UTC (rev 4349)
@@ -126,6 +126,14 @@
}

+double gc_of_gd_lat_d(double gd_lat, double hmsl) {
+  static const double a = 6378137.0;           /* earth semimajor axis in
meters */
+  static const double f = 1./298.257223563;    /* reciprocal flattening
*/
+  static const double c2 = (1-f)*(1-f);
+  /* geocentric latitude at the planet surface */
+  double ls = atan(c2*tan(gd_lat));
+  return atan2(hmsl*sin(gd_lat) + a*sin(ls), hmsl*cos(gd_lat) + a*cos(ls));
+}

Modified: paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.h
===================================================================
--- paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.h    2009-11-27
13:35:15 UTC (rev 4348)
+++ paparazzi3/trunk/sw/airborne/math/pprz_geodetic_double.h    2009-11-27
13:36:28 UTC (rev 4349)
@@ -56,6 +56,7 @@
extern void ecef_of_enu_vect_d(struct EcefCoor_d* ecef, struct LtpDef_d* def,
struct EnuCoor_d* enu);
extern void ecef_of_ned_vect_d(struct EcefCoor_d* ecef, struct LtpDef_d* def,
struct NedCoor_d* ned);

+extern double gc_of_gd_lat_d(double gd_lat, double hmsl);

#endif /* PPRZ_GEODETIC_DOUBLE_H */

```