sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 04/05: Delegate to parent class for geodesic distance on equator.
Date Fri, 09 Aug 2019 10:37:08 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 d42ec44c547afa9f54e2acab547d46f560b5590b
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Fri Aug 9 12:11:33 2019 +0200

    Delegate to parent class for geodesic distance on equator.
---
 .../sis/referencing/GeodesicsOnEllipsoid.java      | 26 +++++++++-------------
 1 file changed, 11 insertions(+), 15 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 650b3f0..4c83231 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
@@ -604,16 +604,6 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
             Δλ = -Δλ;
         }
         /*
-         * Compute reduced latitudes β (Karney 6). Actually we don't need the β angles
-         * (except for a special case), but rather their sine and cosine values.
-         */
-        final double tanβ1 = axisRatio * tan(φ1);
-        final double tanβ2 = axisRatio * tan(φ2);
-        final double cosβ1 = 1 / sqrt(1 + tanβ1*tanβ1);
-        final double cosβ2 = 1 / sqrt(1 + tanβ2*tanβ2);
-        final double sinβ1 = tanβ1 * cosβ1;
-        final double sinβ2 = tanβ2 * cosβ2;
-        /*
          * Compute an approximation of the azimuth α₁ at starting point. This estimation
will be refined by iteration
          * in the loop later, but that iteration will not converge if the first α₁ estimation
is not good enough. The
          * general formula does not give good α₁ initial value for antipodal points, so
we need to check for special
@@ -637,13 +627,19 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
                 // Karney's special case documented before equation 45.
                 throw new GeodesicException("Can not compute geodesics for antipodal points
on equator.");
             }
-            final double Δφ = φ2 - φ1;
-            geodesicDistance = hypot(Δλ, Δφ) * semiMajorAxis;
-            msinα1 = msinα2 = (inverseLongitudeSigns ^ swapPoints) ? -Δλ : Δλ;
-            mcosα1 = mcosα2 = (inverseLatitudeSigns  ^ swapPoints) ? -Δφ : Δφ;
-            setValid(STARTING_AZIMUTH | ENDING_AZIMUTH | GEODESIC_DISTANCE);
+            super.computeDistance();
             return;
         }
+        /*
+         * Reduced latitudes β (Karney 6). Actually we don't need the β angles
+         * (except for a special case), but rather their sine and cosine values.
+         */
+        final double tanβ1 = axisRatio * tan(φ1);
+        final double tanβ2 = axisRatio * tan(φ2);
+        final double cosβ1 = 1 / sqrt(1 + tanβ1*tanβ1);
+        final double cosβ2 = 1 / sqrt(1 + tanβ2*tanβ2);
+        final double sinβ1 = tanβ1 * cosβ1;
+        final double sinβ2 = tanβ2 * cosβ2;
         double α1;
         if (Δλ >= PI - NEARLY_ANTIPODAL_Δλ && abs(φ1 + φ2) <= NEARLY_ANTIPODAL_Δλ)
{
             /*


Mime
View raw message