73 double *lat,
double *lon,
double *hgt)
75 double p, u, u_prime, a, flat, b, e2, ee2,sign = 1.0,cu_prime,su,cu,t1;
83 u = atan((efg[
GEO_G]/p) * (a/b));
88 *lat = atan((efg[
GEO_G] + ee2 * b *
cube(su) ) /
89 ( p - e2 * a *
cube(cu) ) );
91 u_prime = atan((1.0 - flat) * tan(*lat));
92 cu_prime = p - a * cos(u_prime);
93 if(cu_prime < 0.0) sign= -1.0;
96 t1 = efg[
GEO_G] - b * sin(u_prime);
97 *hgt = sign * sqrt(
sqr(cu_prime) +
sqr(t1) );
98 *lon = atan2(efg[GEO_F],efg[GEO_E]);
105 double lat, lon, hgt;
117 double lat, lon, hgt;
128 double lat, lon, hgt;
154 double *lat,
double *lon,
double *hgt)
156 double a, flat, b, e2, ee2;
157 double lat1,tmp,
n=0.0,delta,
p,slat;
161 if(efg[
GEO_G] == 0.0) efg[
GEO_G] = 0.00000001;
166 *lon = atan2(efg[GEO_F],efg[GEO_E]);
171 lat1 = atan((1.0 / (1.0 - e2))*tmp);
179 n= a/sqrt(1.0 - e2 *
sqr(slat));
180 *lat=atan(tmp*(1.0 + (e2*n*slat)/efg[
GEO_G]));
186 *hgt = (p / cos(*lat)) - n;
193 double lat, lon, hgt;
205 double lat, lon, hgt;
216 double lat, lon, hgt;
228 double lat, lon, hgt;
254 double *lat,
double *lon,
double *hgt)
256 double a, flat, b, e2, ee2;
257 double lat1,hgt1,tmp,
n=0.0,deltal,deltah,
p,slat;
265 *lon = atan2(efg[GEO_F],efg[GEO_E]);
287 n= a/sqrt(1.0 - e2 *
sqr(slat));
290 *lat=atan2(tmp , (1.0 - (e2 * ( n / (n + *hgt)) ) ) );
291 *hgt = (p / cos(*lat)) - n;
292 deltal = *lat - lat1;
293 deltah = *hgt - hgt1;
294 if((fabs(deltah) <= .00001) && (fabs(deltal) <=
geoAccuracy))
break;
302 double lat, lon, hgt;
314 double lat, lon, hgt;
325 double lat, lon, hgt;
337 double lat, lon, hgt;
363 double *lat,
double *lon,
double *hgt)
365 double a, flat, b, e2, ee2;
366 double tmp,
n,b0,b1,
p,slat,clat,ee2b,ae2,boa;
373 p = sqrt(
sqr(efg[GEO_E])+
sqr(efg[GEO_F]));
383 b0 = atan((a/b)*tmp);
392 *lat = atan((efg[
GEO_G]+ ee2b *
cube(slat) ) /
393 (p - ae2 *
cube(clat) ) );
394 b0 = atan((boa) * tan(*lat));
400 n= a/sqrt(1.0-e2*
sqr(slat));
402 *hgt = (p / cos(*lat)) - n;
409 double lat, lon, hgt;
421 double lat, lon, hgt;
432 double lat, lon, hgt;
444 double lat, lon, hgt;
469 double *lat,
double *lon,
double *hgt)
471 double phi,
p,
n=1.0,phi1;
474 double a, flat, b, e2, ee2;
483 p = sqrt(
sqr(efg[GEO_E]) +
sqr(efg[GEO_F]));
485 phi = atan(efg[
GEO_G]/p);
498 n = a/sqrt(1.0 - e2 *
sqr(slat));
499 phi = atan((efg[
GEO_G] + n * e2 * slat)/p);
504 *hgt = p / cos(phi) -
n;
511 double lat, lon, hgt;
523 double lat, lon, hgt;
534 double lat, lon, hgt;
546 double lat, lon, hgt;
572 double *lat,
double *lon,
double *hgt)
574 double a, flat, b, e2, ee2;
575 double r,e,f,
p,q,d,v,g,t,sign,bg,samb,sqrtd,sqre;
590 if(efg[
GEO_G] < 0.0) sign = -1.0;
595 r = efg[
GEO_E] / cos(*lon);
596 e = (bg - samb) / (a*r);
598 f = (bg + samb) / (a*r);
599 p = 4.0/3.0*(e*f+1.0);
600 q = 2.0 * (sqre-
sqr(f));
604 v = 2.0 * sqrt(-p) * cos(acos(q/pow(-p,3.0/2.0))/3.0);
606 v = pow((sqrtd - q),1.0/3.0) - pow((sqrtd + q),1.0/3.0);
607 g = (sqrt(sqre+v) + e ) / 2.0;
608 t = sqrt(
sqr(g)+((f-v*g)/(2.0*g-e))) - g;
609 *lat = atan(a*(1.0-
sqr(t))/(2.0*b*t));
611 *hgt = (r - a*t) * cos(*lat) + (efg[
GEO_G]-b)*sin(*lat);
618 double lat, lon, hgt;
630 double lat, lon, hgt;
641 double lat, lon, hgt;
667 double *lat,
double *lon,
double *hgt)
669 double a, flat, b, e2, ee2;
670 double a2,x2,y2,z2,d2,e4,
p,q,r,s,t,u,v,w,
k,d,sqrtx2py2,sqrtd2pz2;
683 sqrtx2py2 = sqrt(x2+y2);
687 q = ((1.0-e2)/ a2)*z2;
689 s = e4 * (p*q)/(4.0*pow(r,3.0));
690 t = pow(1.0+s+sqrt(s*(2.0+s)),1.0/3.0);
691 u = r*(1.0+t+(1.0/t));
692 v = sqrt(
sqr(u)+e4*q);
693 w = e2*(u+v-q)/(2.0*v);
694 k = sqrt(u+v+
sqr(w)) - w;
695 d = k*sqrtx2py2/(k+e2);
697 sqrtd2pz2 = sqrt(d2+z2);
699 *lon = 2 * atan(efg[GEO_F]/(efg[GEO_E] + sqrtx2py2));
701 *lat = 2 * atan(efg[GEO_G]/(d + sqrtd2pz2));
703 *hgt = ((k + e2 - 1.0) /
k) * sqrtd2pz2;
710 double lat, lon, hgt;
722 double lat, lon, hgt;
733 double lat, lon, hgt;
759 double *lat,
double *lon,
double *hgt)
761 double a, flat, b, e2, ee2;
762 double a2,b2,x2,y2,z2,d,d2,e4,m1e2,m1e2z2,
763 W,W2,F,G,
p,q,q1,s,
sp,W0,wew0,U,V,Z0;
786 G = W2 + m1e2z2 - e2*(a2-b2);
790 s = pow(1.0+d+sqrt(d2+2*d),1.0/3.0);
792 p = F/(3.0*
sqr(sp)*G*G);
793 q = sqrt(1.0+2.0*e4*p);
796 W0= (-p*e2*W / q1) + sqrt(0.5*a2*(1.0+1.0/q)-(p*m1e2z2/(q*q1))-(p*W2/2.0));
798 U = sqrt(
sqr(wew0)+z2);
799 V = sqrt(
sqr(wew0)+m1e2z2);
800 Z0= b2*efg[
GEO_G]/(a*V);
801 *hgt = U*(1.0-(b2/(a*V)));
802 *lat = atan2((efg[GEO_G]+ee2*Z0),W);
803 *lon = atan2(efg[GEO_F],efg[GEO_E]);
811 double lat, lon, hgt;
823 double lat, lon, hgt;
834 double lat, lon, hgt;
858 #define aDc 1.0026000
861 double *lat,
double *lon,
double *hgt)
863 double a, flat, b, e2, ee2;
864 double x2,y2,W,W2,t0,s0,sbo,cbo,t1,wae,s1,sin1,cos1,
n;
881 s0 = sqrt(
sqr(t0)+W2);
886 wae = W - a * e2 *
cube(cbo);
887 s1 = sqrt(
sqr(t1) +
sqr(wae));
890 n = a/sqrt(1.0-e2*
sqr(sin1));
891 if(sin1 >= 0.3826834323650897717284599840304)
893 sin1 = sqrt(
sqr(sin1));
894 *hgt = efg[
GEO_G]/sin1 + n*(e2-1.0);
901 *lat = atan2(sin1,cos1);
902 *lon = atan2(efg[GEO_F],efg[GEO_E]);
909 double lat, lon, hgt;
910 double efg[] = {e,f,g};
922 double lat, lon, hgt;
933 double lat, lon, hgt;