aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_bonne.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_bonne.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_bonne.c')
-rw-r--r--src/PJ_bonne.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/PJ_bonne.c b/src/PJ_bonne.c
index 13309f3f..56656f16 100644
--- a/src/PJ_bonne.c
+++ b/src/PJ_bonne.c
@@ -49,8 +49,8 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
rh = hypot(xy.x, xy.y = Q->cphi1 - xy.y);
lp.phi = Q->cphi1 + Q->phi1 - rh;
- if (fabs(lp.phi) > HALFPI) I_ERROR;
- if (fabs(fabs(lp.phi) - HALFPI) <= EPS10)
+ if (fabs(lp.phi) > M_HALFPI) I_ERROR;
+ if (fabs(fabs(lp.phi) - M_HALFPI) <= EPS10)
lp.lam = 0.;
else
lp.lam = rh * atan2(xy.x, xy.y) / cos(lp.phi);
@@ -65,11 +65,11 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */
rh = hypot(xy.x, xy.y = Q->am1 - xy.y);
lp.phi = pj_inv_mlfn(P->ctx, Q->am1 + Q->m1 - rh, P->es, Q->en);
- if ((s = fabs(lp.phi)) < HALFPI) {
+ if ((s = fabs(lp.phi)) < M_HALFPI) {
s = sin(lp.phi);
lp.lam = rh * atan2(xy.x, xy.y) *
sqrt(1. - P->es * s * s) / cos(lp.phi);
- } else if (fabs(s - HALFPI) <= EPS10)
+ } else if (fabs(s - M_HALFPI) <= EPS10)
lp.lam = 0.;
else I_ERROR;
return lp;
@@ -110,7 +110,7 @@ PJ *PROJECTION(bonne) {
P->inv = e_inverse;
P->fwd = e_forward;
} else {
- if (fabs(Q->phi1) + EPS10 >= HALFPI)
+ if (fabs(Q->phi1) + EPS10 >= M_HALFPI)
Q->cphi1 = 0.;
else
Q->cphi1 = 1. / tan(Q->phi1);