aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@novatron.fi>2022-03-23 16:52:01 +0200
committerOskari Timperi <oskari.timperi@novatron.fi>2022-03-23 16:52:01 +0200
commit9d04d4d186c861099132bcd87122f1de25a89362 (patch)
tree76775fd0f53787d3ac24fca4fc8d301b11983dc9
parent8c51e3c99acc9083d82a5a7a6dae146e2a689f8e (diff)
downloadPROJ-9d04d4d186c861099132bcd87122f1de25a89362.tar.gz
PROJ-9d04d4d186c861099132bcd87122f1de25a89362.zip
Steps with omit_inv are not considered when checking if inverse pipeline operation is possible
-rw-r--r--src/pipeline.cpp2
-rw-r--r--test/gie/more_builtins.gie26
2 files changed, 27 insertions, 1 deletions
diff --git a/src/pipeline.cpp b/src/pipeline.cpp
index 2f50162f..bdbd1d49 100644
--- a/src/pipeline.cpp
+++ b/src/pipeline.cpp
@@ -550,7 +550,7 @@ PJ *OPERATION(pipeline,0) {
/* determine if an inverse operation is possible */
for( auto& step: pipeline->steps) {
PJ *Q = step.pj;
- if ( pj_has_inverse(Q) ) {
+ if ( step.omit_inv || pj_has_inverse(Q) ) {
continue;
} else {
P->inv = nullptr;
diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie
index 67635642..b42dc1c5 100644
--- a/test/gie/more_builtins.gie
+++ b/test/gie/more_builtins.gie
@@ -879,4 +879,30 @@ expect 5.875 55.375 0
-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+# Test inverse pipeline with noninvertible affine transformation. We define an
+# affine transformation that's not invertible and omit the inverse path. We
+# also define a step that handles the inverse and omits the forward path.
+#
+# Because the first affine matrix is not invertible, we specify omit_inv to
+# disable executing in reverse.
+#
+# Now we need another affine to actually make the inverse operation.
+#
+# The second affine has omit_fwd and inv. We don't execute this when running
+# forwards. When doing inverse, we call the inverse of the inverted affine which
+# means that we actually do the forward of the specified affine. As it happens,
+# the forward of this affine actually undoes what the first affine did in forward
+# path.
+-------------------------------------------------------------------------------
+
+-------------------------------------------------------------------------------
+operation proj=pipeline step proj=affine omit_inv s11=2 s22=0 s33=0 step proj=affine omit_fwd inv s11=0.5 s22=0 s33=0
+-------------------------------------------------------------------------------
+
+accept 10 0 0
+expect 20 0 0
+roundtrip
+
</gie-strict>