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_moll.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_moll.c')
| -rw-r--r-- | src/PJ_moll.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/PJ_moll.c b/src/PJ_moll.c index 31829b68..2a651080 100644 --- a/src/PJ_moll.c +++ b/src/PJ_moll.c @@ -27,7 +27,7 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ break; } if (!i) - lp.phi = (lp.phi < 0.) ? -HALFPI : HALFPI; + lp.phi = (lp.phi < 0.) ? -M_HALFPI : M_HALFPI; else lp.phi *= 0.5; xy.x = Q->C_x * lp.lam * cos(lp.phi); @@ -41,7 +41,7 @@ static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */ struct pj_opaque *Q = 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) < PI) { + if (fabs(lp.lam) < M_PI) { lp.phi += lp.phi; lp.phi = aasin(P->ctx, (lp.phi + sin(lp.phi)) / Q->C_p); } else { @@ -74,9 +74,9 @@ static PJ * setup(PJ *P, double p) { P->es = 0; sp = sin(p); - r = sqrt(TWOPI * sp / (p2 + sin(p2))); + r = sqrt(M_TWOPI * sp / (p2 + sin(p2))); - Q->C_x = 2. * r / PI; + Q->C_x = 2. * r / M_PI; Q->C_y = r / sp; Q->C_p = p2 + sin(p2); @@ -92,7 +92,7 @@ PJ *PROJECTION(moll) { return freeup_new (P); P->opaque = Q; - return setup(P, HALFPI); + return setup(P, M_HALFPI); } @@ -102,7 +102,7 @@ PJ *PROJECTION(wag4) { return freeup_new (P); P->opaque = Q; - return setup(P, PI/3.); + return setup(P, M_PI/3.); } PJ *PROJECTION(wag5) { |
