aboutsummaryrefslogtreecommitdiff
path: root/src/projections/mbtfpq.cpp
diff options
context:
space:
mode:
authorKristian Evers <kristianevers@gmail.com>2020-03-09 10:25:08 +0100
committerGitHub <noreply@github.com>2020-03-09 10:25:08 +0100
commit46c47e9adf6376ae06afabe5d24a0016a05ced82 (patch)
tree52c871c17f0c98c90ce6415cdb79dc1e73c14f4d /src/projections/mbtfpq.cpp
parent38ec5e662a74d40e02e38dc5dca553c3ecb04356 (diff)
parent60d3df673ca224107eb63e459073fc11ab5f4f16 (diff)
downloadPROJ-46c47e9adf6376ae06afabe5d24a0016a05ced82.tar.gz
PROJ-46c47e9adf6376ae06afabe5d24a0016a05ced82.zip
Merge pull request #2025 from rouault/projections_remove_assignments_in_expressions
src/projections/: remove assignments in expression and multiple statements per line
Diffstat (limited to 'src/projections/mbtfpq.cpp')
-rw-r--r--src/projections/mbtfpq.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/src/projections/mbtfpq.cpp b/src/projections/mbtfpq.cpp
index 9a419790..5c7f8ca6 100644
--- a/src/projections/mbtfpq.cpp
+++ b/src/projections/mbtfpq.cpp
@@ -20,14 +20,13 @@ PROJ_HEAD(mbtfpq, "McBryde-Thomas Flat-Polar Quartic") "\n\tCyl, Sph";
static PJ_XY mbtfpq_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */
PJ_XY xy = {0.0,0.0};
- double th1, c;
- int i;
(void) P;
- c = C * sin(lp.phi);
- for (i = NITER; i; --i) {
- lp.phi -= th1 = (sin(.5*lp.phi) + sin(lp.phi) - c) /
- (.5*cos(.5*lp.phi) + cos(lp.phi));
+ const double c = C * sin(lp.phi);
+ for (int i = NITER; i; --i) {
+ const double th1 = (sin(.5*lp.phi) + sin(lp.phi) - c) /
+ (.5*cos(.5*lp.phi) + cos(lp.phi));
+ lp.phi -= th1;
if (fabs(th1) < EPS) break;
}
xy.x = FXC * lp.lam * (1.0 + 2. * cos(lp.phi)/cos(0.5 * lp.phi));
@@ -46,10 +45,18 @@ static PJ_LP mbtfpq_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inver
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
return lp;
}
- else if (lp.phi < 0.) { t = -1.; lp.phi = -M_PI; }
- else { t = 1.; lp.phi = M_PI; }
- } else
- lp.phi = 2. * asin(t = lp.phi);
+ else if (lp.phi < 0.) {
+ t = -1.;
+ lp.phi = -M_PI;
+ }
+ else {
+ t = 1.;
+ lp.phi = M_PI;
+ }
+ } else {
+ t = lp.phi;
+ lp.phi = 2. * asin(lp.phi);
+ }
lp.lam = RXC * xy.x / (1. + 2. * cos(lp.phi)/cos(0.5 * lp.phi));
lp.phi = RC * (t + sin(lp.phi));
if (fabs(lp.phi) > 1.)