aboutsummaryrefslogtreecommitdiff
path: root/src/projections/mbtfpq.cpp
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2020-03-06 20:38:38 +0100
committerEven Rouault <even.rouault@spatialys.com>2020-03-08 19:58:35 +0100
commit60d3df673ca224107eb63e459073fc11ab5f4f16 (patch)
tree52c871c17f0c98c90ce6415cdb79dc1e73c14f4d /src/projections/mbtfpq.cpp
parent38ec5e662a74d40e02e38dc5dca553c3ecb04356 (diff)
downloadPROJ-60d3df673ca224107eb63e459073fc11ab5f4f16.tar.gz
PROJ-60d3df673ca224107eb63e459073fc11ab5f4f16.zip
src/projections/: remove assignments in expression and multiple statements per line
Should hopefully result in no change in results, and hopefully more readable code...
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.)