diff options
| author | Micah Cochran <micahcochran@users.noreply.github.com> | 2016-05-28 11:26:35 -0500 |
|---|---|---|
| committer | Micah Cochran <micahcochran@users.noreply.github.com> | 2016-05-28 11:26:35 -0500 |
| commit | 3043b2f7fcf4471983c8d4472b17ccf9df1710c8 (patch) | |
| tree | 94e63e8367dad31a6f0fe1703050d0ad79340785 /src/PJ_omerc.c | |
| parent | a112ea3172e89230fa307567be3d70e286b1eeb5 (diff) | |
| download | PROJ-3043b2f7fcf4471983c8d4472b17ccf9df1710c8.tar.gz PROJ-3043b2f7fcf4471983c8d4472b17ccf9df1710c8.zip | |
Change math constants, similar to PR #372. Use M_ namespace with the de facto standard M_PI and its ilk. Change names that are widely used in the project to be in the M_ namespace, so HALFPI becomes M_HALFPI. HALFPI is #defined as M_PI_2 (the defacto standard name). #defines _USE_MATH_DEFINES for MS Visual Studio (I didn't personally test this part, but Appveyor will not build otherwise).
Diffstat (limited to 'src/PJ_omerc.c')
| -rw-r--r-- | src/PJ_omerc.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/PJ_omerc.c b/src/PJ_omerc.c index 2fe41426..5dd9c20a 100644 --- a/src/PJ_omerc.c +++ b/src/PJ_omerc.c @@ -43,7 +43,7 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ struct pj_opaque *Q = P->opaque; double S, T, U, V, W, temp, u, v; - if (fabs(fabs(lp.phi) - HALFPI) > EPS) { + if (fabs(fabs(lp.phi) - M_HALFPI) > EPS) { W = Q->E / pow(pj_tsfn(lp.phi, sin(lp.phi), P->e), Q->B); temp = 1. / W; S = .5 * (W - temp); @@ -94,7 +94,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ Up = (Vp * Q->cosgam + Sp * Q->singam) / Tp; if (fabs(fabs(Up) - 1.) < EPS) { lp.lam = 0.; - lp.phi = Up < 0. ? -HALFPI : HALFPI; + lp.phi = Up < 0. ? -M_HALFPI : M_HALFPI; } else { lp.phi = Q->E / sqrt((1. + Up) / (1. - Up)); if ((lp.phi = pj_phi2(P->ctx, pow(lp.phi, 1. / Q->B), P->e)) == HUGE_VAL) @@ -157,9 +157,9 @@ PJ *PROJECTION(omerc) { phi2 = pj_param(P->ctx, P->params, "rlat_2").f; if (fabs(phi1 - phi2) <= TOL || (con = fabs(phi1)) <= TOL || - fabs(con - HALFPI) <= TOL || - fabs(fabs(P->phi0) - HALFPI) <= TOL || - fabs(fabs(phi2) - HALFPI) <= TOL) E_ERROR(-33); + fabs(con - M_HALFPI) <= TOL || + fabs(fabs(P->phi0) - M_HALFPI) <= TOL || + fabs(fabs(phi2) - M_HALFPI) <= TOL) E_ERROR(-33); } com = sqrt(P->one_es); if (fabs(P->phi0) > EPS) { @@ -192,8 +192,8 @@ PJ *PROJECTION(omerc) { } else alpha_c = asin(D*sin(gamma0 = gamma)); if ((con = fabs(alpha_c)) <= TOL || - fabs(con - PI) <= TOL || - fabs(fabs(P->phi0) - HALFPI) <= TOL) + fabs(con - M_PI) <= TOL || + fabs(fabs(P->phi0) - M_HALFPI) <= TOL) E_ERROR(-32); P->lam0 = lamc - asin(.5 * (F - 1. / F) * tan(gamma0)) / Q->B; @@ -204,10 +204,10 @@ PJ *PROJECTION(omerc) { p = (L - H) / (L + H); J = Q->E * Q->E; J = (J - L * H) / (J + L * H); - if ((con = lam1 - lam2) < -PI) - lam2 -= TWOPI; - else if (con > PI) - lam2 += TWOPI; + if ((con = lam1 - lam2) < -M_PI) + lam2 -= M_TWOPI; + else if (con > M_PI) + lam2 += M_TWOPI; P->lam0 = adjlon(.5 * (lam1 + lam2) - atan( J * tan(.5 * Q->B * (lam1 - lam2)) / p) / Q->B); gamma0 = atan(2. * sin(Q->B * adjlon(lam1 - P->lam0)) / @@ -228,8 +228,8 @@ PJ *PROJECTION(omerc) { Q->u_0 = - Q->u_0; } F = 0.5 * gamma0; - Q->v_pole_n = Q->ArB * log(tan(FORTPI - F)); - Q->v_pole_s = Q->ArB * log(tan(FORTPI + F)); + Q->v_pole_n = Q->ArB * log(tan(M_FORTPI - F)); + Q->v_pole_s = Q->ArB * log(tan(M_FORTPI + F)); P->inv = e_inverse; P->fwd = e_forward; |
