sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 04/04: Use the same latitude difference threshold for geodesic and rhumb line distances.
Date Sat, 03 Aug 2019 08:19:40 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 919c2f2bcf94b72854e5906794fa69e6628ecf90
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Sat Aug 3 10:17:11 2019 +0200

    Use the same latitude difference threshold for geodesic and rhumb line distances.
---
 .../sis/referencing/GeodesicsOnEllipsoid.java      | 21 --------------------
 .../apache/sis/referencing/GeodeticCalculator.java | 23 +++++++++++++++++++++-
 2 files changed, 22 insertions(+), 22 deletions(-)

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 92c8f94..abdbc07 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
@@ -25,7 +25,6 @@ import org.apache.sis.internal.referencing.Formulas;
 import org.apache.sis.math.MathFunctions;
 
 import static java.lang.Math.*;
-import static org.apache.sis.internal.metadata.ReferencingServices.NAUTICAL_MILE;
 
 
 /**
@@ -108,26 +107,6 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
     private static final double NEARLY_ANTIPODAL_Δλ = 0.25 * (PI/180);
 
     /**
-     * Maximal difference (in radians) between two latitudes for enabling the use of simplified
formulas.
-     * This is used in two contexts:
-     *
-     * <ul>
-     *   <li>Maximal difference between latitude φ₁ and equator for using the equatorial
approximation.</li>
-     *   <li>Maximal difference between |β₁| and |β₂| for enabling the use of
Karney's equation 47.</li>
-     * </ul>
-     *
-     * Those special cases are needed when general formulas produce indeterminations like
0/0.
-     * Current angular value corresponds to a distance of 1 millimetre on a planet of the
size
-     * of Earth, which is about 1.57E-10 radians. This value is chosen empirically by trying
to
-     * minimize the amount of "No convergence errors" reported by {@code GeodesicsOnEllipsoidTest}
-     * in the {@code compareAgainstDataset()} method.
-     *
-     * <p><b>Note:</b> this is an angular tolerance threshold, but is also
used with sine and cosine values
-     * because sin(θ) ≈ θ for small angles.</p>
-     */
-    private static final double LATITUDE_THRESHOLD = 0.001 / (NAUTICAL_MILE*60) * (PI/180);
-
-    /**
      * The square of eccentricity: ℯ² = (a²-b²)/a² where
      * <var>ℯ</var> is the eccentricity,
      * <var>a</var> is the <cite>semi-major</cite> axis length and
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
index 3e63721..47ca3a6 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/GeodeticCalculator.java
@@ -51,6 +51,7 @@ import org.apache.sis.util.ArgumentChecks;
 import org.apache.sis.io.TableAppender;
 
 import static java.lang.Math.*;
+import static org.apache.sis.internal.metadata.ReferencingServices.NAUTICAL_MILE;
 
 
 /**
@@ -107,6 +108,26 @@ import static java.lang.Math.*;
  */
 public class GeodeticCalculator {
     /**
+     * Maximal difference (in radians) between two latitudes for enabling the use of simplified
formulas.
+     * This is used in two contexts:
+     *
+     * <ul>
+     *   <li>Maximal difference between latitude φ₁ and equator for using the equatorial
approximation.</li>
+     *   <li>Maximal difference between |β₁| and |β₂| for enabling the use of
Karney's equation 47.</li>
+     * </ul>
+     *
+     * Those special cases are needed when general formulas produce indeterminations like
0/0.
+     * Current angular value corresponds to a distance of 1 millimetre on a planet of the
size
+     * of Earth, which is about 1.57E-10 radians. This value is chosen empirically by trying
to
+     * minimize the amount of "No convergence errors" reported by {@code GeodesicsOnEllipsoidTest}
+     * in the {@code compareAgainstDataset()} method.
+     *
+     * <p><b>Note:</b> this is an angular tolerance threshold, but is also
used with sine and cosine values
+     * because sin(θ) ≈ θ for small angles.</p>
+     */
+    static final double LATITUDE_THRESHOLD = 0.001 / (NAUTICAL_MILE*60) * (PI/180);
+
+    /**
      * The transform from user coordinates to geodetic coordinates used in computation.
      * This object also holds the following information:
      *
@@ -592,7 +613,7 @@ public class GeodeticCalculator {
         final double Δλ = λ2 - λ1;
         final double Δφ = φ2 - φ1;
         final double factor;
-        if (abs(Δφ) < Formulas.ANGULAR_TOLERANCE) {
+        if (abs(Δφ) < LATITUDE_THRESHOLD) {
             factor = Δλ * cos((φ1 + φ2)/2);
         } else {
             /*


Mime
View raw message