aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOskari Timperi <oskari.timperi@novatron.fi>2022-03-24 15:33:43 +0200
committerOskari Timperi <oskari.timperi@novatron.fi>2022-03-24 15:33:43 +0200
commit4de2e4b049be5235b2ef9b518a57a43b86f880ad (patch)
treece31dad475734a5078943a5496972ece46a29616
parent9d04d4d186c861099132bcd87122f1de25a89362 (diff)
downloadPROJ-inverse-fix.tar.gz
PROJ-inverse-fix.zip
Add more tests for testing +omit_fwd, +omit_inv and +invinverse-fix
-rw-r--r--test/gie/more_builtins.gie152
1 files changed, 134 insertions, 18 deletions
diff --git a/test/gie/more_builtins.gie b/test/gie/more_builtins.gie
index b42dc1c5..b388fa09 100644
--- a/test/gie/more_builtins.gie
+++ b/test/gie/more_builtins.gie
@@ -878,31 +878,147 @@ accept 4.5 52.5 0
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.
+===============================================================================
+# Tests for testing that +omit_fwd, +omit_inv and +inv work together like they
+# should.
#
-# Because the first affine matrix is not invertible, we specify omit_inv to
-# disable executing in reverse.
+# +omit_fwd specifies that a step should be omitted when running forwards.
#
-# Now we need another affine to actually make the inverse operation.
+# +omit_inv specifies that a step should be omitted when running backwards.
#
-# 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.
+# +inv specifies that a step should be inverted. The forward path would do
+# inverse operation and inverse path would do forward operation.
+#
+# | | invertible step | non-invertible step |
+# | flags | forward path | inverse path | forward path | inverse path |
+# | -------------- | ------------ | ------------ | ------------ | ------------ |
+# | +omit_fwd | omit | inv | omit | undefined |
+# | +omit_fwd +inv | omit | fwd | omit | fwd |
+# | +omit_inv | fwd | omit | fwd | omit |
+# | +omit_inv +inv | inv | omit | undefined | omit |
+#
+# From the table we can see that invertible steps should work pretty much all
+# the time. Non-invertible steps on the other hand make either the forward path
+# or inverse path undefined depending on which flags the step has.
+#
+# A non-invertible step is for example an affine transformation where we cannot
+# calculate the inverse of the matrix.
+===============================================================================
+
+-------------------------------------------------------------------------------
+# Test that +omit_fwd, +omit_inv and +inv work correctly with an invertible step.
-------------------------------------------------------------------------------
+# Test that forward path does nothing and inverse path does inverse transformation
+
+operation proj=pipeline step proj=affine s11=2 omit_fwd
+
+direction forward
+accept 1 2 3
+expect 1 2 3
+
+direction inverse
+accept 1 2 3
+expect 0.5 2 3
+
+# Test that forward path does nothing and inverse path does forward transformation
+
+operation proj=pipeline step proj=affine s11=2 omit_fwd inv
+
+direction forward
+accept 1 2 3
+expect 1 2 3
+
+direction inverse
+accept 1 2 3
+expect 2 2 3
+
+# Test that forward path does forward transformation and inverse path does nothing
+
+operation proj=pipeline step proj=affine s11=2 omit_inv
+
+direction forward
+accept 1 2 3
+expect 2 2 3
+
+direction inverse
+accept 1 2 3
+expect 1 2 3
+
+# Test that forward path does inverse transformation and inverse path does nothing
+
+operation proj=pipeline step proj=affine s11=2 omit_inv inv
+
+direction forward
+accept 1 2 3
+expect 0.5 2 3
+
+direction inverse
+accept 1 2 3
+expect 1 2 3
+
-------------------------------------------------------------------------------
-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
+# Test that +omit_fwd, +omit_inv and +inv work correctly with a non-invertible step.
-------------------------------------------------------------------------------
-accept 10 0 0
-expect 20 0 0
-roundtrip
+# Test that forward path does nothing and inverse path is not defined.
+#
+# The affine transformation is not invertible so this pipeline cannot be executed in
+# reverse.
+
+operation proj=pipeline step proj=affine s11=1 s12=1 s13=1 s22=0 s33=0 omit_fwd
+
+direction forward
+accept 1 2 3
+expect 1 2 3
+
+direction inverse
+accept 1 2 3
+expect failure errno no_inverse_op
+
+# Test that forward path does nothing and inverse path does forward transformation.
+#
+# The affine transformation does not have an inverse, but inv specifies that the
+# step should be done in inverse order relative to our pipeline direction. When
+# we execute the pipeline in reverse, we should call the forward transformation of
+# the step which is defined so the pipeline should be valid in reverse.
+
+operation proj=pipeline step proj=affine s11=1 s12=1 s13=1 s22=0 s33=0 omit_fwd inv
+
+direction forward
+accept 1 2 3
+expect 1 2 3
+
+direction inverse
+accept 1 2 3
+expect 6 0 0
+
+# Test that the forward path does forward transformation and inverse path does nothing.
+
+operation proj=pipeline step proj=affine s11=1 s12=1 s13=1 s22=0 s33=0 omit_inv
+
+direction forward
+accept 1 2 3
+expect 6 0 0
+
+direction inverse
+accept 1 2 3
+expect 1 2 3
+
+# Test that the forward path is not defined and inverse path does nothing.
+#
+# When going through the forward path, inv specifies that we should execute the
+# step in reverse. Because the affine transformation does not have an inverse,
+# this means that the forward path does not exist.
+
+operation proj=pipeline step proj=affine s11=1 s12=1 s13=1 s22=0 s33=0 omit_inv inv
+
+direction forward
+accept 1 2 3
+expect failure errno no_inverse_op
+
+direction inverse
+accept 1 2 3
+expect 1 2 3
</gie-strict>