sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject [sis] 01/02: Rename expOfNorthing as expΨ for stretching the relationship with isometric latitude.
Date Thu, 16 May 2019 10:38:25 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 d455bf6cc618c6a955900cb03ae7e4691e8cb9c6
Author: Martin Desruisseaux <martin.desruisseaux@geomatys.com>
AuthorDate: Thu May 16 10:58:49 2019 +0200

    Rename expOfNorthing as expΨ for stretching the relationship with isometric latitude.
---
 .../operation/projection/ConformalProjection.java  | 51 +++++++--------
 .../projection/LambertConicConformal.java          | 23 ++++---
 .../referencing/operation/projection/Mercator.java |  6 +-
 .../operation/projection/ObliqueMercator.java      | 10 +--
 .../operation/projection/PolarStereographic.java   |  6 +-
 .../projection/ConformalProjectionTest.java        | 72 +++++++++++-----------
 .../projection/MercatorMethodComparison.java       | 10 +--
 7 files changed, 90 insertions(+), 88 deletions(-)

diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
index c2a9045..2fa54ff 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ConformalProjection.java
@@ -167,8 +167,8 @@ abstract class ConformalProjection extends NormalizedProjection {
      * This formula is also part of other projections, since Mercator can be considered as
a special case of
      * Lambert Conic Conformal for instance.
      *
-     * <p>This function is <em>almost</em> the converse of the {@link #expOfNorthing(double,
double)} function.
-     * In a Mercator inverse projection, the value of the {@code expOfSouthing} argument
is {@code exp(-y)}.</p>
+     * <p>This function is <em>almost</em> the converse of the {@link #expΨ(double,
double)} function.
+     * In a Mercator inverse projection, the value of the {@code rexpΨ} argument is {@code
exp(-Ψ)}.</p>
      *
      * <p>The input should be a positive number, otherwise the result will be either
outside
      * the [-π/2 … π/2] range, or will be NaN. Its behavior at some particular points
is:</p>
@@ -184,14 +184,14 @@ abstract class ConformalProjection extends NormalizedProjection {
      * for the same precision, but this precision is achieved "only" for relatively small
eccentricity like
      * 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}.
+     * @param  rexpΨ  the <em>reciprocal</em> of the value returned by {@link
#expΨ}.
      * @return the latitude in radians.
      * @throws ProjectionException if the iteration does not converge.
      *
-     * @see #expOfNorthing(double, double)
+     * @see #expΨ(double, double)
      * @see #dy_dφ(double, double)
      */
-    final double φ(final double expOfSouthing) throws ProjectionException {
+    final double φ(final double rexpΨ) throws ProjectionException {
         /*
          * Get a first approximation of φ from Snyder (7-11). The result below would be
exact if the
          * ellipsoid was actually a sphere. But if the eccentricity is different than 0,
then we will
@@ -200,7 +200,7 @@ abstract class ConformalProjection extends NormalizedProjection {
          * Note that the φ value computed by the line below is called χ in EPSG guide.
          * We name it φ in our code because we will modify that value in-place in order
to get φ.
          */
-        double φ = (PI/2) - 2*atan(expOfSouthing);          // at this point == χ (conformal
latitude).
+        double φ = (PI/2) - 2*atan(rexpΨ);                  // at this point == χ (conformal
latitude).
         /*
          * 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
@@ -232,8 +232,8 @@ abstract class ConformalProjection extends NormalizedProjection {
         final double hℯ = 0.5 * eccentricity;
         for (int it=0; it<MAXIMUM_ITERATIONS; it++) {
             final double ℯsinφ = eccentricity * sin(φ);
-            final double Δφ = φ - (φ = PI/2 - 2*atan(expOfSouthing * pow((1 - ℯsinφ)/(1
+ ℯsinφ), hℯ)));
-            if (!(abs(Δφ) > ITERATION_TOLERANCE)) {     // Use '!' for accepting NaN.
+            final double Δφ = φ - (φ = PI/2 - 2*atan(rexpΨ * pow((1 - ℯsinφ)/(1 +
ℯsinφ), hℯ)));
+            if (!(abs(Δφ) > ITERATION_TOLERANCE)) {                 // Use '!' for accepting
NaN.
                 return φ;
             }
         }
@@ -241,16 +241,18 @@ abstract class ConformalProjection extends NormalizedProjection {
     }
 
     /**
-     * Computes part of the Mercator projection for the given latitude. This formula is also
part of
+     * Computes <code>{@linkplain Math#exp(double) exp}(Ψ)</code> where Ψ is
the isometric latitude.
+     * This is part of the Mercator projection for the given latitude. This formula is also
part of
      * Lambert Conic Conformal projection, since Mercator can be considered as a special
case of that
      * Lambert projection with the equator as the single standard parallel.
      *
-     * <p>The Mercator projection is given by the {@linkplain Math#log(double) natural
logarithm}
-     * of the value returned by this method. This function is <em>almost</em>
the converse of
-     * {@link #φ(double)}.
+     * <p>The isometric latitude is given by the {@linkplain Math#log(double) natural
logarithm} of the value returned
+     * by this method. The <em>reciprocal</em> of this function {@code 1/expΨ(φ)}
is the converse of {@link #φ(double)}.
+     * Isometric latitude Ψ is related to conformal latitude χ by {@literal χ(φ) = gd(Ψ(φ))}
where {@literal gd(x)} is the
+     * Gudermannian function. There is many representations of that function, e.g. {@literal
gd(Ψ) = 2⋅atan(expΨ) - π/2}.</p>
      *
      * <p>In IOGP Publication 373-7-2 – Geomatics Guidance Note number 7, part 2
– April 2015,
-     * a function closely related to this one has the letter <var>t</var>.</p>
+     * a function closely related to this method has the letter <var>t</var>.</p>
      *
      *
      * <div class="section">Properties</div>
@@ -261,12 +263,12 @@ abstract class ConformalProjection extends NormalizedProjection {
      *
      * <p>Some values are:</p>
      * <ul>
-     *   <li>expOfNorthing(NaN)    =  NaN</li>
-     *   <li>expOfNorthing(±∞)     =  NaN</li>
-     *   <li>expOfNorthing(-π/2)   =   0</li>
-     *   <li>expOfNorthing( 0  )   =   1</li>
-     *   <li>expOfNorthing(+π/2)   →   ∞  (actually some large value like 1.633E+16)</li>
-     *   <li>expOfNorthing(-φ)     =  1 / expOfNorthing(φ)</li>
+     *   <li>expΨ(NaN)    =  NaN</li>
+     *   <li>expΨ(±∞)     =  NaN</li>
+     *   <li>expΨ(-π/2)   =   0</li>
+     *   <li>expΨ( 0  )   =   1</li>
+     *   <li>expΨ(+π/2)   →   ∞  (actually some large value like 1.633E+16)</li>
+     *   <li>expΨ(-φ)     =  1 / expΨ(φ)</li>
      * </ul>
      *
      *
@@ -293,12 +295,13 @@ abstract class ConformalProjection extends NormalizedProjection {
      *
      * @param  φ      the latitude in radians.
      * @param  ℯsinφ  the sine of the φ argument multiplied by {@link #eccentricity}.
-     * @return {@code Math.exp} of the Mercator projection of the given latitude.
+     * @return {@code Math.exp(Ψ)} where Ψ is the isometric latitude.
      *
      * @see #φ(double)
      * @see #dy_dφ(double, double)
+     * @see <a href="https://en.wikipedia.org/wiki/Latitude#Isometric_latitude">Isometric
latitude on Wikipedia</a>
      */
-    final double expOfNorthing(final double φ, final double ℯsinφ) {
+    final double expΨ(final double φ, final double ℯsinφ) {
         /*
          * Note:   tan(π/4 - φ/2)  =  1 / tan(π/4 + φ/2)
          *
@@ -313,14 +316,14 @@ abstract class ConformalProjection extends NormalizedProjection {
      * Computes the partial derivative of a Mercator projection at the given latitude. This
formula is also part of
      * other projections, since Mercator can be considered as a special case of Lambert Conic
Conformal for instance.
      *
-     * <p>In order to get the derivative of the {@link #expOfNorthing(double, double)}
function, call can multiply
-     * the returned value by by {@code expOfNorthing}.</p>
+     * <p>In order to get the derivative of the {@link #expΨ(double, double)} function,
caller can multiply
+     * the returned value by by {@code expΨ}.</p>
      *
      * @param  sinφ  the sine of latitude.
      * @param  cosφ  the cosine of latitude.
      * @return the partial derivative of a Mercator projection at the given latitude.
      *
-     * @see #expOfNorthing(double, double)
+     * @see #expΨ(double, double)
      * @see #φ(double)
      */
     final double dy_dφ(final double sinφ, final double cosφ) {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
index 230e979..7d9d875 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
@@ -235,11 +235,10 @@ public class LambertConicConformal extends ConformalProjection {
          *
          *     t = tan(π/4 – φ/2) / [(1 – ℯ⋅sinφ)/(1 + ℯ⋅sinφ)] ^ (ℯ/2)
          *
-         * while our 'expOfNorthing' function is defined like above, but with   tan(π/4
+ φ/2)   instead of
-         * tan(π/4 - φ/2). Those two expressions are the reciprocal of each other if we
reverse the sign of
-         * φ (see 'expOfNorthing' for trigonometric identities), but their accuracies are
not equivalent:
-         * the hemisphere having values closer to zero is favorized. The EPSG formulas favorize
the North
-         * hemisphere.
+         * while our 'expΨ' function is defined like above, but with tan(π/4 + φ/2) instead
of tan(π/4 - φ/2).
+         * Those two expressions are the reciprocal of each other if we reverse the sign
of φ (see 'expΨ' for
+         * trigonometric identities), but their accuracies are not equivalent: the hemisphere
having values
+         * closer to zero is favorized. The EPSG formulas favorize the North hemisphere.
          *
          * Since Apache SIS's formula uses the + operator instead of -, we need to reverse
the sign of φ
          * values in order to match the EPSG formulas, but we will do that only if the map
projection is
@@ -260,13 +259,13 @@ public class LambertConicConformal extends ConformalProjection {
         φ2 = toRadians(φ2);
         /*
          * Compute constants. We do not need to use special formulas for the spherical case
below,
-         * since rν(sinφ) = 1 and expOfNorthing(φ) = tan(π/4 + φ/2) when the eccentricity
is zero.
+         * since   rν(sinφ) = 1   and   expΨ(φ) = tan(π/4 + φ/2)   when the eccentricity
is zero.
          * However we need special formulas for φ1 ≈ φ2 in the calculation of n, otherwise
we got
          * a 0/0 indetermination.
          */
         final double sinφ1 = sin(φ1);
         final double m1 = initializer.scaleAtφ(sinφ1, cos(φ1));
-        final double t1 = expOfNorthing(φ1, eccentricity*sinφ1);
+        final double t1 = expΨ(φ1, eccentricity*sinφ1);
         /*
          * Compute n = (ln m₁ – ln m₂) / (ln t₁ – ln t₂), which we rewrite as
ln(m₁/m₂) / ln(t₁/t₂)
          * for reducing the amount of calls to the logarithmic function. Note that this equation
@@ -275,7 +274,7 @@ public class LambertConicConformal extends ConformalProjection {
         if (abs(φ1 - φ2) >= ANGULAR_TOLERANCE) {                    // Should be 'true'
for 2SP case.
             final double sinφ2 = sin(φ2);
             final double m2 = initializer.scaleAtφ(sinφ2, cos(φ2));
-            final double t2 = expOfNorthing(φ2, eccentricity*sinφ2);
+            final double t2 = expΨ(φ2, eccentricity*sinφ2);
             n = log(m1/m2) / log(t1/t2);                            // Tend toward 0/0 if
φ1 ≈ φ2.
         } else {
             n = -sinφ1;
@@ -297,14 +296,14 @@ public class LambertConicConformal extends ConformalProjection {
          * Compute the radius of the parallel of latitude of the false origin.
          * This is related to the "ρ₀" term in Snyder. From EPG guide:
          *
-         *    r = a⋅F⋅tⁿ     where (in our case) a=1 and t is our 'expOfNorthing' function.
+         *    r = a⋅F⋅tⁿ     where (in our case) a=1 and t is our 'expΨ' function.
          *
          * EPSG uses this term in the computation of  y = FN + rF – r⋅cos(θ).
          */
         DoubleDouble rF = null;
-        if (φ0 != copySign(PI/2, -n)) {    // For reducing the rounding error documented
in expOfNorthing(+π/2).
+        if (φ0 != copySign(PI/2, -n)) {    // For reducing the rounding error documented
in expΨ(+π/2).
             rF = new DoubleDouble(F);
-            rF.multiply(pow(expOfNorthing(φ0, eccentricity*sin(φ0)), n));
+            rF.multiply(pow(expΨ(φ0, eccentricity*sin(φ0)), n));
         }
         /*
          * At this point, all parameters have been processed. Now store
@@ -413,7 +412,7 @@ public class LambertConicConformal extends ConformalProjection {
         final double ρ;     // EPSG guide uses "r", but we keep the symbol from Snyder p.
108 for consistency with PolarStereographic.
         if (absφ < PI/2) {
             sinφ = sin(φ);
-            ρ = pow(expOfNorthing(φ, eccentricity*sinφ), n);
+            ρ = pow(expΨ(φ, eccentricity*sinφ), n);
         } else if (absφ < PI/2 + ANGULAR_TOLERANCE) {
             sinφ = 1;
             ρ = (φ*n >= 0) ? POSITIVE_INFINITY : 0;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
index df709b8..9b40ec7 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
@@ -258,7 +258,7 @@ public class Mercator extends ConformalProjection {
             denormalize.convertBefore(0, null, offset);
         }
         if (φ0 != 0) {
-            denormalize.convertBefore(1, null, new DoubleDouble(-log(expOfNorthing(φ0, eccentricity
* sin(φ0)))));
+            denormalize.convertBefore(1, null, new DoubleDouble(-log(expΨ(φ0, eccentricity
* sin(φ0)))));
         }
         if (variant == MILLER) {
             normalize  .convertBefore(1, 0.80, null);
@@ -355,7 +355,7 @@ public class Mercator extends ConformalProjection {
                  */
                 final double a = abs(φ);
                 if (a < PI/2) {
-                    y = log(expOfNorthing(φ, eccentricity * sinφ));                 //
Snyder (7-7)
+                    y = log(expΨ(φ, eccentricity * sinφ));                      // Snyder
(7-7)
                 } else if (a <= (PI/2 + ANGULAR_TOLERANCE)) {
                     y = copySign(POSITIVE_INFINITY, φ);
                 } else {
@@ -401,7 +401,7 @@ public class Mercator extends ConformalProjection {
                     final double a = abs(φ);
                     final double y;
                     if (a < PI/2) {
-                        y = log(expOfNorthing(φ, eccentricity * sin(φ)));
+                        y = log(expΨ(φ, eccentricity * sin(φ)));
                     } else if (a <= (PI/2 + ANGULAR_TOLERANCE)) {
                         y = copySign(POSITIVE_INFINITY, φ);
                     } else {
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
index 3131561..e4fb52a 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/ObliqueMercator.java
@@ -172,7 +172,7 @@ public class ObliqueMercator extends ConformalProjection {
         final double D   = Br / (cosφ * sqrt(rν2));
         final double sD1 = sqrt(Math.max(D*D - 1, 0));
         final double F   = D + copySign(sD1, φc);
-        H = F * pow(expOfNorthing(φc, eccentricity*sinφ), -B);                        
 // expOfNorthing(…) = 1/t
+        H = F * pow(expΨ(φc, eccentricity*sinφ), -B);                                
  // expΨ(…) = 1/t
         /*
          * Next coefficients depend on whether the user specified azimuth or two points.
          * Only the azimuth case is described in EPSG guidance notes.
@@ -214,8 +214,8 @@ public class ObliqueMercator extends ConformalProjection {
             final double φ2 = toRadians(initializer.getAndStore(ObliqueMercatorTwoPoints.LAT_OF_2ND_POINT));
             final double λ1 = toRadians(initializer.getAndStore(ObliqueMercatorTwoPoints.LONG_OF_1ST_POINT));
                   double λ2 = toRadians(initializer.getAndStore(ObliqueMercatorTwoPoints.LONG_OF_2ND_POINT));
-            final double H1 = pow(expOfNorthing(φ1, sin(eccentricity*φ1)), -B);
-            final double L  = pow(expOfNorthing(φ2, sin(eccentricity*φ2)), -B);
+            final double H1 = pow(expΨ(φ1, sin(eccentricity*φ1)), -B);
+            final double L  = pow(expΨ(φ2, sin(eccentricity*φ2)), -B);
             final double E2 = H * H;
             final double LH = L * H1;
             final double J  = (E2 - LH) / (E2 + LH);
@@ -315,7 +315,7 @@ public class ObliqueMercator extends ConformalProjection {
          * From EPSG guidance notes:
          *
          *      t  =  tan(π/4 – φ/2) / [(1 – ℯ⋅sinφ) / (1 + ℯ⋅sinφ)]^(ℯ/2)
-         *      Q  =  H / t^B                                                   — note:
t = 1/expOfNorthing
+         *      Q  =  H / t^B                                                   — note:
t = 1/expΨ
          *      S  =  (Q – 1/Q) / 2
          *      T  =  (Q + 1/Q) / 2
          *      V  =  sin(B⋅(λ – λ₀))
@@ -329,7 +329,7 @@ public class ObliqueMercator extends ConformalProjection {
          *      y  =  u/A
          */
         final double sinφ  = sin(φ);
-        final double Q     = H * pow(expOfNorthing(φ, eccentricity*sinφ), B);
+        final double Q     = H * pow(expΨ(φ, eccentricity*sinφ), B);
         final double iQ    = 1 / Q;
         final double S     = (Q - iQ) * 0.5;
         final double T     = (Q + iQ) * 0.5;
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
index 9b80d13..169c0c9 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/PolarStereographic.java
@@ -219,7 +219,7 @@ public class PolarStereographic extends ConformalProjection {
              *
              * In our case:
              *
-             *   tF = expOfNorthing(φ1, ℯ⋅sinφ1)
+             *   tF = expΨ(φ1, ℯ⋅sinφ1)
              *   mF = cos(φ1) / rν(sinφ1)
              *   ρ  = mF / tF
              *   k₀ = ρ⋅√[…]/2  but we do not need that value.
@@ -228,7 +228,7 @@ public class PolarStereographic extends ConformalProjection {
              */
             final double sinφ1 = sin(φ1);
             final double mF = initializer.scaleAtφ(sinφ1, cos(φ1));
-            ρ = new DoubleDouble(mF / expOfNorthing(φ1, eccentricity*sinφ1));
+            ρ = new DoubleDouble(mF / expΨ(φ1, eccentricity*sinφ1));
             ρF = (variant == C) ? new DoubleDouble(-mF) : null;
         }
         /*
@@ -303,7 +303,7 @@ public class PolarStereographic extends ConformalProjection {
          * The next step is to compute ρ = 2⋅a⋅k₀⋅t / …, but those steps are
          * applied by the denormalization matrix and shall not be done here.
          */
-        final double t = expOfNorthing(φ, eccentricity*sinφ);
+        final double t = expΨ(φ, eccentricity*sinφ);
         final double x = t * sinθ;
         final double y = t * cosθ;
         if (dstPts != null) {
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
index 651a031..96a770d 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/ConformalProjectionTest.java
@@ -88,7 +88,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
     }
 
     /**
-     * Tests the {@link ConformalProjection#expOfNorthing(double, double)} function.
+     * Tests the {@link ConformalProjection#expΨ(double, double)} function.
      *
      * {@preformat text
      *   Forward:  y = -log(t(φ))
@@ -103,7 +103,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
     }
 
     /**
-     * Tests {@link ConformalProjection#expOfNorthing(double, double)} on some known values.
+     * Tests {@link ConformalProjection#expΨ(double, double)} on some known values.
      *
      * @param  ellipsoidal  {@code true} for an ellipsoidal case, or {@code false} for a
spherical case.
      */
@@ -111,13 +111,13 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
         transform = new NoOp(ellipsoidal);
         tolerance = TOLERANCE;
 
-        assertEquals("f(NaN) = NaN",       NaN, expOfNorthing(NaN),               tolerance);
-        assertEquals("f( ±∞) = NaN",       NaN, expOfNorthing(NEGATIVE_INFINITY), tolerance);
-        assertEquals("f( ±∞) = NaN",       NaN, expOfNorthing(POSITIVE_INFINITY), tolerance);
-        assertEquals("f(  0°) = 1",          1, expOfNorthing(0),                 tolerance);
-        assertEquals("f(-90°) = 0",          0, expOfNorthing(-PI/2),             tolerance);
-        assertTrue  ("f(< -90°) < 0",           expOfNorthing(-PI/2 - 0.1)       
< 0);
-        assertTrue  ("f(< -90°) < 0",           expOfNorthing(nextDown(-PI/2))   
< 0);
+        assertEquals("f(NaN) = NaN",       NaN, expΨ(NaN),               tolerance);
+        assertEquals("f( ±∞) = NaN",       NaN, expΨ(NEGATIVE_INFINITY), tolerance);
+        assertEquals("f( ±∞) = NaN",       NaN, expΨ(POSITIVE_INFINITY), tolerance);
+        assertEquals("f(  0°) = 1",          1, expΨ(0),                 tolerance);
+        assertEquals("f(-90°) = 0",          0, expΨ(-PI/2),             tolerance);
+        assertTrue  ("f(< -90°) < 0",           expΨ(-PI/2 - 0.1)        < 0);
+        assertTrue  ("f(< -90°) < 0",           expΨ(nextDown(-PI/2))    < 0);
         /*
          * Values around π/2 are a special case. Theoretically the result should be positive
infinity.
          * But since we do not have an exact representatation of π/2, we instead get a high
number.
@@ -129,31 +129,31 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
          *      π/2           =   1.570796326794896619…
          *      nextUp(PI/2)  =   1.570796326794896780…
          */
-        assertTrue("f(+90°) → ∞",   expOfNorthing(+PI/2) > exp(LN_INFINITY));
-        assertTrue("f(> +90°) < 0", expOfNorthing(+PI/2 + 0.1) < 0);
-        assertTrue("f(> +90°) < 0", expOfNorthing(nextUp(nextUp(+PI/2))) < 0);
+        assertTrue("f(+90°) → ∞",   expΨ(+PI/2) > exp(LN_INFINITY));
+        assertTrue("f(> +90°) < 0", expΨ(+PI/2 + 0.1) < 0);
+        assertTrue("f(> +90°) < 0", expΨ(nextUp(nextUp(+PI/2))) < 0);
         /*
-         * Test function periodicity. This is not a strong requirement for the expOfNorthing(…)
function,
+         * Test function periodicity. This is not a strong requirement for the expΨ(…)
function,
          * but we nevertheless try to ensure that the method behaves correctly with unexpected
values.
          */
-        assertEquals("f(+360°)",  1, expOfNorthing(+2*PI),   tolerance);
-        assertEquals("f(+270°)",  0, expOfNorthing(+PI*3/2), tolerance);
-        assertEquals("f(+180°)", -1, expOfNorthing(+PI),     tolerance);
-        assertEquals("f(-180°)", -1, expOfNorthing(-PI),     tolerance);
-        assertTrue  ("f(-270°) → ∞", expOfNorthing(-PI*3/2)  < exp(-LN_INFINITY));
-        assertEquals("f(-360°)",  1, expOfNorthing(-2*PI),   tolerance);
-        assertEquals("f(-450°)",  0, expOfNorthing(-PI*5/2), tolerance);
+        assertEquals("f(+360°)",  1, expΨ(+2*PI),   tolerance);
+        assertEquals("f(+270°)",  0, expΨ(+PI*3/2), tolerance);
+        assertEquals("f(+180°)", -1, expΨ(+PI),     tolerance);
+        assertEquals("f(-180°)", -1, expΨ(-PI),     tolerance);
+        assertTrue  ("f(-270°) → ∞", expΨ(-PI*3/2)  < exp(-LN_INFINITY));
+        assertEquals("f(-360°)",  1, expΨ(-2*PI),   tolerance);
+        assertEquals("f(-450°)",  0, expΨ(-PI*5/2), tolerance);
         /*
          * Use in a way close to (but not identical)
          * to the way the Mercator projection need it.
          */
-        assertEquals("Mercator(0°)",   0,                 log(expOfNorthing(0)),     tolerance);
-        assertEquals("Mercator(90°S)", NEGATIVE_INFINITY, log(expOfNorthing(-PI/2)), tolerance);
-        assertTrue  ("Mercator(90°N)", LN_INFINITY <      log(expOfNorthing(+PI/2)));
+        assertEquals("Mercator(0°)",   0,                 log(expΨ(0)),     tolerance);
+        assertEquals("Mercator(90°S)", NEGATIVE_INFINITY, log(expΨ(-PI/2)), tolerance);
+        assertTrue  ("Mercator(90°N)", LN_INFINITY <      log(expΨ(+PI/2)));
     }
 
     /**
-     * Computes {@link ConformalProjection#expOfNorthing(double, double)} for the given latitude.
+     * Computes {@link ConformalProjection#expΨ(double, double)} for the given latitude.
      * The {@link #transform} field must have been set before this method is invoked.
      *
      * @param  φ  the latitude in radians.
@@ -161,9 +161,9 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
      *
      * @see #φ(double)
      */
-    private double expOfNorthing(final double φ) {
+    private double expΨ(final double φ) {
         final ConformalProjection projection = (ConformalProjection) transform;
-        return projection.expOfNorthing(φ, projection.eccentricity * sin(φ));
+        return projection.expΨ(φ, projection.eccentricity * sin(φ));
     }
 
     /**
@@ -187,7 +187,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
         final NoOp projection = new NoOp(ellipsoidal);
         transform = new AbstractMathTransform1D() {
             @Override public double transform(final double φ) {
-                return projection.expOfNorthing(φ, projection.eccentricity * sin(φ));
+                return projection.expΨ(φ, projection.eccentricity * sin(φ));
             }
             @Override public double derivative(final double φ) {
                 final double sinφ = sin(φ);
@@ -207,19 +207,19 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
      * Computes {@link ConformalProjection#φ(double)}.
      * The {@link #transform} field must have been set before this method is invoked.
      *
-     * @param  expOfSouthing  the reciprocal of the value returned by {@link #expOfNorthing(double)}.
+     * @param  rexpΨ  the reciprocal of the value returned by {@link #expΨ(double)}.
      * @return the latitude in radians.
      * @throws ProjectionException if the iteration does not converge.
      *
-     * @see #expOfNorthing(double)
+     * @see #expΨ(double)
      */
-    private double φ(final double expOfSouthing) throws ProjectionException {
-        return ((ConformalProjection) transform).φ(expOfSouthing);
+    private double φ(final double rexpΨ) throws ProjectionException {
+        return ((ConformalProjection) transform).φ(rexpΨ);
     }
 
     /**
      * Tests the {@link ConformalProjection#φ(double)} function. We expect it to be
-     * the converse of the {@link ConformalProjection#expOfNorthing(double, double)} function.
+     * the converse of the {@link ConformalProjection#expΨ(double, double)} function.
      * In theory only the [-90° … +90°] range needs to be tested. However the function
is still
      * consistent in the [-90° … +270°] range so we test that range for tracking this
fact.
      *
@@ -233,7 +233,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
     }
 
     /**
-     * Tests {@link ConformalProjection#φ(double)} on known values and as the reverse of
{@code expOfNorthing(φ)}.
+     * Tests {@link ConformalProjection#φ(double)} on known values and as the reverse of
{@code expΨ(φ)}.
      */
     private void test_φ(final boolean ellipsoidal) throws ProjectionException {
         transform = new NoOp(ellipsoidal);
@@ -254,7 +254,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
          */
         for (int i=-90; i<=270; i+=5) {
             final double φ   = toRadians(i);
-            final double t    = 1 / expOfNorthing(φ);
+            final double t    = 1 / expΨ(φ);
             final double back = toDegrees(φ(t));
             if (i <= 90) {
                 assertTrue("φ(t) in valid range should be positive.", t >= 0);
@@ -288,7 +288,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
         final int numSamples = 2000;
         for (int i=0; i<numSamples; i++) {
             final double φ = random.nextDouble() * PI - PI/2;
-            final double t = 1 / comparator.expOfNorthing(φ);
+            final double t = 1 / comparator.expΨ(φ);
             final double byIterativeMethod = comparator.byIterativeMethod(t);
             final double bySeriesExpansion = comparator.bySeriesExpansion(t);
             final double byImplementation  = projection.φ(t);
@@ -300,7 +300,7 @@ public final strictfp class ConformalProjectionTest extends TransformTestCase
{
              * than the original formulas. The main purpose of this test is to detect mistake
during
              * the application of identities.
              */
-            assertEquals(byImplementation, bySeriesExpansion, 1E-15);  // Tolerance threshold
close to 1 ULP of 2π.
+            assertEquals(byImplementation, bySeriesExpansion, 1E-15);       // Tolerance
threshold close to 1 ULP of 2π.
         }
     }
 }
diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
index 342fab2..0bd2b31 100644
--- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
+++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/projection/MercatorMethodComparison.java
@@ -106,7 +106,7 @@ public final class MercatorMethodComparison {   // No 'strictfp' keyword
here si
      * Computes φ using the series expansion given by Geomatics Guidance Note number 7,
part 2.
      * This is the first part of the {@link ConformalProjection#φ(double)} method.
      *
-     * @param  t  the {@code expOfSouthing} parameter value.
+     * @param  t  the {@code rexpΨ} parameter value.
      * @return the latitude (in radians) for the given parameter.
      */
     public double bySeriesExpansion(final double t) {
@@ -121,7 +121,7 @@ public final class MercatorMethodComparison {   // No 'strictfp' keyword
here si
      * Computes φ using the iterative method used by USGS.
      * This is the second part of the {@link ConformalProjection#φ(double)} method.
      *
-     * @param  t  the {@code expOfSouthing} parameter value.
+     * @param  t  the {@code rexpΨ} parameter value.
      * @return the latitude (in radians) for the given parameter.
      * @throws ProjectionException if the iteration does not converge.
      */
@@ -142,9 +142,9 @@ public final class MercatorMethodComparison {   // No 'strictfp' keyword
here si
     }
 
     /**
-     * Basically a copy of {@link ConformalProjection#expOfNorthing(double, double)}.
+     * Basically a copy of {@link ConformalProjection#expΨ(double, double)}.
      */
-    final double expOfNorthing(final double φ) {
+    final double expΨ(final double φ) {
         final double ℯsinφ = eccentricity * sin(φ);
         return tan(PI/4 + 0.5*φ) * pow((1 - ℯsinφ) / (1 + ℯsinφ), 0.5*eccentricity);
     }
@@ -172,7 +172,7 @@ public final class MercatorMethodComparison {   // No 'strictfp' keyword
here si
         final Random random = new Random();
         for (int i=0; i<numSamples; i++) {
             final double φ = random.nextDouble() * PI - PI/2;
-            final double t = 1 / expOfNorthing(φ);
+            final double t = 1 / expΨ(φ);
             final double byIterativeMethod = byIterativeMethod(t);
             final double bySeriesExpansion = bySeriesExpansion(t);
             final double byImplementation  = implementation.φ(t);


Mime
View raw message