aboutsummaryrefslogtreecommitdiff
path: root/src/pj_gauss.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_gauss.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_gauss.c')
-rw-r--r--src/pj_gauss.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/pj_gauss.c b/src/pj_gauss.c
index b4b965fb..67a1ab07 100644
--- a/src/pj_gauss.c
+++ b/src/pj_gauss.c
@@ -56,8 +56,8 @@ pj_gauss_ini(double e, double phi0, double *chi, double *rc) {
EN->C = sqrt(1. + es * cphi * cphi / (1. - es));
*chi = asin(sphi / EN->C);
EN->ratexp = 0.5 * EN->C * e;
- EN->K = tan(.5 * *chi + FORTPI) / (
- pow(tan(.5 * phi0 + FORTPI), EN->C) *
+ EN->K = tan(.5 * *chi + M_FORTPI) / (
+ pow(tan(.5 * phi0 + M_FORTPI), EN->C) *
srat(EN->e * sphi, EN->ratexp) );
return ((void *)en);
}
@@ -67,8 +67,8 @@ pj_gauss(projCtx ctx, LP elp, const void *en) {
(void) ctx;
slp.phi = 2. * atan( EN->K *
- pow(tan(.5 * elp.phi + FORTPI), EN->C) *
- srat(EN->e * sin(elp.phi), EN->ratexp) ) - HALFPI;
+ pow(tan(.5 * elp.phi + M_FORTPI), EN->C) *
+ srat(EN->e * sin(elp.phi), EN->ratexp) ) - M_HALFPI;
slp.lam = EN->C * (elp.lam);
return(slp);
}
@@ -79,10 +79,10 @@ pj_inv_gauss(projCtx ctx, LP slp, const void *en) {
int i;
elp.lam = slp.lam / EN->C;
- num = pow(tan(.5 * slp.phi + FORTPI)/EN->K, 1./EN->C);
+ num = pow(tan(.5 * slp.phi + M_FORTPI)/EN->K, 1./EN->C);
for (i = MAX_ITER; i; --i) {
elp.phi = 2. * atan(num * srat(EN->e * sin(slp.phi), -.5 * EN->e))
- - HALFPI;
+ - M_HALFPI;
if (fabs(elp.phi - slp.phi) < DEL_TOL) break;
slp.phi = elp.phi;
}