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
The following commit(s) were added to refs/heads/geoapi-4.0 by this push: new c541c4e Clarify the meaning of axis rotation (the last rotation in "Pole rotation" operation method). c541c4e is described below commit c541c4ec683e49292c22d0104cbf0cc1b994aaeb Author: Martin Desruisseaux <martin.desruisse...@geomatys.com> AuthorDate: Mon Jan 31 17:31:02 2022 +0100 Clarify the meaning of axis rotation (the last rotation in "Pole rotation" operation method). --- .../sis/referencing/operation/transform/PoleRotation.java | 14 ++++++++------ .../referencing/operation/transform/PoleRotationTest.java | 12 ++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java index 36309fd..d147032 100644 --- a/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java +++ b/core/sis-referencing/src/main/java/org/apache/sis/referencing/operation/transform/PoleRotation.java @@ -55,8 +55,8 @@ import static org.apache.sis.internal.referencing.Formulas.fastHypot; * <ol> * <li><b>φ<sub>p</sub>:</b> geographic latitude in degrees of the southern pole of the coordinate system.</li> * <li><b>λ<sub>p</sub>:</b> geographic longitude in degrees of the southern pole of the coordinate system.</li> - * <li>Angle of rotation in degrees about the new polar axis measured clockwise when looking from the southern - * to the northern pole.</li> + * <li>Angle of rotation in degrees about the new polar axis measured clockwise when looking from the rotated + * pole to the Earth center.</li> * </ol> * * The rotations are applied by first rotating the sphere through λ<sub>p</sub> about the geographic polar axis, @@ -154,9 +154,11 @@ public class PoleRotation extends AbstractMathTransform2D implements Serializabl */ i = 3 - i; } - double value = -((Number) ((ParameterValue<?>) values.get(i)).getValue()).doubleValue(); + double value = ((Number) ((ParameterValue<?>) values.get(i)).getValue()).doubleValue(); if (i == 0) { - value = IEEEremainder(value + 180, 360); + value = IEEEremainder(180 - value, 360); + } else if (SouthPoleRotation.PARAMETERS.equals(forward.getDescriptor())) { + value = -value; } target.setValue(value); return true; @@ -174,7 +176,7 @@ public class PoleRotation extends AbstractMathTransform2D implements Serializabl * @param φp geographic latitude in degrees of the southern pole of the coordinate system. * @param λp geographic longitude in degrees of the southern pole of the coordinate system. * @param pa angle of rotation in degrees about the new polar axis measured clockwise when - * looking from the southern to the northern pole. + * looking from the rotated pole to the Earth center. */ protected PoleRotation(final boolean south, final double φp, final double λp, final double pa) { context = new ContextualParameters( @@ -188,7 +190,7 @@ public class PoleRotation extends AbstractMathTransform2D implements Serializabl sinφp = sin(φ) * sign; cosφp = cos(φ) * sign; context.normalizeGeographicInputs(λp); - context.denormalizeGeographicOutputs(-pa); + context.denormalizeGeographicOutputs(south ? -pa : pa); } /** diff --git a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java index b629c03..62f1894 100644 --- a/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java +++ b/core/sis-referencing/src/test/java/org/apache/sis/referencing/operation/transform/PoleRotationTest.java @@ -194,7 +194,7 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase { * * {@preformat shell * cs2cs -I -E -f %g "EPSG:4326" +to +type=crs +proj=ob_tran +o_proj=longlat +datum=WGS84 +no_defs \ - * +o_lat_p=70 +o_lon_p=40 +lon_0=0 coords.txt + * +o_lat_p=70 +o_lon_p=40 +lon_0=10 coords.txt * } * * @throws FactoryException if the transform can not be created. @@ -203,16 +203,16 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase { @Test @DependsOnMethod("testRotateNorthPoleOnGreenwich") public void testRotateNorthPole() throws FactoryException, TransformException { - transform = PoleRotation.rotateNorthPole(factory(), 70, 40, 0); + transform = PoleRotation.rotateNorthPole(factory(), 70, 40, 10); final double[] coordinates = { // (λ,φ) coordinates to convert. 0, 54, 20, 62, -30, 89 }; final double[] expected = { // (λ,φ) coordinates after conversion. - -68.817428350, 66.096411904, - -54.967324181, 78.691210976, - -177.208632734, 70.320491507 + -58.817428350, 66.096411904, + -44.967324181, 78.691210976, + -167.208632734, 70.320491507 }; verifyTransform(coordinates, expected); inverseNorthPoleTransform(); @@ -227,7 +227,7 @@ public final strictfp class PoleRotationTest extends MathTransformTestCase { */ @Test public void testRotateNorthToOppositeHemisphere() throws FactoryException, TransformException { - transform = PoleRotation.rotateNorthPole(factory(), -50, 20, 10); + transform = PoleRotation.rotateNorthPole(factory(), -50, 20, -10); final double[] coordinates = { // (λ,φ) coordinates to convert. 20, -51, 80, -44,