aboutsummaryrefslogtreecommitdiff
path: root/src/proj_4D_api.c
diff options
context:
space:
mode:
authorThomas Knudsen <thokn@sdfe.dk>2018-01-26 12:47:14 +0100
committerKristian Evers <kristianevers@gmail.com>2018-01-31 16:25:44 +0100
commitb3354f70d3ca2c6b77d702f5ab73a0378819b703 (patch)
tree40d6bc1632de3883dff8d539e8cd1f5bc05358c1 /src/proj_4D_api.c
parent90968ff934a348b02f982080f8b7ccf17e037a46 (diff)
downloadPROJ-b3354f70d3ca2c6b77d702f5ab73a0378819b703.tar.gz
PROJ-b3354f70d3ca2c6b77d702f5ab73a0378819b703.zip
proj_roundtrip: simplify control logic
Diffstat (limited to 'src/proj_4D_api.c')
-rw-r--r--src/proj_4D_api.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/proj_4D_api.c b/src/proj_4D_api.c
index fa24c430..6654522c 100644
--- a/src/proj_4D_api.c
+++ b/src/proj_4D_api.c
@@ -100,7 +100,7 @@ double proj_xyz_dist (XYZ a, XYZ b) {
/* Measure numerical deviation after n roundtrips fwd-inv (or inv-fwd) */
double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD *coo) {
int i;
- PJ_COORD o, u, org;
+ PJ_COORD t, org;
if (0==P)
return HUGE_VAL;
@@ -111,23 +111,23 @@ double proj_roundtrip (PJ *P, PJ_DIRECTION direction, int n, PJ_COORD *coo) {
}
/* in the first half-step, we generate the output value */
- u = org = *coo;
- o = *coo = proj_trans (P, direction, u);
+ org = *coo;
+ *coo = proj_trans (P, direction, org);
+ t = *coo;
- /* now we take n-1 full steps */
- for (i = 0; i < n - 1; i++) {
- u = proj_trans (P, -direction, o);
- o = proj_trans (P, direction, u);
- }
+ /* now we take n-1 full steps in inverse direction: We are */
+ /* out of phase due to the half step already taken */
+ for (i = 0; i < n - 1; i++)
+ t = proj_trans (P, direction, proj_trans (P, -direction, t) );
/* finally, we take the last half-step */
- u = proj_trans (P, -direction, o);
+ t = proj_trans (P, -direction, t);
/* checking for angular *input* since we do a roundtrip, and end where we begin */
if (proj_angular_input (P, direction))
- return proj_lpz_dist (P, org.lpz, u.lpz);
+ return proj_lpz_dist (P, org.lpz, t.lpz);
- return proj_xyz_dist (org.xyz, u.xyz);
+ return proj_xyz_dist (org.xyz, t.xyz);
}