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 2022/01/28 21:24:35 UTC
[sis] 02/02: Add an `isIdentity()` method and comment.
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 2d89bb02e63736b815edeb75a221bc5de87dfc8d
Author: Martin Desruisseaux <ma...@geomatys.com>
AuthorDate: Fri Jan 28 22:23:56 2022 +0100
Add an `isIdentity()` method and comment.
---
.../sis/referencing/operation/transform/RotatedPole.java | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java
index fb826dd..88bec33 100644
--- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java
+++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/RotatedPole.java
@@ -118,6 +118,8 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable
/**
* Creates the inverse of the given forward operation.
+ * The new pole latitude is φ<sub>p</sub> = (180° − φ<sub>forward</sub>).
+ * We get this effect be inverting the sign of {@link #cosφp} while keeping {@link #sinφp} unchanged.
*
* @see #inverse()
*/
@@ -150,7 +152,7 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable
i = 3 - i;
}
double value = -((Number) ((ParameterValue<?>) values.get(i)).getValue()).doubleValue();
- if (i == 0) value = Math.IEEEremainder(value + 180, 360);
+ if (i == 0) value = IEEEremainder(value + 180, 360);
target.setValue(value);
return true;
}
@@ -329,6 +331,16 @@ public class RotatedPole extends AbstractMathTransform2D implements Serializable
}
/**
+ * Tests whether this transform does not move any points.
+ *
+ * @return {@code true} if this transform is (at least approximately) the identity transform.
+ */
+ @Override
+ public boolean isIdentity() {
+ return abs(cosφp) == 1;
+ }
+
+ /**
* Compares the specified object with this math transform for equality.
*
* @param object the object to compare with this transform.