sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1690629 - in /sis/branches/JDK8/core/sis-referencing/src: main/java/org/apache/sis/referencing/operation/projection/ test/java/org/apache/sis/referencing/operation/projection/
Date Mon, 13 Jul 2015 10:52:41 GMT
Author: desruisseaux
Date: Mon Jul 13 10:52:41 2015
New Revision: 1690629

URL: http://svn.apache.org/r1690629
Log:
Renamed MercatorAlternative as MercatorMethodComparison and updated documentation.

Added:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
      - copied, changed from r1690623, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorAlternative.java
Removed:
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorAlternative.java
Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/GeneralLambert.java
    sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/GeneralLambertTest.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/GeneralLambert.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/GeneralLambert.java?rev=1690629&r1=1690628&r2=1690629&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/GeneralLambert.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/GeneralLambert.java
[UTF-8] Mon Jul 13 10:52:41 2015
@@ -47,7 +47,7 @@ abstract class GeneralLambert extends No
     /**
      * The threshold value of {@link #excentricity} at which we consider the accuracy of
the
      * series expansion insufficient. This threshold is determined empirically with the help
-     * of the {@code MercatorAlternative} class in the test directory.
+     * of the {@code MercatorMethodComparison} class in the test directory.
      * We choose the value where:
      *
      * <ul>
@@ -141,7 +141,7 @@ abstract class GeneralLambert extends No
      * <b>Note:</b> §1.3.3 in Geomatics Guidance Note number 7 part 2 (April
2015) uses a series expansion
      * while USGS used an iterative method. The series expansion is twice faster than the
iterative method
      * for the same precision, but this precision is achieved "only" for relatively small
excentricity like
-     * the Earth's one. See the {@code MercatorAlternative} class in the test package for
more discussion.
+     * the Earth's one. See the {@code MercatorMethodComparison} class in the test package
for more discussion.
      *
      * @param  expOfSouthing The <em>reciprocal</em> of the value returned by
{@link #expOfNorthing}.
      * @return The latitude in radians.
@@ -160,14 +160,17 @@ abstract class GeneralLambert extends No
          * Add a correction for the flattened shape of the Earth. The correction can be represented
by an
          * infinite series. Here, we apply only the first 4 terms. Those terms are given
by §1.3.3 in the
          * EPSG guidance note. Note that we add those terms in reverse order, beginning with
the smallest
-         * values, for reducing rounding errors due to IEEE 754 arithmetic. We also store
in ε the value
-         * of the smallest term.
+         * values, for reducing rounding errors due to IEEE 754 arithmetic.
          */
         φ += c8χ * sin(8*φ)
            + c6χ * sin(6*φ)
            + c4χ * sin(4*φ)
            + c2χ * sin(2*φ);
-
+        /*
+         * Note: a previous version checked if the value of the smallest term c8χ·sin(8φ)
was smaller than
+         * the iteration tolerance. But this was not reliable enough. We use now a hard coded
threshold
+         * determined empirically by MercatorMethodComparison.
+         */
         if (!useIterations) {
             return φ;
         }
@@ -177,7 +180,7 @@ abstract class GeneralLambert extends No
          * Try to improve by iteratively solving equation (7-9) from Snyder. However instead
than using
          * Snyder (7-11) as the starting point, we take the result of above calculation as
the initial φ.
          * Assuming that it is closer to the real φ value, this save us some iteration loops
and usually
-         * gives us more accurate results (according MercatorAlternative tests).
+         * gives us more accurate results (according MercatorMethodComparison tests).
          */
         final double hℯ = 0.5 * excentricity;
         for (int i=0; i<MAXIMUM_ITERATIONS; i++) {

Modified: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/GeneralLambertTest.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/GeneralLambertTest.java?rev=1690629&r1=1690628&r2=1690629&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/GeneralLambertTest.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/GeneralLambertTest.java
[UTF-8] Mon Jul 13 10:52:41 2015
@@ -112,16 +112,16 @@ public final strictfp class GeneralLambe
     /**
      * Performs a comparison between φ values computed by the iterative method and by series
expansion.
      * Then compares with the φ values computed by {@link GeneralLambert#φ(double)}, which
uses a mix
-     * of the two methods. See {@link MercatorAlternative} for a discussion.
+     * of the two methods. See {@link MercatorMethodComparison} for a discussion.
      *
      * @throws ProjectionException if an error occurred during computation of φ.
      *
-     * @see MercatorAlternative
+     * @see MercatorMethodComparison
      */
     @Test
     public void compareWithSeriesExpansion() throws ProjectionException {
         final GeneralLambert projection = new NoOp(true);
-        final MercatorAlternative comparator = new MercatorAlternative(projection.excentricitySquared);
+        final MercatorMethodComparison comparator = new MercatorMethodComparison(projection.excentricitySquared);
         final Random random = TestUtilities.createRandomNumberGenerator();
         final int numSamples = 2000;
         for (int i=0; i<numSamples; i++) {

Copied: sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
(from r1690623, sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorAlternative.java)
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java?p2=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java&p1=sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorAlternative.java&r1=1690623&r2=1690629&rev=1690629&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorAlternative.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
[UTF-8] Mon Jul 13 10:52:41 2015
@@ -57,7 +57,7 @@ import static java.lang.Math.*;
  * @version 0.6
  * @module
  */
-public final class MercatorAlternative {   // No 'strictfp' keyword here since we want to
compare with Mercator class.
+public final class MercatorMethodComparison {   // No 'strictfp' keyword here since we want
to compare with Mercator class.
     /**
      * Where to print the outputs of this class.
      */
@@ -77,7 +77,7 @@ public final class MercatorAlternative {
      * Creates a new instance for the excentricty of the WGS84 ellipsoid, which is approximatively
0.08181919084262157.
      * Reminder: the excentricity of a sphere is 0.
      */
-    public MercatorAlternative() {
+    public MercatorMethodComparison() {
         this(0.00669437999014133);  // Squared excentricity.
     }
 
@@ -86,7 +86,7 @@ public final class MercatorAlternative {
      *
      * @param projection the projection from which to take the excentricity.
      */
-    public MercatorAlternative(final NormalizedProjection projection) {
+    public MercatorMethodComparison(final NormalizedProjection projection) {
         this(projection.excentricitySquared);
     }
 
@@ -95,7 +95,7 @@ public final class MercatorAlternative {
      *
      * @param e2 the square of the excentricity.
      */
-    public MercatorAlternative(final double e2) {
+    public MercatorMethodComparison(final double e2) {
         excentricity = sqrt(e2);
         final double e4 = e2 * e2;
         final double e6 = e2 * e4;
@@ -194,9 +194,9 @@ public final class MercatorAlternative {
         }
         /*
          * At this point we finished to collect the statistics for the excentricity of this
particular
-         * MercatorAlternative instance. If this method call is only part of a longer calculation
for
-         * various excentricty values, print a summary in a single line. Otherwise print
more verbose
-         * results.
+         * MercatorMethodComparison instance. If this method call is only part of a longer
calculation
+         * for various excentricty values, print a summary in a single line.
+         * Otherwise print more verbose results.
          */
         if (summarize != null) {
             summarize.append(String.valueOf(excentricity));                     summarize.nextColumn();
@@ -257,7 +257,7 @@ public final class MercatorAlternative {
                 crossThreshold = true;
                 table.appendHorizontalSeparator();
             }
-            final MercatorAlternative alt = new MercatorAlternative(excentricity * excentricity);
+            final MercatorMethodComparison alt = new MercatorMethodComparison(excentricity
* excentricity);
             alt.compare(null, 10000, table);
         }
         table.appendHorizontalSeparator();
@@ -283,7 +283,7 @@ public final class MercatorAlternative {
         out.println("The errors should be almost zero:");
         out.println();
         GeneralLambert projection = new NoOp(false);
-        MercatorAlternative alt = new MercatorAlternative(projection);
+        MercatorMethodComparison alt = new MercatorMethodComparison(projection);
         alt.compare(projection, 10000, null);
 
         out.println();
@@ -291,7 +291,7 @@ public final class MercatorAlternative {
         out.println("The 'GeneralLambert' errors should be the same than the series expansion
errors:");
         out.println();
         projection = new NoOp(true);
-        alt = new MercatorAlternative(projection);
+        alt = new MercatorMethodComparison(projection);
         alt.compare(projection, 1000000, null);
 
         out.println();
@@ -299,7 +299,7 @@ public final class MercatorAlternative {
         out.println("The 'GeneralLambert' errors should be the close to the iterative method
errors:");
         out.println();
         projection = new NoOp(100, 95);
-        alt = new MercatorAlternative(projection);
+        alt = new MercatorMethodComparison(projection);
         alt.compare(projection, 1000000, null);
     }
 }



Mime
View raw message