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_labrd.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_labrd.c')
| -rw-r--r-- | src/PJ_labrd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/PJ_labrd.c b/src/PJ_labrd.c index 4c435731..1666a5bb 100644 --- a/src/PJ_labrd.c +++ b/src/PJ_labrd.c @@ -16,10 +16,10 @@ static XY e_forward (LP lp, PJ *P) { /* Ellipsoidal, forward */ double V1, V2, ps, sinps, cosps, sinps2, cosps2; double I1, I2, I3, I4, I5, I6, x2, y2, t; - V1 = Q->A * log( tan(FORTPI + .5 * lp.phi) ); + V1 = Q->A * log( tan(M_FORTPI + .5 * lp.phi) ); t = P->e * sin(lp.phi); V2 = .5 * P->e * Q->A * log ((1. + t)/(1. - t)); - ps = 2. * (atan(exp(V1 - V2 + Q->C)) - FORTPI); + ps = 2. * (atan(exp(V1 - V2 + Q->C)) - M_FORTPI); I1 = ps - Q->p0s; cosps = cos(ps); cosps2 = cosps * cosps; sinps = sin(ps); sinps2 = sinps * sinps; @@ -61,10 +61,10 @@ static LP e_inverse (XY xy, PJ *P) { /* Ellipsoidal, inverse */ ps = Q->p0s + xy.y / Q->kRg; pe = ps + P->phi0 - Q->p0s; for ( i = 20; i; --i) { - V1 = Q->A * log(tan(FORTPI + .5 * pe)); + V1 = Q->A * log(tan(M_FORTPI + .5 * pe)); tpe = P->e * sin(pe); V2 = .5 * P->e * Q->A * log((1. + tpe)/(1. - tpe)); - t = ps - 2. * (atan(exp(V1 - V2 + Q->C)) - FORTPI); + t = ps - 2. * (atan(exp(V1 - V2 + Q->C)) - M_FORTPI); pe += t; if (fabs(t) < EPS) break; @@ -126,8 +126,8 @@ PJ *PROJECTION(labrd) { Q->A = sinp / sin(Q->p0s); t = P->e * sinp; Q->C = .5 * P->e * Q->A * log((1. + t)/(1. - t)) + - - Q->A * log( tan(FORTPI + .5 * P->phi0)) - + log( tan(FORTPI + .5 * Q->p0s)); + - Q->A * log( tan(M_FORTPI + .5 * P->phi0)) + + log( tan(M_FORTPI + .5 * Q->p0s)); t = Az + Az; Q->Ca = (1. - cos(t)) * ( Q->Cb = 1. / (12. * Q->kRg * Q->kRg) ); Q->Cb *= sin(t); |
