aboutsummaryrefslogtreecommitdiff
path: root/src/projections/sts.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/sts.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/sts.cpp')
-rw-r--r--src/projections/sts.cpp65
1 files changed, 32 insertions, 33 deletions
diff --git a/src/projections/sts.cpp b/src/projections/sts.cpp
index 4d682a53..cbc36b7d 100644
--- a/src/projections/sts.cpp
+++ b/src/projections/sts.cpp
@@ -23,49 +23,48 @@ struct pj_opaque {
static PJ_XY sts_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forward */
PJ_XY xy = {0.0,0.0};
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque);
- double c;
-
- xy.x = Q->C_x * lp.lam * cos(lp.phi);
- xy.y = Q->C_y;
- lp.phi *= Q->C_p;
- c = cos(lp.phi);
- if (Q->tan_mode) {
- xy.x *= c * c;
- xy.y *= tan (lp.phi);
- } else {
- xy.x /= c;
- xy.y *= sin (lp.phi);
- }
- return xy;
+
+ xy.x = Q->C_x * lp.lam * cos(lp.phi);
+ xy.y = Q->C_y;
+ lp.phi *= Q->C_p;
+ const double c = cos(lp.phi);
+ if (Q->tan_mode) {
+ xy.x *= c * c;
+ xy.y *= tan (lp.phi);
+ } else {
+ xy.x /= c;
+ xy.y *= sin (lp.phi);
+ }
+ return xy;
}
static PJ_LP sts_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */
PJ_LP lp = {0.0,0.0};
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque);
- double c;
-
- xy.y /= Q->C_y;
- c = cos (lp.phi = Q->tan_mode ? atan (xy.y) : aasin (P->ctx, xy.y));
- lp.phi /= Q->C_p;
- lp.lam = xy.x / (Q->C_x * cos(lp.phi));
- if (Q->tan_mode)
- lp.lam /= c * c;
- else
- lp.lam *= c;
- return lp;
+
+ xy.y /= Q->C_y;
+ lp.phi = Q->tan_mode ? atan (xy.y) : aasin (P->ctx, xy.y);
+ const double c = cos (lp.phi);
+ lp.phi /= Q->C_p;
+ lp.lam = xy.x / (Q->C_x * cos(lp.phi));
+ if (Q->tan_mode)
+ lp.lam /= c * c;
+ else
+ lp.lam *= c;
+ return lp;
}
static PJ *setup(PJ *P, double p, double q, int mode) {
- P->es = 0.;
- P->inv = sts_s_inverse;
- P->fwd = sts_s_forward;
- static_cast<struct pj_opaque*>(P->opaque)->C_x = q / p;
- static_cast<struct pj_opaque*>(P->opaque)->C_y = p;
- static_cast<struct pj_opaque*>(P->opaque)->C_p = 1/ q;
- static_cast<struct pj_opaque*>(P->opaque)->tan_mode = mode;
- return P;
+ P->es = 0.;
+ P->inv = sts_s_inverse;
+ P->fwd = sts_s_forward;
+ static_cast<struct pj_opaque*>(P->opaque)->C_x = q / p;
+ static_cast<struct pj_opaque*>(P->opaque)->C_y = p;
+ static_cast<struct pj_opaque*>(P->opaque)->C_p = 1/ q;
+ static_cast<struct pj_opaque*>(P->opaque)->tan_mode = mode;
+ return P;
}