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_nocol.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_nocol.c')
| -rw-r--r-- | src/PJ_nocol.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/PJ_nocol.c b/src/PJ_nocol.c index ad96ff31..029f785b 100644 --- a/src/PJ_nocol.c +++ b/src/PJ_nocol.c @@ -16,17 +16,17 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ } else if (fabs(lp.phi) < EPS) { xy.x = lp.lam; xy.y = 0.; - } else if (fabs(fabs(lp.lam) - HALFPI) < EPS) { + } else if (fabs(fabs(lp.lam) - M_HALFPI) < EPS) { xy.x = lp.lam * cos(lp.phi); - xy.y = HALFPI * sin(lp.phi); - } else if (fabs(fabs(lp.phi) - HALFPI) < EPS) { + xy.y = M_HALFPI * sin(lp.phi); + } else if (fabs(fabs(lp.phi) - M_HALFPI) < EPS) { xy.x = 0; xy.y = lp.phi; } else { double tb, c, d, m, n, r2, sp; - tb = HALFPI / lp.lam - lp.lam / HALFPI; - c = lp.phi / HALFPI; + tb = M_HALFPI / lp.lam - lp.lam / M_HALFPI; + c = lp.phi / M_HALFPI; d = (1 - c * c)/((sp = sin(lp.phi)) - c); r2 = tb / d; r2 *= r2; @@ -34,10 +34,10 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */ n = (sp / r2 + 0.5 * d)/(1. + 1./r2); xy.x = cos(lp.phi); xy.x = sqrt(m * m + xy.x * xy.x / (1. + r2)); - xy.x = HALFPI * ( m + (lp.lam < 0. ? -xy.x : xy.x)); + xy.x = M_HALFPI * ( m + (lp.lam < 0. ? -xy.x : xy.x)); xy.y = sqrt(n * n - (sp * sp / r2 + d * sp - 1.) / (1. + 1./r2)); - xy.y = HALFPI * ( n + (lp.phi < 0. ? xy.y : -xy.y )); + xy.y = M_HALFPI * ( n + (lp.phi < 0. ? xy.y : -xy.y )); } return (xy); } |
