sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 02/02: Wrong index in calculation of derivative (Jacobian matrix) from datum shift grid.
Date Wed, 03 Oct 2018 18:18:41 GMT
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 897c71e1334e7b736a5e0cfaf8077f670412e28f
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Wed Oct 3 14:18:06 2018 -0400

    Wrong index in calculation of derivative (Jacobian matrix) from datum shift grid.
---
 .../main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java  | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
index 6590e61..e61c6ba 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/datum/DatumShiftGrid.java
@@ -532,9 +532,9 @@ public abstract class DatumShiftGrid<C extends Quantity<C>, T
extends Quantity<T
         final int iy = Math.max(0, Math.min(gridSize[1] - 2, (int) gridY));
         final Matrix derivative = Matrices.createDiagonal(getTranslationDimensions(), gridSize.length);
         for (int j=derivative.getNumRow(); --j>=0;) {
-            final double orig = getCellValue(j, iy, ix);
-            derivative.setElement(j, 0, derivative.getElement(j, 0) + (getCellValue(j, iy+1,
ix) - orig));
-            derivative.setElement(j, 1, derivative.getElement(j, 1) + (getCellValue(j, iy,
ix+1) - orig));
+            final double orig = getCellValue(j, ix, iy);
+            derivative.setElement(j, 0, derivative.getElement(j, 0) + (getCellValue(j, ix+1,
iy) - orig));
+            derivative.setElement(j, 1, derivative.getElement(j, 1) + (getCellValue(j, ix,
iy+1) - orig));
         }
         return derivative;
     }


Mime
View raw message