sis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From desruisse...@apache.org
Subject svn commit: r1693832 - in /sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection: Initializer.java LambertConicConformal.java Mercator.java NormalizedProjection.java
Date Sun, 02 Aug 2015 21:59:36 GMT
Author: desruisseaux
Date: Sun Aug  2 21:59:35 2015
New Revision: 1693832

URL: http://svn.apache.org/r1693832
Log:
Minor documentation (no code change).

Modified:
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
    sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java?rev=1693832&r1=1693831&r2=1693832&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Initializer.java
[UTF-8] Sun Aug  2 21:59:35 2015
@@ -37,13 +37,22 @@ import static org.apache.sis.internal.ut
  * Helper class for map projection constructions, providing formulas normally needed only
at construction time.
  * Since map projection constructions should not happen very often, we afford using some
double-double arithmetic.
  * The main intend is not to provide more accurate coordinate conversions (while it may be
a nice side-effect),
- * but to improve the result of concatenations of (de)normalization matrices with the matrices
of other transforms,
- * as found in transformation chains.
+ * but to improve the result of matrix multiplications when the map projection is part of
a more complex chain
+ * of transformations. More specifically we want to be able:
+ *
+ * <ul>
+ *   <li>To convert degrees to radians, than back to degrees and find the original
value.</li>
+ *   <li>To convert axis length (optionally with flattening factor) to excentricity,
then back
+ *       to axis length and find the original value.</li>
+ * </ul>
+ *
+ * This has visible effects on WKT formatting among others, but also in our capability to
detect simplification
+ * opportunities in relatively complex chains of transformations.
  *
  * <p>As a general rule, we stop storing result with double-double precision after
the point where we need
  * transcendental functions (sine, logarithm, <i>etc.</i>), since we do not have
double-double versions of
  * those functions. Digits after the {@code double} part are usually not significant in such
cases, except
- * in some relatively rare scenarios like 1 ± (a result much smaller than 1).</p>
+ * in some relatively rare scenarios like 1 ± x where <var>x</var> is much smaller
than 1.</p>
  *
  * @author  Martin Desruisseaux (Geomatys)
  * @since   0.6
@@ -142,6 +151,12 @@ final class Initializer {
                  */
                 isIvfDefinitive = false;
             }
+            /*
+             * The ellipsoid parameters (a, b or ivf) are assumed accurate in base 10 rather
than in base 2,
+             * because they are defined by authorities. For example the semi-major axis length
of the WGS84
+             * ellipsoid is equal to exactly 6378137 metres by definition of that ellipsoid.
The DoubleDouble
+             * constructor applies corrections for making those values more accurate in base
10 rather than 2.
+             */
             if (isIvfDefinitive) {
                 final DoubleDouble f = new DoubleDouble(parameters.parameter(Constants.INVERSE_FLATTENING).doubleValue());
                 f.inverseDivide(1,0);
@@ -178,11 +193,20 @@ final class Initializer {
                 k.inverseDivide(b, 0);
             }
         }
-        context.normalizeGeographicInputs(λ0);
+        /*
+         * Scale factor is assumed more accurate in base 10 than in base 2 for the same reason
than for the
+         * ellipsoid parameters (i.e. is a value given by authority as part of map projection
definition).
+         * Again, DoubleDouble constructor will take care of computing a correction.
+         */
         final ParameterDescriptor<? extends Number> scaleFactor = roles.get(ParameterRole.SCALE_FACTOR);
         if (scaleFactor != null) {
             k.multiply(getAndStore(scaleFactor));
         }
+        /*
+         * Set meridian rotation, scale factor, false easting and false northing parameter
values
+         * in the (de)normalization matrices.
+         */
+        context.normalizeGeographicInputs(λ0);
         final MatrixSIS denormalize = context.getMatrix(false);
         denormalize.convertAfter(0, k, new DoubleDouble(fe));
         denormalize.convertAfter(1, k, new DoubleDouble(fn));

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java?rev=1693832&r1=1693831&r2=1693832&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/LambertConicConformal.java
[UTF-8] Sun Aug  2 21:59:35 2015
@@ -269,7 +269,7 @@ public class LambertConicConformal exten
         final double t1 = expOfNorthing(φ1, excentricity*sinφ1);
         /*
          * Compute n = (ln m₁ – ln m₂) / (ln t₁ – ln t₂), which we rewrite as
ln(m₁/m₂) / ln(t₁/t₂)
-         * since division is less at risk of precision lost than subtraction. Note that this
equation
+         * for reducing the amount of calls to the logarithmic function. Note that this equation
          * tends toward 0/0 if φ₁ ≈ φ₂, which force us to do a special check for
the SP1 case.
          */
         if (abs(φ1 - φ2) >= ANGULAR_TOLERANCE) {  // Should be 'true' for 2SP case.

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java?rev=1693832&r1=1693831&r2=1693832&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
[UTF-8] Sun Aug  2 21:59:35 2015
@@ -246,6 +246,11 @@ public class Mercator extends ConformalP
         denormalize.convertBefore(0, k0, null);
         denormalize.convertBefore(1, k0, null);
         if (λ0 != 0) {
+            /*
+             * Use double-double arithmetic here for consistency with the work done in the
normalization matrix.
+             * The intend is to have exact value at 'double' precision when computing Matrix.invert().
Note that
+             * there is no such goal for other parameters computed from sine or consine functions.
+             */
             final DoubleDouble offset = DoubleDouble.createDegreesToRadians();
             offset.multiply(-λ0);
             denormalize.convertBefore(0, null, offset);

Modified: sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
URL: http://svn.apache.org/viewvc/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java?rev=1693832&r1=1693831&r2=1693832&view=diff
==============================================================================
--- sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] (original)
+++ sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/NormalizedProjection.java
[UTF-8] Sun Aug  2 21:59:35 2015
@@ -410,7 +410,7 @@ public abstract class NormalizedProjecti
     NormalizedProjection(final Initializer initializer) {
         context             = initializer.context;
         excentricitySquared = initializer.excentricitySquared.value;
-        excentricity        = sqrt(excentricitySquared);
+        excentricity        = sqrt(excentricitySquared);  // DoubleDouble.sqrt() does not
make any difference here.
         inverse             = new Inverse();
     }
 



Mime
View raw message