This is an automated email from the ASF dual-hosted git repository. desruisseaux pushed a commit to branch geoapi-4.0 in repository https://gitbox.apache.org/repos/asf/sis.git
commit 5959330e5f2a7ab42c1824b018729e23c142a595 Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Sat Feb 5 18:31:55 2022 +0100 Avoid creating inverse transform when not needed. --- .../sis/referencing/operation/transform/AbstractMathTransform.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java index fa74432..27f051d 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/AbstractMathTransform.java @@ -78,7 +78,7 @@ import static org.apache.sis.util.ArgumentChecks.ensureDimensionMatches; * running the same SIS version. * * @author Martin Desruisseaux (IRD, Geomatys) - * @version 1.0 + * @version 1.2 * * @see DefaultMathTransformFactory * @see org.apache.sis.referencing.operation.AbstractCoordinateOperation @@ -805,6 +805,10 @@ public abstract class AbstractMathTransform extends FormattableObject { return false; } + if ((tr1 instanceof LinearTransform) != (tr2 instanceof LinearTransform)) { + // For avoiding creation of inverse transform for a result that should be false. + return false; + } try { tr1 = tr1.inverse(); } catch (NoninvertibleTransformException e) {