static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ XY xy = {0.0,0.0}; struct pj_opaque *Q = P->opaque; double sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe; double Cn = lp.phi, Ce = lp.lam; /* ell. LAT, LNG -> Gaussian LAT, LNG */ Cn = gatg (Q->cbg, PROJ_ETMERC_ORDER, Cn); /* Gaussian LAT, LNG -> compl. sph. LAT */ #ifdef _GNU_SOURCE sincos (Cn, &sin_Cn, &cos_Cn); sincos (Ce, &sin_Ce, &cos_Ce); #else sin_Cn = sin (Cn); cos_Cn = cos (Cn); sin_Ce = sin (Ce); cos_Ce = cos (Ce); #endif Cn = atan2 (sin_Cn, cos_Ce*cos_Cn); Ce = atan2 (sin_Ce*cos_Cn, hypot (sin_Cn, cos_Cn*cos_Ce)); /* compl. sph. N, E -> ell. norm. N, E */ Ce = asinhy ( tan (Ce) ); /* Replaces: Ce = log(tan(FORTPI + Ce*0.5)); */ Cn += clenS (Q->gtu, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe); Ce += dCe; if (fabs (Ce) <= 2.623395162778) { xy.y = Q->Qn * Cn + Q->Zb; /* Northing */ xy.x = Q->Qn * Ce; /* Easting */ } else xy.x = xy.y = HUGE_VAL; return xy; }
Cn = gatg(P->cbg, PROJ_ETMERC_ORDER, Cn); /* Gaussian LAT, LNG -> compl. sph. LAT */ #ifdef _GNU_SOURCE sincos(Cn, &sin_Cn, &cos_Cn); sincos(Ce, &sin_Ce, &cos_Ce); #else sin_Cn = sin(Cn); cos_Cn = cos(Cn); sin_Ce = sin(Ce); cos_Ce = cos(Ce); #endif Cn = atan2(sin_Cn, cos_Ce*cos_Cn); Ce = atan2(sin_Ce*cos_Cn, hypot(sin_Cn, cos_Cn*cos_Ce)); /* compl. sph. N, E -> ell. norm. N, E */ Ce = asinhy(tan(Ce)); /* Replaces: Ce = log(tan(FORTPI + Ce*0.5)); */ Cn += clenS(P->gtu, PROJ_ETMERC_ORDER, 2*Cn, 2*Ce, &dCn, &dCe); Ce += dCe; if (fabs(Ce) <= 2.623395162778) { xy.y = P->Qn * Cn + P->Zb; /* Northing */ xy.x = P->Qn * Ce; /* Easting */ } else xy.x = xy.y = HUGE_VAL; return (xy); } INVERSE(e_inverse); /* ellipsoid */ double sin_Cn, cos_Cn, cos_Ce, sin_Ce, dCn, dCe; double Cn = xy.y, Ce = xy.x; /* normalize N, E */