sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] branch geoapi-4.0 updated: Add comment explaining better how the scale factors are computed in `GridDerivation.subgrid(…)`.
Date Tue, 09 Apr 2019 12:46:54 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


The following commit(s) were added to refs/heads/geoapi-4.0 by this push:
     new 8a7a5d8  Add comment explaining better how the scale factors are computed in `GridDerivation.subgrid(…)`.
8a7a5d8 is described below

commit 8a7a5d8d1aee453d88acefa317cb70b03fd39fc5
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Tue Apr 9 14:46:23 2019 +0200

    Add comment explaining better how the scale factors are computed in `GridDerivation.subgrid(…)`.
---
 .../main/java/org/apache/sis/coverage/grid/GridDerivation.java    | 8 ++++++++
 .../src/main/java/org/apache/sis/coverage/grid/GridGeometry.java  | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
index b5f62e0..4db9d15 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridDerivation.java
@@ -412,6 +412,14 @@ public class GridDerivation {
             if (baseExtent != base.extent && baseExtent.equals(gridOfInterest.extent))
{
                 baseExtent = gridOfInterest.extent;                                     
           // Share common instance.
             }
+            /*
+             * The subsampling will be determined by scale factors of the transform from
the given desired grid geometry to
+             * the current (base) grid geometry. For example a scale of 10 means that every
time we advance by one pixel in
+             * `gridOfInterest`, we will advance by 10 pixels in `base`.  We compute the
scales (indirectly, because of the
+             * way transforms are concatenated) as the ratio between `gridOfInterest` resolution
and `base` resolution,
+             * computed in the center of the area of interest (may be different than base
grid center). In the following
+             * call to `resolution(…)`, the domain must be the source of the `mapCenters`
transform.
+             */
             scales = GridGeometry.resolution(mapCenters, domain);
         }
         return this;
diff --git a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
index 1009186..2b86fce 100644
--- a/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
+++ b/core/sis-raster/src/main/java/org/apache/sis/coverage/grid/GridGeometry.java
@@ -762,6 +762,10 @@ public class GridGeometry implements Serializable {
      *
      * <p>Note that for this computation, it does not matter if {@code gridToCRS} is
the user-specified
      * transform or the {@code this.gridToCRS} field value; both should produce equivalent
results.</p>
+     *
+     * @param  gridToCRS  a transform for which to compute the resolution, or {@code null}
if none.
+     * @param  domain     the domain for which to get a resolution, or {@code null} if none.
+     *                    If non-null, must be the source of {@code gridToCRS}.
      */
     static double[] resolution(final MathTransform gridToCRS, final GridExtent domain) {
         final Matrix matrix = MathTransforms.getMatrix(gridToCRS);
@@ -778,6 +782,7 @@ public class GridGeometry implements Serializable {
     /**
      * Computes the resolutions from the given matrix. This is the magnitude of each row
vector.
      *
+     * @param  gridToCRS    Jacobian matrix or affine transform for which to compute the
resolution.
      * @param  numToIgnore  number of rows and columns to ignore at the end of the matrix.
      *         This is 0 if the matrix is a derivative (i.e. we ignore nothing), or 1 if
the matrix
      *         is an affine transform (i.e. we ignore the translation column and the [0 0
… 1] row).


Mime
View raw message