From b104bc7afbf08a5d2e6097276784424d091b3f59 Mon Sep 17 00:00:00 2001 From: Even Rouault Date: Thu, 20 Aug 2020 23:06:33 +0200 Subject: Helmert: fix regression when rotation terms are 0, but scale is not Fixes #2333 Was due to 3dc92ad7014e1cf20a3bc95c8c21a34a371fcb78 Doesn't affect released versions --- src/transformations/helmert.cpp | 8 ++------ test/gie/more_builtins.gie | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/transformations/helmert.cpp b/src/transformations/helmert.cpp index 9fb568a8..d3857d89 100644 --- a/src/transformations/helmert.cpp +++ b/src/transformations/helmert.cpp @@ -373,7 +373,7 @@ static PJ_XYZ helmert_forward_3d (PJ_LPZ lpz, PJ *P) { return point.xyz; } - if (Q->no_rotation) { + if (Q->no_rotation && Q->scale == 0) { point.xyz.x = lpz.lam + Q->xyz.x; point.xyz.y = lpz.phi + Q->xyz.y; point.xyz.z = lpz.z + Q->xyz.z; @@ -413,7 +413,7 @@ static PJ_LPZ helmert_reverse_3d (PJ_XYZ xyz, PJ *P) { return point.lpz; } - if (Q->no_rotation) { + if (Q->no_rotation && Q->scale == 0) { point.xyz.x = xyz.x - Q->xyz.x; point.xyz.y = xyz.y - Q->xyz.y; point.xyz.z = xyz.z - Q->xyz.z; @@ -678,10 +678,6 @@ PJ *TRANSFORMATION(helmert, 0) { proj_log_trace(P, "ds= %8.5f t_epoch=%8.5f", Q->dscale, Q->t_epoch); } - if (Q->no_rotation) { - return P; - } - update_parameters(P); build_rot_matrix(P); diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie index b9a92e58..41d0ac52 100644 --- a/test/gie/more_builtins.gie +++ b/test/gie/more_builtins.gie @@ -416,6 +416,19 @@ accept 3370658.378 711877.314 5349787.086 2018.0 expect 3370658.18087 711877.42750 5349787.12648 2018.0 ------------------------------------------------------------------------------- +------------------------------------------------------------------------------- +# Test case of https://github.com/OSGeo/PROJ/issues/2333 +------------------------------------------------------------------------------- +operation +proj=helmert +x=-0.0019 +y=-0.0017 +z=-0.0105 +s=0.00134 \ + +dx=0.0001 +dy=0.0001 +dz=-0.0018 +ds=0.00008 +t_epoch=2000.0 \ + +convention=position_vector +------------------------------------------------------------------------------- +tolerance 0.1 mm +accept 3513638.1938 778956.4525 5248216.4690 2008.75 +expect 3513638.1999 778956.4533 5248216.4535 2008.75 +------------------------------------------------------------------------------- + + ------------------------------------------------------------------------------- # Test error cases of helmert ------------------------------------------------------------------------------- -- cgit v1.2.3