inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { xy_y /= this->m_proj_parm.C_y; lp_lat = this->m_proj_parm.m ? aasin((this->m_proj_parm.m * xy_y + sin(xy_y)) / this->m_proj_parm.n) : ( this->m_proj_parm.n != 1. ? aasin(sin(xy_y) / this->m_proj_parm.n) : xy_y ); lp_lon = xy_x / (this->m_proj_parm.C_x * (this->m_proj_parm.m + cos(xy_y))); }
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { double phip, lamp, phipp, lampp, cp, esp, con, delp; int i; phipp = 2. * (atan(exp(xy_y / this->m_proj_parm.kR)) - FORTPI); lampp = xy_x / this->m_proj_parm.kR; cp = cos(phipp); phip = aasin(this->m_proj_parm.cosp0 * sin(phipp) + this->m_proj_parm.sinp0 * cp * cos(lampp)); lamp = aasin(cp * sin(lampp) / cos(phip)); con = (this->m_proj_parm.K - log(tan(FORTPI + 0.5 * phip)))/this->m_proj_parm.c; for (i = NITER; i ; --i) { esp = this->m_par.e * sin(phip); delp = (con + log(tan(FORTPI + 0.5 * phip)) - this->m_proj_parm.hlf_e * log((1. + esp)/(1. - esp)) ) * (1. - esp * esp) * cos(phip) * this->m_par.rone_es; phip -= delp; if (fabs(delp) < EPS) break; } if (i) { lp_lat = phip; lp_lon = lamp / this->m_proj_parm.c; } else throw proj_exception(); }
// INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { lp_lat = aasin(xy_y / this->m_proj_parm.C_y); lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat)); lp_lat += lp_lat; lp_lat = aasin((lp_lat + sin(lp_lat)) / this->m_proj_parm.C_p); }
// INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { xy_y /= this->m_proj_parm.C_y; lp_lat = (this->m_proj_parm.m != 0.0) ? aasin((this->m_proj_parm.m * xy_y + sin(xy_y)) / this->m_proj_parm.n) : ( this->m_proj_parm.n != 1. ? aasin(sin(xy_y) / this->m_proj_parm.n) : xy_y ); lp_lon = xy_x / (this->m_proj_parm.C_x * (this->m_proj_parm.m + cos(xy_y))); }
static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ LP lp = {0.0,0.0}; struct pj_opaque *Q = P->opaque; double phip, lamp, phipp, lampp, cp, esp, con, delp; int i; phipp = 2. * (atan (exp (xy.y / Q->kR)) - M_FORTPI); lampp = xy.x / Q->kR; cp = cos (phipp); phip = aasin (P->ctx, Q->cosp0 * sin (phipp) + Q->sinp0 * cp * cos (lampp)); lamp = aasin (P->ctx, cp * sin (lampp) / cos (phip)); con = (Q->K - log (tan (M_FORTPI + 0.5 * phip)))/Q->c; for (i = NITER; i ; --i) { esp = P->e * sin(phip); delp = (con + log(tan(M_FORTPI + 0.5 * phip)) - Q->hlf_e * log((1. + esp)/(1. - esp)) ) * (1. - esp * esp) * cos(phip) * P->rone_es; phip -= delp; if (fabs(delp) < EPS) break; } if (i) { lp.phi = phip; lp.lam = lamp / Q->c; } else { proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION); return lp; } return (lp); }
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { double t; lp_lat = C2 * (t = aasin(xy_y / C_y)); lp_lon = xy_x / (C_x * (1. + 3. * cos(lp_lat)/cos(t))); lp_lat = aasin((C1 * sin(t) + sin(lp_lat)) / C3); }
// INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { lp_lat = aasin(xy_y / this->m_proj_parm.C_y); lp_lon = xy_x * cos(lp_lat) / this->m_proj_parm.C_x; lp_lat *= 3.; lp_lon /= cos(lp_lat); lp_lat = aasin(1.13137085 * sin(lp_lat)); }
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { double c; lp_lat = aasin(xy_y / C_y); lp_lon = xy_x / (C_x * ((c = cos(lp_lat)) - 0.5)); lp_lat = aasin((lp_lat + sin(lp_lat) * (c - 1.)) / C_p); }
inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { lp_lat = aasin(xy_y / this->m_proj_parm.C_y); lp_lon = xy_x * cos(lp_lat) / this->m_proj_parm.C_x; lp_lat *= 3.; lp_lon /= cos(lp_lat); lp_lat = aasin(1.13137085 * sin(lp_lat)); }
static PJ_LP s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ PJ_LP lp = {0.0,0.0}; struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); lp.phi = aasin(P->ctx, xy.y / Q->C_y); lp.lam = xy.x / (Q->C_x * cos(lp.phi)); if (fabs(lp.lam) < M_PI) { lp.phi += lp.phi; lp.phi = aasin(P->ctx, (lp.phi + sin(lp.phi)) / Q->C_p); } else { lp.lam = lp.phi = HUGE_VAL; } return lp; }
// FORWARD(s_forward) sphere // Project coordinates from geographic (lon, lat) to cartesian (x, y) inline void fwd(T const& lp_lon, T const& lp_lat, T& xy_x, T& xy_y) const { T Az, M, N, cp, sp, cl, shz; cp = cos(lp_lat); sp = sin(lp_lat); cl = cos(lp_lon); Az = aatan2(cp * sin(lp_lon), this->m_proj_parm.cp0 * sp - this->m_proj_parm.sp0 * cp * cl) + this->m_proj_parm.theta; shz = sin(0.5 * aacos(this->m_proj_parm.sp0 * sp + this->m_proj_parm.cp0 * cp * cl)); M = aasin(shz * sin(Az)); N = aasin(shz * cos(Az) * cos(M) / cos(M * this->m_proj_parm.two_r_m)); xy_y = this->m_proj_parm.n * sin(N * this->m_proj_parm.two_r_n); xy_x = this->m_proj_parm.m * sin(M * this->m_proj_parm.two_r_m) * cos(N) / cos(N * this->m_proj_parm.two_r_n); }
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const { double Az, M, N, cp, sp, cl, shz; cp = cos(lp_lat); sp = sin(lp_lat); cl = cos(lp_lon); Az = aatan2(cp * sin(lp_lon), this->m_proj_parm.cp0 * sp - this->m_proj_parm.sp0 * cp * cl) + this->m_proj_parm.theta; shz = sin(0.5 * aacos(this->m_proj_parm.sp0 * sp + this->m_proj_parm.cp0 * cp * cl)); M = aasin(shz * sin(Az)); N = aasin(shz * cos(Az) * cos(M) / cos(M * this->m_proj_parm.two_r_m)); xy_y = this->m_proj_parm.n * sin(N * this->m_proj_parm.two_r_n); xy_x = this->m_proj_parm.m * sin(M * this->m_proj_parm.two_r_m) * cos(N) / cos(N * this->m_proj_parm.two_r_n); }
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const { double phip, lamp, phipp, lampp, sp, cp; sp = this->m_par.e * sin(lp_lat); phip = 2.* atan( exp( this->m_proj_parm.c * ( log(tan(FORTPI + 0.5 * lp_lat)) - this->m_proj_parm.hlf_e * log((1. + sp)/(1. - sp))) + this->m_proj_parm.K)) - HALFPI; lamp = this->m_proj_parm.c * lp_lon; cp = cos(phip); phipp = aasin(this->m_proj_parm.cosp0 * sin(phip) - this->m_proj_parm.sinp0 * cp * cos(lamp)); lampp = aasin(cp * sin(lamp) / cos(phipp)); xy_x = this->m_proj_parm.kR * lampp; xy_y = this->m_proj_parm.kR * log(tan(FORTPI + 0.5 * phipp)); }
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; lp.phi = xy.y / C_y; lp.lam = xy.x / (C_x * cos(lp.phi)); lp.phi = aasin (P->ctx,sin(lp.phi) / C_p1) / C_p2; return (lp); }
char *proobraz(char* input) { input = registr(input); input= ficha(input); for (int i=0;i<strlen(input);i++) { ssin(i,input); ccos(i,input); aasin(i,input); aacos(i,input); aatan(i,input); cceil(i,input); cch(i,input); eexp(i,input); aabs(i,input); ffloor(i,input); lln(i,input); llog(i,input); ssh(i,input); ssqrt(i,input); ttan(i,input); tth(i,input); cctg(i,input); aactg(i,input); ccth(i,input); } return input; }
static PJ_LP s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */ PJ_LP lp = {0.0, 0.0}; xy.y /= static_cast<struct pj_opaque*>(P->opaque)->C_y; lp.phi = aasin(P->ctx, sin (xy.y) / static_cast<struct pj_opaque*>(P->opaque)->n); lp.lam = xy.x / (C_x * cos (xy.y)); return lp; }
static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ XY xy = {0.0,0.0}; lp.phi = aasin (P->ctx,C_p1 * sin (C_p2 * lp.phi)); xy.x = C_x * lp.lam * cos (lp.phi); xy.y = C_y * lp.phi; return (xy); }
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const { lp_lat = aasin(0.883883476 * sin(lp_lat)); xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat); xy_x /= cos(lp_lat *= 0.333333333333333); xy_y = this->m_proj_parm.C_y * sin(lp_lat); }
// INVERSE(s_inverse) sphere // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(T const& xy_x, T const& xy_y, T& lp_lon, T& lp_lat) const { T N, M, xp, yp, z, Az, cz, sz, cAz; N = this->m_proj_parm.hn * aasin(xy_y * this->m_proj_parm.rn); M = this->m_proj_parm.hm * aasin(xy_x * this->m_proj_parm.rm * cos(N * this->m_proj_parm.two_r_n) / cos(N)); xp = 2. * sin(M); yp = 2. * sin(N) * cos(M * this->m_proj_parm.two_r_m) / cos(M); cAz = cos(Az = aatan2(xp, yp) - this->m_proj_parm.theta); z = 2. * aasin(0.5 * boost::math::hypot(xp, yp)); sz = sin(z); cz = cos(z); lp_lat = aasin(this->m_proj_parm.sp0 * cz + this->m_proj_parm.cp0 * sz * cAz); lp_lon = aatan2(sz * sin(Az), this->m_proj_parm.cp0 * cz - this->m_proj_parm.sp0 * sz * cAz); }
void setup_tpeqd(Parameters& par, par_tpeqd& proj_parm) { double lam_1, lam_2, phi_1, phi_2, A12, pp; /* get control point locations */ phi_1 = pj_param(par.params, "rlat_1").f; lam_1 = pj_param(par.params, "rlon_1").f; phi_2 = pj_param(par.params, "rlat_2").f; lam_2 = pj_param(par.params, "rlon_2").f; if (phi_1 == phi_2 && lam_1 == lam_2) throw proj_exception(-25); par.lam0 = adjlon(0.5 * (lam_1 + lam_2)); proj_parm.dlam2 = adjlon(lam_2 - lam_1); proj_parm.cp1 = cos(phi_1); proj_parm.cp2 = cos(phi_2); proj_parm.sp1 = sin(phi_1); proj_parm.sp2 = sin(phi_2); proj_parm.cs = proj_parm.cp1 * proj_parm.sp2; proj_parm.sc = proj_parm.sp1 * proj_parm.cp2; proj_parm.ccs = proj_parm.cp1 * proj_parm.cp2 * sin(proj_parm.dlam2); proj_parm.z02 = aacos(proj_parm.sp1 * proj_parm.sp2 + proj_parm.cp1 * proj_parm.cp2 * cos(proj_parm.dlam2)); proj_parm.hz0 = .5 * proj_parm.z02; A12 = atan2(proj_parm.cp2 * sin(proj_parm.dlam2), proj_parm.cp1 * proj_parm.sp2 - proj_parm.sp1 * proj_parm.cp2 * cos(proj_parm.dlam2)); proj_parm.ca = cos(pp = aasin(proj_parm.cp1 * sin(A12))); proj_parm.sa = sin(pp); proj_parm.lp = adjlon(atan2(proj_parm.cp1 * cos(A12), proj_parm.sp1) - proj_parm.hz0); proj_parm.dlam2 *= .5; proj_parm.lamc = HALFPI - atan2(sin(A12) * proj_parm.sp1, cos(A12)) - proj_parm.dlam2; proj_parm.thz0 = tan(proj_parm.hz0); proj_parm.rhshz0 = .5 / sin(proj_parm.hz0); proj_parm.r2z0 = 0.5 / proj_parm.z02; proj_parm.z02 *= proj_parm.z02; // par.inv = s_inverse; // par.fwd = s_forward; par.es = 0.; }
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; lp.lam = 2. * xy.x / (1. + cos(xy.y)); lp.phi = aasin(P->ctx,0.5 * (xy.y + sin(xy.y))); return lp; }
static PJ_XY s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */ PJ_XY xy = {0.0, 0.0}; lp.phi = aasin (P->ctx,static_cast<struct pj_opaque*>(P->opaque)->n * sin (lp.phi)); xy.x = C_x * lp.lam * cos (lp.phi); xy.y = static_cast<struct pj_opaque*>(P->opaque)->C_y * lp.phi; return xy; }
static PJ_XY e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */ PJ_XY xy = {0.0,0.0}; struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); int l, nn; double lamt = 0.0, xlam, sdsq, c, d, s, lamdp = 0.0, phidp, lampp, tanph; double lamtp, cl, sd, sp, sav, tanphi; if (lp.phi > M_HALFPI) lp.phi = M_HALFPI; else if (lp.phi < -M_HALFPI) lp.phi = -M_HALFPI; if (lp.phi >= 0. ) lampp = M_HALFPI; else lampp = M_PI_HALFPI; tanphi = tan(lp.phi); for (nn = 0;;) { double fac; sav = lampp; lamtp = lp.lam + Q->p22 * lampp; cl = cos(lamtp); if( cl < 0 ) fac = lampp + sin(lampp) * M_HALFPI; else fac = lampp - sin(lampp) * M_HALFPI; for (l = 50; l; --l) { lamt = lp.lam + Q->p22 * sav; if (fabs(c = cos(lamt)) < TOL) lamt -= TOL; xlam = (P->one_es * tanphi * Q->sa + sin(lamt) * Q->ca) / c; lamdp = atan(xlam) + fac; if (fabs(fabs(sav) - fabs(lamdp)) < TOL) break; sav = lamdp; } if (!l || ++nn >= 3 || (lamdp > Q->rlm && lamdp < Q->rlm2)) break; if (lamdp <= Q->rlm) lampp = M_TWOPI_HALFPI; else if (lamdp >= Q->rlm2) lampp = M_HALFPI; } if (l) { sp = sin(lp.phi); phidp = aasin(P->ctx,(P->one_es * Q->ca * sp - Q->sa * cos(lp.phi) * sin(lamt)) / sqrt(1. - P->es * sp * sp)); tanph = log(tan(M_FORTPI + .5 * phidp)); sd = sin(lamdp); sdsq = sd * sd; s = Q->p22 * Q->sa * cos(lamdp) * sqrt((1. + Q->t * sdsq) / ((1. + Q->w * sdsq) * (1. + Q->q * sdsq))); d = sqrt(Q->xj * Q->xj + s * s); xy.x = Q->b * lamdp + Q->a2 * sin(2. * lamdp) + Q->a4 * sin(lamdp * 4.) - tanph * s / d; xy.y = Q->c1 * sd + Q->c3 * sin(lamdp * 3.) + tanph * Q->xj / d; } else xy.x = xy.y = HUGE_VAL; return xy; }
static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ XY xy = {0.0, 0.0}; double phip, lamp, phipp, lampp, sp, cp; struct pj_opaque *Q = P->opaque; sp = P->e * sin (lp.phi); phip = 2.* atan ( exp ( Q->c * ( log (tan (M_FORTPI + 0.5 * lp.phi)) - Q->hlf_e * log ((1. + sp)/(1. - sp))) + Q->K)) - M_HALFPI; lamp = Q->c * lp.lam; cp = cos(phip); phipp = aasin (P->ctx, Q->cosp0 * sin (phip) - Q->sinp0 * cp * cos (lamp)); lampp = aasin (P->ctx, cp * sin (lamp) / cos (phipp)); xy.x = Q->kR * lampp; xy.y = Q->kR * log (tan (M_FORTPI + 0.5 * phipp)); return xy; }
// FORWARD(s_forward) spheroid // Project coordinates from geographic (lon, lat) to cartesian (x, y) inline void fwd(T const& lp_lon, T lp_lat, T& xy_x, T& xy_y) const { static T const third = detail::third<T>(); lp_lat = aasin(0.883883476 * sin(lp_lat)); xy_x = this->m_proj_parm.C_x * lp_lon * cos(lp_lat); xy_x /= cos(lp_lat *= third); xy_y = this->m_proj_parm.C_y * sin(lp_lat); }
inline void fwd(geographic_type& lp_lon, geographic_type& lp_lat, cartesian_type& xy_x, cartesian_type& xy_y) const { double t; t = lp_lat = aasin(this->m_proj_parm.n * sin(lp_lat)); xy_x = this->m_proj_parm.m * lp_lon * cos(lp_lat); t *= t; xy_y = lp_lat * (1. + t * this->m_proj_parm.q3) * this->m_proj_parm.rmn; }
static PJ_XY t_forward(PJ_LP lp, PJ *P) { /* spheroid */ struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque); double cosphi, coslam; cosphi = cos(lp.phi); coslam = cos(lp.lam); lp.lam = adjlon(aatan2(cosphi * sin(lp.lam), sin(lp.phi)) + Q->lamp); lp.phi = aasin(P->ctx, - cosphi * coslam); return Q->link->fwd(lp, Q->link); }
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ LP lp = {0.0,0.0}; struct pj_opaque *Q = P->opaque; double r; lp.phi = xy.y / Q->C_y; r = sqrt(1. + lp.phi * lp.phi); lp.lam = xy.x / (Q->C_x * (Q->D - r)); lp.phi = aasin( P->ctx, ( (Q->A - r) * lp.phi - log(lp.phi + r) ) / Q->B); return lp; }
// INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(T const& xy_x, T xy_y, T& lp_lon, T& lp_lat) const { T c; xy_y /= this->m_proj_parm.C_y; c = cos(lp_lat = this->m_proj_parm.tan_mode ? atan(xy_y) : aasin(xy_y)); lp_lat /= this->m_proj_parm.C_p; lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat)); if (this->m_proj_parm.tan_mode) lp_lon /= c * c; else lp_lon *= c; }
// INVERSE(s_inverse) spheroid // Project coordinates from cartesian (x, y) to geographic (lon, lat) inline void inv(cartesian_type& xy_x, cartesian_type& xy_y, geographic_type& lp_lon, geographic_type& lp_lat) const { double c; xy_y /= this->m_proj_parm.C_y; c = cos(lp_lat = this->m_proj_parm.tan_mode ? atan(xy_y) : aasin(xy_y)); lp_lat /= this->m_proj_parm.C_p; lp_lon = xy_x / (this->m_proj_parm.C_x * cos(lp_lat)); if (this->m_proj_parm.tan_mode) lp_lon /= c * c; else lp_lon *= c; }