aboutsummaryrefslogtreecommitdiff
path: root/src/projections/ortho.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/ortho.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/ortho.cpp')
-rw-r--r--src/projections/ortho.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/projections/ortho.cpp b/src/projections/ortho.cpp
index 34b6b689..5f9366c3 100644
--- a/src/projections/ortho.cpp
+++ b/src/projections/ortho.cpp
@@ -48,7 +48,8 @@ static PJ_XY ortho_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwar
xy.y = sin(lp.phi);
break;
case OBLIQ:
- if (Q->sinph0 * (sinphi = sin(lp.phi)) + Q->cosph0 * cosphi * coslam < - EPS10)
+ sinphi = sin(lp.phi);
+ if (Q->sinph0 * sinphi + Q->cosph0 * cosphi * coslam < - EPS10)
return forward_error(P, lp, xy);
xy.y = Q->cosph0 * sinphi - Q->sinph0 * cosphi * coslam;
break;
@@ -69,11 +70,13 @@ static PJ_XY ortho_s_forward (PJ_LP lp, PJ *P) { /* Spheroidal, forwar
static PJ_LP ortho_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, inverse */
PJ_LP lp;
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque);
- double rh, cosc, sinc;
+ double sinc;
lp.lam = HUGE_VAL; lp.phi = HUGE_VAL;
- if ((sinc = (rh = hypot(xy.x, xy.y))) > 1.) {
+ const double rh = hypot(xy.x, xy.y);
+ sinc = rh;
+ if (sinc > 1.) {
if ((sinc - 1.) > EPS10) {
proj_errno_set(P, PJD_ERR_TOLERANCE_CONDITION);
proj_log_trace(P, "Point (%.3f, %.3f) is outside the projection boundary");
@@ -81,7 +84,7 @@ static PJ_LP ortho_s_inverse (PJ_XY xy, PJ *P) { /* Spheroidal, invers
}
sinc = 1.;
}
- cosc = sqrt(1. - sinc * sinc); /* in this range OK */
+ const double cosc = sqrt(1. - sinc * sinc); /* in this range OK */
if (fabs(rh) <= EPS10) {
lp.phi = P->phi0;
lp.lam = 0.0;