Geo Stars Library  0.9.3
Geodetic and Astrometry library
geoEfg2Llh_fast.c File Reference

This file contains the geo library routines for conversion between Geocentric and Geodetic coordinates. These routines are optimised for quick execution at the expense of precision. More...

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "geoStars.h"
Include dependency graph for geoEfg2Llh_fast.c:

Go to the source code of this file.

Functions

void geoEfg2Llh_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_hm_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Hirvonen & Moritz Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_hm_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_hm_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_hm_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_torge_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Torge Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_torge_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_torge_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_torge_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_bowring_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Bowring Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_bowring_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_bowring_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_bowring_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_aa_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Astronomical Almanac 2002 Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_aa_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_aa_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_aa_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_borkowski_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Borkowski Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_borkowski_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_borkowski_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_borkowski_fast (int datum, double e, double f, double g)
 
void geoEfg2Llh_vermeille_fast (int datum, double efg[], double *lat, double *lon, double *hgt)
 Vermeille Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$). More...
 
double geoEfg2Lat_vermeille_fast (int datum, double e, double f, double g)
 
double geoEfg2Lon_vermeille_fast (int datum, double e, double f, double g)
 
double geoEfg2Hgt_vermeille_fast (int datum, double e, double f, double g)
 

Detailed Description

This file contains the geo library routines for conversion between Geocentric and Geodetic coordinates. These routines are optimised for quick execution at the expense of precision.

Methods avalailable:

  • geoStarLib method
  • Hirvonen & Moritz method
  • Torge method
  • Astronomical Almanac 2002 method
  • Borkowski method
  • Bowring method
  • Vermeille method

Definition in file geoEfg2Llh_fast.c.

Function Documentation

double geoEfg2Hgt_aa_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 392 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_aa_fast().

393 {
394  double efg[3];
395  double lat, lon, hgt;
396  efg[GEO_E] = e;
397  efg[GEO_F] = f;
398  efg[GEO_G] = g;
399 
400  geoEfg2Llh_aa_fast (datum,efg,&lat,&lon,&hgt);
401  return(hgt);
402 }

Here is the call graph for this function:

double geoEfg2Hgt_borkowski_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 489 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_borkowski_fast().

490 {
491  double efg[3];
492  double lat, lon, hgt;
493  efg[GEO_E] = e;
494  efg[GEO_F] = f;
495  efg[GEO_G] = g;
496 
497  geoEfg2Llh_borkowski_fast (datum,efg,&lat,&lon,&hgt);
498  return(hgt);
499 }

Here is the call graph for this function:

double geoEfg2Hgt_bowring_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 318 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_bowring_fast().

319 {
320  double efg[3];
321  double lat, lon, hgt;
322  efg[GEO_E] = e;
323  efg[GEO_F] = f;
324  efg[GEO_G] = g;
325 
326  geoEfg2Llh_bowring_fast (datum,efg,&lat,&lon,&hgt);
327  return(hgt);
328 }

Here is the call graph for this function:

double geoEfg2Hgt_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 88 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_fast().

89 {
90  double efg[3];
91  double lat, lon, hgt;
92  efg[GEO_E] = e;
93  efg[GEO_F] = f;
94  efg[GEO_G] = g;
95 
96  geoEfg2Llh_fast (datum,efg,&lat,&lon,&hgt);
97  return(hgt);
98 }

Here is the call graph for this function:

double geoEfg2Hgt_hm_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 160 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_hm_fast().

161 {
162  double efg[3];
163  double lat, lon, hgt;
164  efg[GEO_E] = e;
165  efg[GEO_F] = f;
166  efg[GEO_G] = g;
167 
168  geoEfg2Llh_hm_fast (datum,efg,&lat,&lon,&hgt);
169  return(hgt);
170 }

Here is the call graph for this function:

double geoEfg2Hgt_torge_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 236 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_torge_fast().

237 {
238  double efg[3];
239  double lat, lon, hgt;
240  efg[GEO_E] = e;
241  efg[GEO_F] = f;
242  efg[GEO_G] = g;
243 
244  geoEfg2Llh_torge_fast (datum,efg,&lat,&lon,&hgt);
245  return(hgt);
246 }

Here is the call graph for this function:

double geoEfg2Hgt_vermeille_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 576 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, and geoEfg2Llh_vermeille_fast().

577 {
578  double efg[3];
579  double lat, lon, hgt;
580  efg[GEO_E] = e;
581  efg[GEO_F] = f;
582  efg[GEO_G] = g;
583 
584  geoEfg2Llh_vermeille_fast (datum,efg,&lat,&lon,&hgt);
585  return(hgt);
586 }

Here is the call graph for this function:

double geoEfg2Lat_aa_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 369 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_aa_fast(), and RAD_TO_DEG.

370 {
371  double efg[3];
372  double lat, lon, hgt;
373  efg[GEO_E] = e;
374  efg[GEO_F] = f;
375  efg[GEO_G] = g;
376 
377  geoEfg2Llh_aa_fast (datum,efg,&lat,&lon,&hgt);
378  return(RAD_TO_DEG * lat);
379 }

Here is the call graph for this function:

double geoEfg2Lat_borkowski_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 466 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_borkowski_fast(), and RAD_TO_DEG.

467 {
468  double efg[3];
469  double lat, lon, hgt;
470  efg[GEO_E] = e;
471  efg[GEO_F] = f;
472  efg[GEO_G] = g;
473 
474  geoEfg2Llh_borkowski_fast (datum,efg,&lat,&lon,&hgt);
475  return(RAD_TO_DEG * lat);
476 }

Here is the call graph for this function:

double geoEfg2Lat_bowring_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 295 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_bowring_fast(), and RAD_TO_DEG.

296 {
297  double efg[3];
298  double lat, lon, hgt;
299  efg[GEO_E] = e;
300  efg[GEO_F] = f;
301  efg[GEO_G] = g;
302 
303  geoEfg2Llh_bowring_fast (datum,efg,&lat,&lon,&hgt);
304  return(RAD_TO_DEG * lat);
305 }

Here is the call graph for this function:

double geoEfg2Lat_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 65 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_fast(), and RAD_TO_DEG.

66 {
67  double efg[3];
68  double lat, lon, hgt;
69  efg[GEO_E] = e;
70  efg[GEO_F] = f;
71  efg[GEO_G] = g;
72 
73  geoEfg2Llh_fast (datum,efg,&lat,&lon,&hgt);
74  return(RAD_TO_DEG * lat);
75 }

Here is the call graph for this function:

double geoEfg2Lat_hm_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 137 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_hm_fast(), and RAD_TO_DEG.

138 {
139  double efg[3];
140  double lat, lon, hgt;
141  efg[GEO_E] = e;
142  efg[GEO_F] = f;
143  efg[GEO_G] = g;
144 
145  geoEfg2Llh_hm_fast (datum,efg,&lat,&lon,&hgt);
146  return(RAD_TO_DEG * lat);
147 }

Here is the call graph for this function:

double geoEfg2Lat_torge_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 213 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_torge_fast(), and RAD_TO_DEG.

214 {
215  double efg[3];
216  double lat, lon, hgt;
217  efg[GEO_E] = e;
218  efg[GEO_F] = f;
219  efg[GEO_G] = g;
220 
221  geoEfg2Llh_torge_fast (datum,efg,&lat,&lon,&hgt);
222  return(RAD_TO_DEG * lat);
223 }

Here is the call graph for this function:

double geoEfg2Lat_vermeille_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 553 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_vermeille_fast(), and RAD_TO_DEG.

554 {
555  double efg[3];
556  double lat, lon, hgt;
557  efg[GEO_E] = e;
558  efg[GEO_F] = f;
559  efg[GEO_G] = g;
560 
561  geoEfg2Llh_vermeille_fast (datum,efg,&lat,&lon,&hgt);
562  return(RAD_TO_DEG * lat);
563 }

Here is the call graph for this function:

void geoEfg2Llh_aa_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Astronomical Almanac 2002 Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is a successive approximation from Astronomical Almanac 2002 K11-12

Definition at line 347 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_e2, n(), p, and sqr.

Referenced by geoEfg2Hgt_aa_fast(), geoEfg2Lat_aa_fast(), and geoEfg2Lon_aa_fast().

349 {
350  double phi,p,n;
351  double slat;
352 
353  // Computes EFG to lat, lon & height
354  // from the Astronomical Almanac 2002 - K11-12
355  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
356  p = sqrt(sqr(efg[GEO_E]) + sqr(efg[GEO_F]));
357 
358  // phi = atan(efg[GEO_G]/p); // first approximation
359  phi = atan(efg[GEO_G]/((1.0-GEO_WGS84_e2)*p)); // faster
360 
361  slat = sin(phi);
362  n = GEO_WGS84_a/sqrt(1.0 - GEO_WGS84_e2 * sqr(slat));
363  *lat = atan((efg[GEO_G] + n * GEO_WGS84_e2 * slat)/p);
364 
365  *hgt = p / cos(*lat) - n;
366 
367 }

Here is the call graph for this function:

void geoEfg2Llh_borkowski_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Borkowski Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is closed exact method from Bull. Geod., 63 (1989), pp. 50-56

Definition at line 420 of file geoEfg2Llh_fast.c.

References cube, GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_b, p, and sqr.

Referenced by geoEfg2Hgt_borkowski_fast(), geoEfg2Lat_borkowski_fast(), and geoEfg2Lon_borkowski_fast().

422 {
423  double a,b,r,e,f,p,q,d,v,g,t,sign,bg,samb,sqrtd,sqre,ar;
424  //double e2;
425 
426  /* Get the ellipsoid parameters */
427  // geoGetEllipsoid (&a, &b, &e2, &ee2, &flat, datum);
428  a=GEO_WGS84_a;
429  // b=GEO_WGS84_b;
430  // e2=GEO_WGS84_e2;
431 
432  // Computes EFG to lat, lon & height
433  // from Bull. Geod., 63 (1989), pp. 50-56
434  // Accurate Algorithms to Transform Geocentric to Geodetic Coordinates
435  // By K.M. Borkowski
436 
437  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
438 
439  //use the sign for Z
440  if(efg[GEO_G] < 0.0) sign = -1.0;
441  else sign = 1.0;
442  b = GEO_WGS84_b * sign;
443  bg = b * efg[GEO_G]; //temp
444  samb = sqr(a)-sqr(b) ;//temp
445  r = efg[GEO_E] / cos(*lon);
446  ar = a*r;
447  e = (bg - samb) / ar;
448  sqre = sqr(e);
449  f = (bg + samb) / ar;
450  p = 4.0/3.0*(e*f+1.0);
451  q = 2.0 * (sqre-sqr(f));
452  d = cube(p) + sqr(q);
453  sqrtd = sqrt(d);
454  if(d < 0.0)
455  v = 2.0 * sqrt(-p) * cos(acos(q/pow(-p,3.0/2.0))/3.0);
456  else
457  v = pow((sqrtd - q),1.0/3.0) - pow((sqrtd + q),1.0/3.0);
458  g = (sqrt(sqre+v) + e ) / 2.0;
459  t = sqrt(sqr(g)+((f-v*g)/(2.0*g-e))) - g;
460  *lat = atan(a*(1.0-sqr(t))/(2.0*b*t));
461 
462  *hgt = (r - a*t) * cos(*lat) + (efg[GEO_G]-b)*sin(*lat);
463 
464 }
void geoEfg2Llh_bowring_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Bowring Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is a successive approximation

Definition at line 264 of file geoEfg2Llh_fast.c.

References cube, GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_b, GEO_WGS84_e2, GEO_WGS84_ee2, n(), p, and sqr.

Referenced by geoEfg2Hgt_bowring_fast(), geoEfg2Lat_bowring_fast(), and geoEfg2Lon_bowring_fast().

266 {
267  double tmp,n,b0,p,slat,clat,ee2b,ae2;
268  //double boa;
269 
270  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
271  p = sqrt(sqr(efg[GEO_E])+ sqr(efg[GEO_F]));
272  tmp = efg[GEO_G] / p;
273 
274  // temps pulled out of the loop
275  ae2 = GEO_WGS84_a * GEO_WGS84_e2;
276  ee2b = GEO_WGS84_ee2 * GEO_WGS84_b;
277  //boa = GEO_WGS84_b/GEO_WGS84_a;
278 
279  // Prepare the initial value of lat
280  b0 = atan((GEO_WGS84_a/GEO_WGS84_b)*tmp);
281 
282  // iterate until delta lat is tiny
283  slat = sin(b0);
284  clat = cos(b0);
285  *lat = atan((efg[GEO_G]+ ee2b * cube(slat) ) /
286  (p - ae2 * cube(clat) ) );
287  // b0 = atan((boa) * tan(*lat));
288  slat = sin(*lat);
289  n= GEO_WGS84_a / sqrt(1.0-GEO_WGS84_e2*sqr(slat));
290 
291  *hgt = (p / cos(*lat)) - n;
292 
293 }

Here is the call graph for this function:

void geoEfg2Llh_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This routine will be exact only for WGS84 coordinates. All other datums will be slightly off.

Definition at line 40 of file geoEfg2Llh_fast.c.

References cube, GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_b, GEO_WGS84_e2, GEO_WGS84_ee2, p, and sqr.

Referenced by geoEfg2Hgt_fast(), geoEfg2Lat_fast(), and geoEfg2Lon_fast().

42 {
43  double p, u, su,cu,bee2,ae2,aob,slat;
44 
45  bee2 = GEO_WGS84_ee2 * GEO_WGS84_b;
46  ae2 = GEO_WGS84_e2 * GEO_WGS84_a;
47  aob = GEO_WGS84_a / GEO_WGS84_b;
48 
49  // Computes EFG to lat, lon & height
50  p = sqrt(sqr(efg[GEO_E]) + sqr(efg[GEO_F]));
51  u = atan((efg[GEO_G]/p) * aob);
52 
53  su = sin(u);
54  cu = cos(u);
55 
56  *lat = atan((efg[GEO_G] + bee2 * cube(su) ) /
57  ( p - ae2 * cube(cu) ) );
58  slat = sin(*lat);
59 
60  *hgt = p / cos(*lat) - ( GEO_WGS84_a / (sqrt(1.0 - GEO_WGS84_e2 * sqr(slat)))); //same results
61  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
62 
63 }
void geoEfg2Llh_hm_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Hirvonen & Moritz Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is a successive approximation

Definition at line 116 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_e2, n(), p, and sqr.

Referenced by geoEfg2Hgt_hm_fast(), geoEfg2Lat_hm_fast(), and geoEfg2Lon_hm_fast().

118 {
119  // double a, flat, b, e2, ee2;
120  double tmp,n,p,slat;
121 
122  p = sqrt(sqr(efg[GEO_E])+ sqr(efg[GEO_F]));
123  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
124 
125  // Prepare the initial value of lat
126  tmp = efg[GEO_G] / p;
127  *lat = atan((1.0 / (1.0 - GEO_WGS84_e2))*tmp);
128 
129  slat = sin(*lat);
130  n= GEO_WGS84_a/sqrt(1.0 - GEO_WGS84_e2 * sqr(slat));
131  // *lat=atan(tmp*(1.0 + (e2*n*slat)/efg[GEO_G]));
132  // lat1=*lat;
133  *hgt = (p / cos(*lat)) - n;
134 
135 }

Here is the call graph for this function:

void geoEfg2Llh_torge_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Torge Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is a successive approximation

Definition at line 188 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_e2, n(), p, and sqr.

Referenced by geoEfg2Hgt_torge_fast(), geoEfg2Lat_torge_fast(), and geoEfg2Lon_torge_fast().

190 {
191  double tmp,n,p,slat;
192 
193  p = sqrt(sqr(efg[GEO_E])+ sqr(efg[GEO_F]));
194  *lon = atan2(efg[GEO_F],efg[GEO_E]); // atan(f/e)
195 
196  // Prepare the initial value of lat
197  tmp = efg[GEO_G] / p;
198  *lat = atan(tmp/(1.0 - GEO_WGS84_e2)); //assume hgt = 0 to start
199 
200 
201  slat = sin(*lat);
202  //clat = cos(*lat);
203 
204  // radius of curvature estimate
205  n= GEO_WGS84_a/sqrt(1.0 - GEO_WGS84_e2 * sqr(slat));
206 
207  // Next estimates of lat/hgt
208  *hgt = (p / cos(*lat)) - n;
209  *lat=atan(tmp / (1.0 - (GEO_WGS84_e2 * ( n / (n + *hgt)) ) ) );
210 
211 }

Here is the call graph for this function:

void geoEfg2Llh_vermeille_fast ( int  datum,
double  efg[],
double *  lat,
double *  lon,
double *  hgt 
)

Vermeille Method - This routine will convert earth centered Cartesian coordinates (E,F,G), into geodetic coordinates (latitude $\phi$, longitude $\lambda$, and ellipsoid height $h$).

Parameters
intdatum
doubleefg[] : EFG(xyz) in METERS
double*lat : Latitude in RADIANS
double*lon : Longitude in RADIANS
double*hgt : Height in METERS
Returns
nothing
Note
This method is closed exact method from ....

Definition at line 517 of file geoEfg2Llh_fast.c.

References cube, GEO_E, GEO_F, GEO_G, GEO_WGS84_a, GEO_WGS84_e2, k, p, and sqr.

Referenced by geoEfg2Hgt_vermeille_fast(), geoEfg2Lat_vermeille_fast(), and geoEfg2Lon_vermeille_fast().

519 {
520  double fr,a2,x2,y2,z2,d2,e4,p,q,r,s,t,u,v,w,k,d,sqrtx2py2,sqrtd2pz2;
521 
522 
523 
524  // precompute variables
525  x2 = sqr(efg[GEO_E]);
526  y2 = sqr(efg[GEO_F]);
527  z2 = sqr(efg[GEO_G]);
528  a2 = sqr(GEO_WGS84_a);
529  e4 = sqr(GEO_WGS84_e2);
530  sqrtx2py2 = sqrt(x2+y2);
531  fr = (1.0-GEO_WGS84_e2)/(sqr(GEO_WGS84_a));
532 
533  // main algorithm
534  p = (x2 + y2)/ a2;
535  q = fr*z2;
536  r = (p+q-e4)/6.0;
537  s = e4 * (p*q)/(4.0*cube(r));
538  t = pow(1.0+s+sqrt(s*(2.0+s)),1.0/3.0);
539  u = r*(1.0+t+(1.0/t));
540  v = sqrt(sqr(u)+e4*q);
541  w = GEO_WGS84_e2*(u+v-q)/(2.0*v);
542  k = sqrt(u+v+sqr(w)) - w;
543  d = k*sqrtx2py2/(k+GEO_WGS84_e2);
544  d2 = sqr(d);
545  sqrtd2pz2 = sqrt(d2+z2);
546 
547  *lon = 2.0 * atan(efg[GEO_F]/(efg[GEO_E] + sqrtx2py2));
548  *lat = 2.0 * atan(efg[GEO_G]/(d + sqrtd2pz2));
549  *hgt = ((k + GEO_WGS84_e2 - 1.0) / k) * sqrtd2pz2;
550 
551 }
double geoEfg2Lon_aa_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 381 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_aa_fast(), and RAD_TO_DEG.

382 {
383  double efg[3];
384  double lat, lon, hgt;
385  efg[GEO_E] = e;
386  efg[GEO_F] = f;
387  efg[GEO_G] = g;
388 
389  geoEfg2Llh_aa_fast (datum,efg,&lat,&lon,&hgt);
390  return(RAD_TO_DEG * lon);
391 }

Here is the call graph for this function:

double geoEfg2Lon_borkowski_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 478 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_borkowski_fast(), and RAD_TO_DEG.

479 {
480  double efg[3];
481  double lat, lon, hgt;
482  efg[GEO_E] = e;
483  efg[GEO_F] = f;
484  efg[GEO_G] = g;
485 
486  geoEfg2Llh_borkowski_fast (datum,efg,&lat,&lon,&hgt);
487  return(RAD_TO_DEG * lon);
488 }

Here is the call graph for this function:

double geoEfg2Lon_bowring_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 307 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_bowring_fast(), and RAD_TO_DEG.

308 {
309  double efg[3];
310  double lat, lon, hgt;
311  efg[GEO_E] = e;
312  efg[GEO_F] = f;
313  efg[GEO_G] = g;
314 
315  geoEfg2Llh_bowring_fast (datum,efg,&lat,&lon,&hgt);
316  return(RAD_TO_DEG * lon);
317 }

Here is the call graph for this function:

double geoEfg2Lon_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 77 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_fast(), and RAD_TO_DEG.

78 {
79  double efg[3];
80  double lat, lon, hgt;
81  efg[GEO_E] = e;
82  efg[GEO_F] = f;
83  efg[GEO_G] = g;
84 
85  geoEfg2Llh_fast (datum,efg,&lat,&lon,&hgt);
86  return(RAD_TO_DEG * lon);
87 }

Here is the call graph for this function:

double geoEfg2Lon_hm_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 149 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_hm_fast(), and RAD_TO_DEG.

150 {
151  double efg[3];
152  double lat, lon, hgt;
153  efg[GEO_E] = e;
154  efg[GEO_F] = f;
155  efg[GEO_G] = g;
156 
157  geoEfg2Llh_hm_fast (datum,efg,&lat,&lon,&hgt);
158  return(RAD_TO_DEG * lon);
159 }

Here is the call graph for this function:

double geoEfg2Lon_torge_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 225 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_torge_fast(), and RAD_TO_DEG.

226 {
227  double efg[3];
228  double lat, lon, hgt;
229  efg[GEO_E] = e;
230  efg[GEO_F] = f;
231  efg[GEO_G] = g;
232 
233  geoEfg2Llh_torge_fast (datum,efg,&lat,&lon,&hgt);
234  return(RAD_TO_DEG * lon);
235 }

Here is the call graph for this function:

double geoEfg2Lon_vermeille_fast ( int  datum,
double  e,
double  f,
double  g 
)

Definition at line 565 of file geoEfg2Llh_fast.c.

References GEO_E, GEO_F, GEO_G, geoEfg2Llh_vermeille_fast(), and RAD_TO_DEG.

566 {
567  double efg[3];
568  double lat, lon, hgt;
569  efg[GEO_E] = e;
570  efg[GEO_F] = f;
571  efg[GEO_G] = g;
572 
573  geoEfg2Llh_vermeille_fast (datum,efg,&lat,&lon,&hgt);
574  return(RAD_TO_DEG * lon);
575 }

Here is the call graph for this function: