aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_merc.c
diff options
context:
space:
mode:
authorMicah Cochran <micahcochran@users.noreply.github.com>2016-05-28 11:26:35 -0500
committerMicah Cochran <micahcochran@users.noreply.github.com>2016-05-28 11:26:35 -0500
commit3043b2f7fcf4471983c8d4472b17ccf9df1710c8 (patch)
tree94e63e8367dad31a6f0fe1703050d0ad79340785 /src/PJ_merc.c
parenta112ea3172e89230fa307567be3d70e286b1eeb5 (diff)
downloadPROJ-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_merc.c')
-rw-r--r--src/PJ_merc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/PJ_merc.c b/src/PJ_merc.c
index dd894bbd..8318aa1c 100644
--- a/src/PJ_merc.c
+++ b/src/PJ_merc.c
@@ -7,7 +7,7 @@ PROJ_HEAD(merc, "Mercator") "\n\tCyl, Sph&Ell\n\tlat_ts=";
static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */
XY xy = {0.0,0.0};
- if (fabs(fabs(lp.phi) - HALFPI) <= EPS10)
+ if (fabs(fabs(lp.phi) - M_HALFPI) <= EPS10)
F_ERROR;
xy.x = P->k0 * lp.lam;
xy.y = - P->k0 * log(pj_tsfn(lp.phi, sin(lp.phi), P->e));
@@ -17,10 +17,10 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */
static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
XY xy = {0.0,0.0};
- if (fabs(fabs(lp.phi) - HALFPI) <= EPS10)
+ if (fabs(fabs(lp.phi) - M_HALFPI) <= EPS10)
F_ERROR;
xy.x = P->k0 * lp.lam;
- xy.y = P->k0 * log(tan(FORTPI + .5 * lp.phi));
+ xy.y = P->k0 * log(tan(M_FORTPI + .5 * lp.phi));
return xy;
}
@@ -36,7 +36,7 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */
static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
LP lp = {0.0,0.0};
- lp.phi = HALFPI - 2. * atan(exp(-xy.y / P->k0));
+ lp.phi = M_HALFPI - 2. * atan(exp(-xy.y / P->k0));
lp.lam = xy.x / P->k0;
return lp;
}
@@ -53,7 +53,7 @@ PJ *PROJECTION(merc) {
if( (is_phits = pj_param(P->ctx, P->params, "tlat_ts").i) ) {
phits = fabs(pj_param(P->ctx, P->params, "rlat_ts").f);
- if (phits >= HALFPI) E_ERROR(-24);
+ if (phits >= M_HALFPI) E_ERROR(-24);
}
if (P->es) { /* ellipsoid */