sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Reduce the number of distinct constants by replacing some additions by subtractions.
Date Mon, 05 Aug 2019 15:32: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 ff8e7692b57fd10abc53bdfd6545925a30fab2e2
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Mon Aug 5 08:30:17 2019 +0200

    Reduce the number of distinct constants by replacing some additions by subtractions.
---
 .../sis/referencing/GeodesicsOnEllipsoid.java      | 23 +++++++++++-----------
 .../apache/sis/referencing/GeodeticCalculator.java |  1 +
 2 files changed, 13 insertions(+), 11 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 abdbc07..013cfb6 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
@@ -269,22 +269,23 @@ class GeodesicsOnEllipsoid extends GeodeticCalculator {
                + ε*(3./128)))));
         /*
          * Karney equation 25 with fε = εⁿ where n = 1, 2, 3, …. The coefficients below
differ from
-         * the ones published by Karney because they have been combined using Clenshaw summation.
+         * the ones published by Karney because they have been combined using Clenshaw summation
+         * (see sphericalToEllipsoidalAngle(…) below for a simpler example for Clenshaw
summation).
          */
         double fε;
-        C31 = (fε  = ε) * ( 1./4     +   n*(-1./4)
-                   + ε  * ( 1./8     +   n*(             n*(-1./8 ))
-                   + ε  * ( 1./48    +   n*( 3./32   +   n*(-1./24))
-                   + ε  * ( 1./64    +   n*( 1./24)
+        C31 = (fε  = ε) * ( 1./4     -   n*(1./4)
+                   + ε  * ( 1./8     -   n*(            n*(1./8 ))
+                   + ε  * ( 1./48    +   n*(3./32   -   n*(1./24))
+                   + ε  * ( 1./64    +   n*(1./24)
                    + ε  * (23./1280)))));
-        C32 = (fε *= ε) * ( 1./8     +   n*(-3./16   +   n*( 1./16))
-                   + ε  * ( 3./32    +   n*(-1./16   +   n*(-3./32))
-                   + ε  * (-1./128   +   n*( 1./8)
+        C32 = (fε *= ε) * ( 1./8     -   n*(3./16   -   n*(1./16))
+                   + ε  * ( 3./32    -   n*(1./16   +   n*(3./32))
+                   + ε  * (-1./128   +   n*(1./8)
                    + ε  * (-1./64))));
-        C33 = (fε *= ε) * ( 5./48    +   n*(-3./16   +   n*(5./48))
-                   + ε  * ( 3./32    +   n*(-5./48)
+        C33 = (fε *= ε) * ( 5./48    -   n*(3./16   -   n*(5./48))
+                   + ε  * ( 3./32    -   n*(5./48)
                    + ε  * (-7./160)));
-        C34 = (fε *= ε) * ( 7./64    +   n*(-7./32)
+        C34 = (fε *= ε) * ( 7./64    -   n*(7./32)
                    + ε  * ( 7./64));
         C35 = (fε *  ε) * (21./160);
         return k2;
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 47ca3a6..2c54093 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
@@ -550,6 +550,7 @@ public class GeodeticCalculator {
     /**
      * Returns or computes the length of rhumb line (part of constant heading) from start
point to end point.
      * This is sometime called "loxodrome". This is <strong>not</strong> the
shortest path between two points.
+     * The rhumb line distance may be up to 50% longer than the geodesic distance.
      *
      * @return length of rhumb line in the unit of measurement given by {@link #getDistanceUnit()}.
      * @throws IllegalStateException if a point has not been set.


Mime
View raw message