sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 03/04: Adjustment in the way iteration tolerance is determined.
Date Sat, 03 Aug 2019 08:19:39 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 31042ac39f08bf84d5d1b1854248a3c3c878819b
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Aug 3 07:57:04 2019 +0200

    Adjustment in the way iteration tolerance is determined.
---
 .../sis/internal/referencing/provider/GeocentricAffine.java  |  2 +-
 .../org/apache/sis/referencing/GeodesicsOnEllipsoid.java     | 12 +++---------
 .../org/apache/sis/referencing/GeodeticCalculatorTest.java   |  3 ++-
 3 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
index c984401..262ea25 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/internal/referencing/provider/GeocentricAffine.java
@@ -70,7 +70,7 @@ public abstract class GeocentricAffine extends GeodeticOperation {
     /**
      * The tolerance factor for comparing the {@link BursaWolfParameters} values.
      * We use a tolerance of 1E-6 ({@value Formulas#LINEAR_TOLERANCE} / 10000) based on the
knowledge
-     * that the translation terms are in metres and the rotation terms have the some order
of magnitude.
+     * that the translation terms are in metres and the rotation terms have the same order
of magnitude.
      * Actually we could use a value of zero, but we add a small tolerance for rounding errors.
      */
     private static final double BURSAWOLF_TOLERANCE = Formulas.LINEAR_TOLERANCE / 10000;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodesicsOnEllipsoid.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodesicsOnEllipsoid.java
index 8d15823..92c8f94 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodesicsOnEllipsoid.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodesicsOnEllipsoid.java
@@ -88,13 +88,7 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
     static final boolean STORE_LOCAL_VARIABLES = false;
 
     /**
-     * Factor by which the accuracy is improved compared to {@link Formulas#ANGULAR_TOLERANCE}
value.
-     * For example the linear accuracy that {@code GeodesicsOnEllipsoid} aims to achieve
is:
-     *
-     * <blockquote><code>
-     * accuracy = {@linkplain Formulas#LINEAR_TOLERANCE} / ACCURACY_IMPROVEMENT
-     * </code></blockquote>
-     *
+     * Accuracy threshold iterative computations, in radians.
      * We take a finer accuracy than default SIS configuration in order to met the accuracy
of numbers
      * published in Karney (2013). If this value is modified, the effect can be verified
by executing
      * the {@code GeodesicsOnEllipsoidTest} methods that compare computed values against
Karney's tables.
@@ -104,7 +98,7 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
      * completes the iteration step which was in progress. Consequently the final accuracy
is one iteration
      * better than the accuracy computed from this value.</p>
      */
-    static final double ACCURACY_IMPROVEMENT = 20;
+    static final double ITERATION_TOLERANCE = Formulas.ANGULAR_TOLERANCE * (PI/180) / 20;
 
     /**
      * Difference between ending point and antipode of starting point for considering them
as nearly antipodal.
@@ -776,7 +770,7 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
             λ1E = sphericalToGeodeticLongitude(ω1, σ1);
             λ2E = sphericalToGeodeticLongitude(ω2, σ2);
             final double Δλ_error = IEEEremainder(λ2E - λ1E - Δλ, 2*PI);
-            if ((abs(Δλ_error) <= Formulas.ANGULAR_TOLERANCE * (PI/180) / ACCURACY_IMPROVEMENT))
{
+            if (abs(Δλ_error) <= ITERATION_TOLERANCE) {
                 moreRefinements = 0;
             } else if (--moreRefinements == 0) {
                 throw new GeodesicException(Resources.format(Resources.Keys.NoConvergence));
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
index 16a740f..6040529 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/GeodeticCalculatorTest.java
@@ -48,6 +48,7 @@ import org.junit.Test;
 
 import static java.lang.StrictMath.*;
 import static org.opengis.test.Assert.*;
+import static org.apache.sis.internal.metadata.ReferencingServices.AUTHALIC_RADIUS;
 
 
 /**
@@ -494,7 +495,7 @@ public strictfp class GeodeticCalculatorTest extends TestCase {
                      * We also aim for azimuthd such as the error is less than 1 cm after
the first 10 km.
                      * If points are nearly antipodal, we relax the azimuth tolerance threshold
to 1 meter.
                      */
-                    linearTolerance    = Formulas.LINEAR_TOLERANCE / (GeodesicsOnEllipsoid.ACCURACY_IMPROVEMENT
/ 2);
+                    linearTolerance    = 2 * GeodesicsOnEllipsoid.ITERATION_TOLERANCE * AUTHALIC_RADIUS;
                     latitudeTolerance  = Formulas.ANGULAR_TOLERANCE;
                     longitudeTolerance = Formulas.ANGULAR_TOLERANCE / cosφ2;
                     azimuthTolerance   = Formulas.LINEAR_TOLERANCE * (180/PI) / 10000;


Mime
View raw message