aboutsummaryrefslogtreecommitdiff
path: root/src/projections/mbt_fps.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/mbt_fps.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/mbt_fps.cpp')
-rw-r--r--src/projections/mbt_fps.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/src/projections/mbt_fps.cpp b/src/projections/mbt_fps.cpp
index 9ce2aa36..85051dc7 100644
--- a/src/projections/mbt_fps.cpp
+++ b/src/projections/mbt_fps.cpp
@@ -18,19 +18,18 @@ PROJ_HEAD(mbt_fps, "McBryde-Thomas Flat-Pole Sine (No. 2)") "\n\tCyl, Sph";
static PJ_XY mbt_fps_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */
PJ_XY xy = {0.0,0.0};
- double k, V, t;
- int i;
(void) P;
- k = C3 * sin(lp.phi);
- for (i = MAX_ITER; i ; --i) {
- t = lp.phi / C2;
- lp.phi -= V = (C1 * sin(t) + sin(lp.phi) - k) /
- (C1_2 * cos(t) + cos(lp.phi));
+ const double k = C3 * sin(lp.phi);
+ for (int i = MAX_ITER; i ; --i) {
+ const double t = lp.phi / C2;
+ const double V = (C1 * sin(t) + sin(lp.phi) - k) /
+ (C1_2 * cos(t) + cos(lp.phi));
+ lp.phi -= V;
if (fabs(V) < LOOP_TOL)
break;
}
- t = lp.phi / C2;
+ const double t = lp.phi / C2;
xy.x = C_x * lp.lam * (1. + 3. * cos(lp.phi)/cos(t) );
xy.y = C_y * sin(t);
return xy;
@@ -39,9 +38,9 @@ static PJ_XY mbt_fps_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forw
static PJ_LP mbt_fps_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */
PJ_LP lp = {0.0,0.0};
- double t;
- lp.phi = C2 * (t = aasin(P->ctx,xy.y / C_y));
+ const double t = aasin(P->ctx,xy.y / C_y);
+ lp.phi = C2 * t;
lp.lam = xy.x / (C_x * (1. + 3. * cos(lp.phi)/cos(t)));
lp.phi = aasin(P->ctx,(C1 * sin(t) + sin(lp.phi)) / C3);
return (lp);