aboutsummaryrefslogtreecommitdiff
path: root/src/PJ_bacon.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_bacon.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_bacon.c')
-rw-r--r--src/PJ_bacon.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/PJ_bacon.c b/src/PJ_bacon.c
index 75afaeb0..ce6725cb 100644
--- a/src/PJ_bacon.c
+++ b/src/PJ_bacon.c
@@ -1,4 +1,4 @@
-# define HLFPI2 2.46740110027233965467
+# define HLFPI2 2.46740110027233965467 /* (pi/2)^2 */
# define EPS 1e-10
#define PJ_LIB__
#include <projects.h>
@@ -19,10 +19,10 @@ static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
struct pj_opaque *Q = P->opaque;
double ax, f;
- xy.y = Q->bacn ? HALFPI * sin(lp.phi) : lp.phi;
+ xy.y = Q->bacn ? M_HALFPI * sin(lp.phi) : lp.phi;
if ((ax = fabs(lp.lam)) >= EPS) {
- if (Q->ortl && ax >= HALFPI)
- xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - HALFPI;
+ if (Q->ortl && ax >= M_HALFPI)
+ xy.x = sqrt(HLFPI2 - lp.phi * lp.phi + EPS) + ax - M_HALFPI;
else {
f = 0.5 * (HLFPI2 / ax + ax);
xy.x = ax - f + sqrt(f * f - xy.y * xy.y);