You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sis.apache.org by de...@apache.org on 2015/07/16 15:01:36 UTC
svn commit: r1691392 -
/sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
Author: desruisseaux
Date: Thu Jul 16 13:01:36 2015
New Revision: 1691392
URL: http://svn.apache.org/r1691392
Log:
Do not project the coordinates if not needed.
Modified:
sis/branches/JDK8/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/projection/Mercator.java
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=1691392&r1=1691391&r2=1691392&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] Thu Jul 16 13:01:36 2015
@@ -331,25 +331,25 @@ public class Mercator extends AbstractLa
final double λ = srcPts[srcOff];
final double φ = srcPts[srcOff + 1];
final double sinφ = sin(φ);
- /*
- * Projection of zero is zero. However the formulas below have a slight rounding error
- * which produce values close to 1E-10, so we will avoid them when y=0. In addition of
- * avoiding rounding error, this also preserve the sign (positive vs negative zero).
- */
- final double y;
- if (φ == 0) {
- y = φ;
- } else {
- // See the javadoc of the Spherical inner class for a note
- // about why we perform explicit checks for the pole cases.
- final double a = abs(φ);
- if (a < PI/2) {
- y = log(expOfNorthing(φ, excentricity * sinφ)); // Snyder (7-7)
+ if (dstPts != null) {
+ /*
+ * Projection of zero is zero. However the formulas below have a slight rounding error
+ * which produce values close to 1E-10, so we will avoid them when y=0. In addition of
+ * avoiding rounding error, this also preserve the sign (positive vs negative zero).
+ */
+ final double y;
+ if (φ == 0) {
+ y = φ;
} else {
- y = copySign(a <= (PI/2 + ANGULAR_TOLERANCE) ? POSITIVE_INFINITY : NaN, φ);
+ // See the javadoc of the Spherical inner class for a note
+ // about why we perform explicit checks for the pole cases.
+ final double a = abs(φ);
+ if (a < PI/2) {
+ y = log(expOfNorthing(φ, excentricity * sinφ)); // Snyder (7-7)
+ } else {
+ y = copySign(a <= (PI/2 + ANGULAR_TOLERANCE) ? POSITIVE_INFINITY : NaN, φ);
+ }
}
- }
- if (dstPts != null) {
dstPts[dstOff] = λ;
dstPts[dstOff+1] = y;
}