This is an automated email from the ASF dual-hosted git repository. erans pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-geometry.git
commit ca026e7a11f1260dea3e29e6b05c904bf133e77e Author: Gilles Sadowski <[email protected]> AuthorDate: Wed Nov 27 14:48:30 2019 +0100 Zero is zero, whatever the scale. --- .../apache/commons/geometry/core/GeometryTest.java | 6 +-- .../threed/rotation/QuaternionRotation.java | 6 +-- .../euclidean/threed/ConvexSubPlaneTest.java | 4 +- .../geometry/euclidean/threed/SubPlaneTest.java | 2 +- .../threed/rotation/QuaternionRotationTest.java | 56 +++++++++++----------- .../twod/AbstractSegmentConnectorTest.java | 4 +- .../geometry/euclidean/twod/ConvexAreaTest.java | 22 ++++----- .../twod/InteriorAngleSegmentConnectorTest.java | 2 +- .../commons/geometry/euclidean/twod/LineTest.java | 36 +++++++------- .../geometry/euclidean/twod/PolylineTest.java | 12 ++--- .../euclidean/twod/RegionBSPTree2DTest.java | 8 ++-- .../geometry/euclidean/twod/SegmentTest.java | 2 +- .../geometry/euclidean/twod/SubLineTest.java | 44 ++++++++--------- .../geometry/spherical/oned/AngularInterval.java | 2 +- .../commons/geometry/spherical/oned/Point1S.java | 2 +- .../geometry/spherical/oned/RegionBSPTree1S.java | 2 +- .../spherical/oned/AngularIntervalTest.java | 6 +-- .../geometry/spherical/oned/CutAngleTest.java | 36 +++++++------- .../geometry/spherical/oned/Point1STest.java | 14 +++--- .../spherical/oned/RegionBSPTree1STest.java | 4 +- .../geometry/spherical/twod/GreatArcTest.java | 2 +- .../geometry/spherical/twod/GreatCircleTest.java | 20 ++++---- 22 files changed, 146 insertions(+), 146 deletions(-) diff --git a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java index f1667ff..7fedb49 100644 --- a/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java +++ b/commons-geometry-core/src/test/java/org/apache/commons/geometry/core/GeometryTest.java @@ -27,7 +27,7 @@ public class GeometryTest { double eps = 0.0; // act/assert - Assert.assertEquals(0.0, Geometry.ZERO_PI, eps); + Assert.assertEquals(0.0, 0.0, eps); Assert.assertEquals(Math.PI, Geometry.PI, eps); Assert.assertEquals(-Math.PI, Geometry.MINUS_PI, eps); @@ -47,8 +47,8 @@ public class GeometryTest { double eps = 1e-15; // act/assert - Assert.assertEquals(0.0, Math.sin(Geometry.ZERO_PI), eps); - Assert.assertEquals(1.0, Math.cos(Geometry.ZERO_PI), eps); + Assert.assertEquals(0.0, Math.sin(0.0), eps); + Assert.assertEquals(1.0, Math.cos(0.0), eps); Assert.assertEquals(0.0, Math.sin(Geometry.PI), eps); Assert.assertEquals(-1.0, Math.cos(Geometry.PI), eps); diff --git a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java index 3934f8b..99dc077 100644 --- a/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java +++ b/commons-geometry-euclidean/src/main/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotation.java @@ -408,7 +408,7 @@ public final class QuaternionRotation implements Rotation3D { return new double[] { Math.atan2(angle1TanY, angle1TanX), angle2, - Geometry.ZERO_PI + 0.0 }; } @@ -469,12 +469,12 @@ public final class QuaternionRotation implements Rotation3D { final double angle1TanY = vec2.dot(crossAxis); final double angle1TanX = vec2.dot(axis2); - final double angle2 = angle2Cos > AXIS_ANGLE_SINGULARITY_THRESHOLD ? Geometry.ZERO_PI : Geometry.PI; + final double angle2 = angle2Cos > AXIS_ANGLE_SINGULARITY_THRESHOLD ? 0.0 : Geometry.PI; return new double[] { Math.atan2(angle1TanY, angle1TanX), angle2, - Geometry.ZERO_PI + 0.0 }; } diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java index bfad866..d8fa7cd 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/ConvexSubPlaneTest.java @@ -222,7 +222,7 @@ public class ConvexSubPlaneTest { Plane plane = Plane.fromNormal(Vector3D.Unit.PLUS_Z, TEST_PRECISION); ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds( Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION), - Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.ZERO_PI, TEST_PRECISION) + Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION) )); // act @@ -238,7 +238,7 @@ public class ConvexSubPlaneTest { Plane plane = Plane.fromPointAndPlaneVectors(Vector3D.of(0, 0, 1), Vector3D.Unit.PLUS_X, Vector3D.Unit.PLUS_Y, TEST_PRECISION); ConvexSubPlane sp = ConvexSubPlane.fromConvexArea(plane, ConvexArea.fromBounds( Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION), - Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.ZERO_PI, TEST_PRECISION), + Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION) )); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java index b0ff93e..0994af9 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/SubPlaneTest.java @@ -159,7 +159,7 @@ public class SubPlaneTest { // arrange SubPlane sp = new SubPlane(XY_PLANE, false); sp.getSubspaceRegion().getRoot().cut( - Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); Plane splitter = Plane.fromNormal(Vector3D.Unit.PLUS_X, TEST_PRECISION); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java index 5d25bde..8a86425 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/threed/rotation/QuaternionRotationTest.java @@ -172,8 +172,8 @@ public class QuaternionRotationTest { @Test public void testGetAngle() { // act/assert - Assert.assertEquals(Geometry.ZERO_PI, QuaternionRotation.of(1, 0, 0, 0).getAngle(), EPS); - Assert.assertEquals(Geometry.ZERO_PI, QuaternionRotation.of(-1, 0, 0, 0).getAngle(), EPS); + Assert.assertEquals(0.0, QuaternionRotation.of(1, 0, 0, 0).getAngle(), EPS); + Assert.assertEquals(0.0, QuaternionRotation.of(-1, 0, 0, 0).getAngle(), EPS); Assert.assertEquals(Geometry.HALF_PI, QuaternionRotation.of(1, 0, 0, 1).getAngle(), EPS); Assert.assertEquals(Geometry.HALF_PI, QuaternionRotation.of(-1, 0, 0, -1).getAngle(), EPS); @@ -194,7 +194,7 @@ public class QuaternionRotationTest { // assert // make sure that we're in the [0, pi] range - Assert.assertTrue(angle >= Geometry.ZERO_PI); + Assert.assertTrue(angle >= 0.0); Assert.assertTrue(angle <= Geometry.PI); double expected = PlaneAngleRadians.normalizeBetweenMinusPiAndPi(theta); @@ -212,7 +212,7 @@ public class QuaternionRotationTest { // act/assert // --- x axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.ZERO_PI)); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0)); assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.HALF_PI)); assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.MINUS_HALF_PI)); @@ -224,7 +224,7 @@ public class QuaternionRotationTest { assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI)); // --- y axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.ZERO_PI)); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0)); assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.HALF_PI)); assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.MINUS_HALF_PI)); @@ -236,7 +236,7 @@ public class QuaternionRotationTest { assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI)); // --- z axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.ZERO_PI)); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0)); assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.HALF_PI)); assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.MINUS_HALF_PI)); @@ -311,7 +311,7 @@ public class QuaternionRotationTest { // act/assert // --- x axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.ZERO_PI).inverse()); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0).inverse()); assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.MINUS_HALF_PI).inverse()); assertRotationEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.HALF_PI).inverse()); @@ -323,7 +323,7 @@ public class QuaternionRotationTest { assertRotationEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI).inverse()); // --- y axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.ZERO_PI).inverse()); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0).inverse()); assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.MINUS_HALF_PI).inverse()); assertRotationEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.HALF_PI).inverse()); @@ -335,7 +335,7 @@ public class QuaternionRotationTest { assertRotationEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI).inverse()); // --- z axes - assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.ZERO_PI).inverse()); + assertRotationEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0).inverse()); assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.MINUS_HALF_PI).inverse()); assertRotationEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.HALF_PI).inverse()); @@ -548,7 +548,7 @@ public class QuaternionRotationTest { @Test public void testSlerp_simple() { // arrange - QuaternionRotation q0 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.ZERO_PI); + QuaternionRotation q0 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.0); QuaternionRotation q1 = QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.PI); final Slerp transform = q0.slerp(q1); Vector3D v = Vector3D.of(2, 0, 1); @@ -567,27 +567,27 @@ public class QuaternionRotationTest { public void testSlerp_multipleCombinations() { // arrange QuaternionRotation[] rotations = { - QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_X, Geometry.PI), - QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_X, Geometry.PI), - QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Y, Geometry.PI), - QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Y, Geometry.PI), - QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.PLUS_Z, Geometry.PI), - QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.ZERO_PI), + QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, 0.0), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.HALF_PI), QuaternionRotation.fromAxisAngle(Vector3D.Unit.MINUS_Z, Geometry.PI), }; @@ -712,7 +712,7 @@ public class QuaternionRotationTest { public void testToMatrix() { // act/assert // --- x axes - assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.ZERO_PI).toMatrix()); + assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, 0.0).toMatrix()); assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_X_DIR, Geometry.HALF_PI).toMatrix()); assertTransformEquals(StandardRotations.PLUS_X_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.MINUS_HALF_PI).toMatrix()); @@ -724,7 +724,7 @@ public class QuaternionRotationTest { assertTransformEquals(StandardRotations.X_PI, QuaternionRotation.fromAxisAngle(MINUS_X_DIR, Geometry.PI).toMatrix()); // --- y axes - assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.ZERO_PI).toMatrix()); + assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, 0.0).toMatrix()); assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Y_DIR, Geometry.HALF_PI).toMatrix()); assertTransformEquals(StandardRotations.PLUS_Y_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.MINUS_HALF_PI).toMatrix()); @@ -736,7 +736,7 @@ public class QuaternionRotationTest { assertTransformEquals(StandardRotations.Y_PI, QuaternionRotation.fromAxisAngle(MINUS_Y_DIR, Geometry.PI).toMatrix()); // --- z axes - assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.ZERO_PI).toMatrix()); + assertTransformEquals(StandardRotations.IDENTITY, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, 0.0).toMatrix()); assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(PLUS_Z_DIR, Geometry.HALF_PI).toMatrix()); assertTransformEquals(StandardRotations.PLUS_Z_HALF_PI, QuaternionRotation.fromAxisAngle(MINUS_Z_DIR, Geometry.MINUS_HALF_PI).toMatrix()); @@ -773,12 +773,12 @@ public class QuaternionRotationTest { private void checkAxisAngleSequenceToQuaternionRoundtrip(AxisReferenceFrame frame, AxisSequence axes) { double step = 0.3; - double angle2Start = axes.getType() == AxisSequenceType.EULER ? Geometry.ZERO_PI + 0.1 : Geometry.MINUS_HALF_PI + 0.1; + double angle2Start = axes.getType() == AxisSequenceType.EULER ? 0.0 + 0.1 : Geometry.MINUS_HALF_PI + 0.1; double angle2Stop = angle2Start + Geometry.PI; - for (double angle1 = Geometry.ZERO_PI; angle1 <= Geometry.TWO_PI; angle1 += step) { + for (double angle1 = 0.0; angle1 <= Geometry.TWO_PI; angle1 += step) { for (double angle2 = angle2Start; angle2 < angle2Stop; angle2 += step) { - for (double angle3 = Geometry.ZERO_PI; angle3 <= Geometry.TWO_PI; angle3 += 0.3) { + for (double angle3 = 0.0; angle3 <= Geometry.TWO_PI; angle3 += 0.3) { // arrange AxisAngleSequence angles = new AxisAngleSequence(frame, axes, angle1, angle2, angle3); @@ -822,7 +822,7 @@ public class QuaternionRotationTest { public void testAxisAngleSequenceConversion_relative_eulerSingularities() { // arrange double[] eulerSingularities = { - Geometry.ZERO_PI, + 0.0, Geometry.PI }; @@ -859,7 +859,7 @@ public class QuaternionRotationTest { public void testAxisAngleSequenceConversion_absolute_eulerSingularities() { // arrange double[] eulerSingularities = { - Geometry.ZERO_PI, + 0.0, Geometry.PI }; @@ -1097,7 +1097,7 @@ public class QuaternionRotationTest { checkQuaternion(q, 1, 0, 0, 0); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_X, q.getAxis(), EPS); - Assert.assertEquals(Geometry.ZERO_PI, q.getAngle(), EPS); + Assert.assertEquals(0.0, q.getAngle(), EPS); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), q.apply(u1), EPS); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), q.inverse().apply(u2), EPS); @@ -1116,7 +1116,7 @@ public class QuaternionRotationTest { checkQuaternion(q, 1, 0, 0, 0); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.Unit.PLUS_X, q.getAxis(), EPS); - Assert.assertEquals(Geometry.ZERO_PI, q.getAngle(), EPS); + Assert.assertEquals(0.0, q.getAngle(), EPS); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 2, 0), q.apply(u1), EPS); EuclideanTestUtils.assertCoordinatesEqual(Vector3D.of(0, 3, 0), q.inverse().apply(u2), EPS); @@ -1156,7 +1156,7 @@ public class QuaternionRotationTest { Assert.assertEquals(0.0, q.inverse().apply(u2).angle(u1), EPS); double angle = q.getAngle(); - Assert.assertTrue(angle >= Geometry.ZERO_PI); + Assert.assertTrue(angle >= 0.0); Assert.assertTrue(angle <= Geometry.PI); }); } @@ -1326,7 +1326,7 @@ public class QuaternionRotationTest { EuclideanTestUtils.assertCoordinatesEqual(u2Dir, qInv.apply(v2Dir), EPS); double angle = q.getAngle(); - Assert.assertTrue(angle >= Geometry.ZERO_PI); + Assert.assertTrue(angle >= 0.0); Assert.assertTrue(angle <= Geometry.PI); Vector3D transformedX = q.apply(Vector3D.Unit.PLUS_X); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java index 500d5f1..fbc036f 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/AbstractSegmentConnectorTest.java @@ -316,7 +316,7 @@ public class AbstractSegmentConnectorTest { // arrange Vector2D p0 = Vector2D.of(1, 0); - Segment seg0 = Line.fromPointAndAngle(p0, Geometry.ZERO_PI, TEST_PRECISION).segment(p0, p0); + Segment seg0 = Line.fromPointAndAngle(p0, 0.0, TEST_PRECISION).segment(p0, p0); Segment seg1 = Line.fromPointAndAngle(p0, Geometry.HALF_PI, TEST_PRECISION).segment(p0, p0); Segment seg2 = Line.fromPointAndAngle(p0, Geometry.PI, TEST_PRECISION).segment(p0, p0); Segment seg3 = Line.fromPointAndAngle(p0, Geometry.MINUS_HALF_PI, TEST_PRECISION).segment(p0, p0); @@ -343,7 +343,7 @@ public class AbstractSegmentConnectorTest { Vector2D p0 = Vector2D.ZERO; Vector2D p1 = Vector2D.of(1, 0); - Segment seg0 = Line.fromPointAndAngle(p1, Geometry.ZERO_PI, TEST_PRECISION).segment(p1, p1); + Segment seg0 = Line.fromPointAndAngle(p1, 0.0, TEST_PRECISION).segment(p1, p1); Segment seg1 = Line.fromPointAndAngle(p1, 0.25 * Geometry.PI, TEST_PRECISION).segment(p1, p1); Segment seg2 = Line.fromPointAndAngle(p0, 0, TEST_PRECISION).segment(p0, p0); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java index b6666ab..b4bd85c 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/ConvexAreaTest.java @@ -58,7 +58,7 @@ public class ConvexAreaTest { public void testToTree() { // arrange ConvexArea area = ConvexArea.fromBounds( - Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION), + Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(1, 1), Geometry.PI, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.MINUS_HALF_PI, TEST_PRECISION) @@ -217,7 +217,7 @@ public class ConvexAreaTest { // arrange ConvexArea area = ConvexArea.fromBounds( Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION), - Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.ZERO_PI, TEST_PRECISION) + Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION) ); // act/assert @@ -229,7 +229,7 @@ public class ConvexAreaTest { // arrange ConvexArea area = ConvexArea.fromBounds( Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION), - Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.ZERO_PI, TEST_PRECISION), + Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION) ); @@ -321,7 +321,7 @@ public class ConvexAreaTest { @Test public void testTrim_halfSpace() { // arrange - ConvexArea area = ConvexArea.fromBounds(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + ConvexArea area = ConvexArea.fromBounds(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); Segment segment = Line.fromPoints(Vector2D.Unit.MINUS_Y, Vector2D.Unit.PLUS_Y, TEST_PRECISION).span(); // act @@ -377,7 +377,7 @@ public class ConvexAreaTest { // arrange ConvexArea input = ConvexArea.full(); - Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); // act Split<ConvexArea> split = input.split(splitter); @@ -1141,9 +1141,9 @@ public class ConvexAreaTest { @Test public void testFromBounds_duplicateLines_similarOrientation() { // arrange - Line a = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); - Line b = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); - Line c = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line a = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); + Line b = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); + Line c = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act ConvexArea area = ConvexArea.fromBounds(a, b, c); @@ -1167,9 +1167,9 @@ public class ConvexAreaTest { @Test public void testFromBounds_duplicateLines_differentOrientation() { // arrange - Line a = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line a = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Line b = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.PI, TEST_PRECISION); - Line c = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line c = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act/assert GeometryTestUtils.assertThrows(() -> { @@ -1182,7 +1182,7 @@ public class ConvexAreaTest { // act/assert GeometryTestUtils.assertThrows(() -> { ConvexArea.fromBounds(Arrays.asList( - Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION), + Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.PI, TEST_PRECISION), Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION) )); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java index 1a18650..cebf1ad 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/InteriorAngleSegmentConnectorTest.java @@ -117,7 +117,7 @@ public class InteriorAngleSegmentConnectorTest { segments.addAll(createSquare(Vector2D.ZERO, 1, 1)); Vector2D pt = Vector2D.of(0, 2); - Segment a = Line.fromPointAndAngle(pt, Geometry.ZERO_PI, TEST_PRECISION).segmentTo(pt); + Segment a = Line.fromPointAndAngle(pt, 0.0, TEST_PRECISION).segmentTo(pt); Segment b = Line.fromPointAndAngle(pt, Geometry.HALF_PI, TEST_PRECISION).segmentFrom(pt); segments.add(a); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java index 45e8701..207f037 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/LineTest.java @@ -124,7 +124,7 @@ public class LineTest { Vector2D vec = Vector2D.of(-1, -2); // act/assert - Assert.assertEquals(0, Line.fromPointAndAngle(vec, Geometry.ZERO_PI, TEST_PRECISION).getAngle(), TEST_EPS); + Assert.assertEquals(0, Line.fromPointAndAngle(vec, 0.0, TEST_PRECISION).getAngle(), TEST_EPS); Assert.assertEquals(Geometry.PI, Line.fromPointAndAngle(vec, Geometry.PI, TEST_PRECISION).getAngle(), TEST_EPS); Assert.assertEquals(0, Line.fromPointAndAngle(vec, Geometry.TWO_PI, TEST_PRECISION).getAngle(), TEST_EPS); @@ -387,20 +387,20 @@ public class LineTest { @Test public void testAngle() { // arrange - Line a = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line a = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); Line b = Line.fromPointAndAngle(Vector2D.of(1, 4), Geometry.PI, TEST_PRECISION); Line c = Line.fromPointAndDirection(Vector2D.of(1, 1), Vector2D.of(2, 2), TEST_PRECISION); // act/assert - Assert.assertEquals(Geometry.ZERO_PI, a.angle(a), TEST_EPS); + Assert.assertEquals(0.0, a.angle(a), TEST_EPS); Assert.assertEquals(-Geometry.PI, a.angle(b), TEST_EPS); Assert.assertEquals(0.25 * Geometry.PI, a.angle(c), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, b.angle(b), TEST_EPS); + Assert.assertEquals(0.0, b.angle(b), TEST_EPS); Assert.assertEquals(-Geometry.PI, b.angle(a), TEST_EPS); Assert.assertEquals(-0.75 * Geometry.PI, b.angle(c), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, c.angle(c), TEST_EPS); + Assert.assertEquals(0.0, c.angle(c), TEST_EPS); Assert.assertEquals(-0.25 * Geometry.PI, c.angle(a), TEST_EPS); Assert.assertEquals(0.75 * Geometry.PI, c.angle(b), TEST_EPS); } @@ -448,7 +448,7 @@ public class LineTest { @Test public void testSegment_interval() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Interval interval = Interval.of(1, 2, TEST_PRECISION); // act @@ -462,7 +462,7 @@ public class LineTest { @Test public void testSegment_doubles() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act Segment segment = line.segment(1, 2); @@ -476,7 +476,7 @@ public class LineTest { @Test public void testSegment_pointsOnLine() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act Segment segment = line.segment(Vector2D.of(3, 1), Vector2D.of(2, 1)); @@ -490,7 +490,7 @@ public class LineTest { @Test public void testSegment_pointsProjectedOnLine() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act Segment segment = line.segment(Vector2D.of(-3, 2), Vector2D.of(2, -1)); @@ -576,7 +576,7 @@ public class LineTest { @Test public void testSubline() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act SubLine subline = line.subline(); @@ -687,8 +687,8 @@ public class LineTest { @Test public void testSimilarOrientation() { // arrange - Line a = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); - Line b = Line.fromPointAndAngle(Vector2D.of(4, 5), Geometry.ZERO_PI, TEST_PRECISION); + Line a = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); + Line b = Line.fromPointAndAngle(Vector2D.of(4, 5), 0.0, TEST_PRECISION); Line c = Line.fromPointAndAngle(Vector2D.of(-1, -3), 0.4 * Geometry.PI, TEST_PRECISION); Line d = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.4 * Geometry.PI, TEST_PRECISION); @@ -871,17 +871,17 @@ public class LineTest { Vector2D p = Vector2D.of(1, 2); - Line line = Line.fromPointAndAngle(p, Geometry.ZERO_PI, precision); + Line line = Line.fromPointAndAngle(p, 0.0, precision); // act/assert Vector2D offset1 = Vector2D.of(0, 1e-4); Vector2D offset2 = Vector2D.of(0, 2e-3); - Assert.assertTrue(line.contains(Line.fromPointAndAngle(p.add(offset1), Geometry.ZERO_PI, precision))); - Assert.assertTrue(line.contains(Line.fromPointAndAngle(p.subtract(offset1), Geometry.ZERO_PI, precision))); + Assert.assertTrue(line.contains(Line.fromPointAndAngle(p.add(offset1), 0.0, precision))); + Assert.assertTrue(line.contains(Line.fromPointAndAngle(p.subtract(offset1), 0.0, precision))); - Assert.assertFalse(line.contains(Line.fromPointAndAngle(p.add(offset2), Geometry.ZERO_PI, precision))); - Assert.assertFalse(line.contains(Line.fromPointAndAngle(p.subtract(offset2), Geometry.ZERO_PI, precision))); + Assert.assertFalse(line.contains(Line.fromPointAndAngle(p.add(offset2), 0.0, precision))); + Assert.assertFalse(line.contains(Line.fromPointAndAngle(p.subtract(offset2), 0.0, precision))); Assert.assertTrue(line.contains(Line.fromPointAndAngle(p, 1e-4, precision))); Assert.assertFalse(line.contains(Line.fromPointAndAngle(p, 1e-2, precision))); @@ -1004,7 +1004,7 @@ public class LineTest { Vector2D p1 = Vector2D.of(1, 2); Vector2D p2 = Vector2D.of(1, -2); - Line line = Line.fromPointAndAngle(p1, Geometry.ZERO_PI, precision); + Line line = Line.fromPointAndAngle(p1, 0.0, precision); // act/assert Assert.assertTrue(line.isParallel(Line.fromPointAndAngle(p2, 1e-4, precision))); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java index f95495b..8c43afa 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/PolylineTest.java @@ -275,7 +275,7 @@ public class PolylineTest { Segment a = Segment.fromPoints(Vector2D.ZERO, Vector2D.of(1, 0), TEST_PRECISION); Segment b = Segment.fromPoints(Vector2D.of(1.01, 0), Vector2D.of(1, 0), TEST_PRECISION); - Segment c = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION).span(); + Segment c = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION).span(); Segment d = Line.fromPointAndAngle(Vector2D.of(1, 0), Geometry.HALF_PI, TEST_PRECISION).span(); // act/assert @@ -813,7 +813,7 @@ public class PolylineTest { @Test public void testSimplify_infiniteSegment() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); Builder builder = Polyline.builder(TEST_PRECISION); Polyline path = builder @@ -839,7 +839,7 @@ public class PolylineTest { @Test public void testSimplify_combinedInfiniteSegment() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); Split<Segment> split = line.span().split(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION)); Builder builder = Polyline.builder(TEST_PRECISION); @@ -867,7 +867,7 @@ public class PolylineTest { @Test public void testSimplify_startAndEndNotCombinedWhenNotClosed() { // arrange - Line xAxis = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line xAxis = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); Builder builder = Polyline.builder(TEST_PRECISION); Polyline path = builder @@ -1070,7 +1070,7 @@ public class PolylineTest { Vector2D p = Vector2D.Unit.PLUS_X; Builder builder = Polyline.builder(TEST_PRECISION); - builder.append(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION).span()); + builder.append(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION).span()); // act/assert GeometryTestUtils.assertThrows(() -> { @@ -1241,7 +1241,7 @@ public class PolylineTest { // arrange Builder builder = Polyline.builder(TEST_PRECISION); - builder.append(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION) + builder.append(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION) .segment(Double.NEGATIVE_INFINITY, 1)) .append(Vector2D.of(1, 1)); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java index e84f271..f5d04f8 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/RegionBSPTree2DTest.java @@ -110,7 +110,7 @@ public class RegionBSPTree2DTest { public void testCopy() { // arrange RegionBSPTree2D tree = new RegionBSPTree2D(true); - tree.getRoot().cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + tree.getRoot().cut(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); // act RegionBSPTree2D copy = tree.copy(); @@ -246,7 +246,7 @@ public class RegionBSPTree2DTest { public void testToConvex_halfSpace() { // arrange RegionBSPTree2D tree = RegionBSPTree2D.full(); - tree.getRoot().insertCut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + tree.getRoot().insertCut(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); // act List<ConvexArea> result = tree.toConvex(); @@ -370,7 +370,7 @@ public class RegionBSPTree2DTest { RegionBSPTree2D tree = RegionBSPTree2D.empty(); RegionNode2D root = tree.getRoot(); - root.cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + root.cut(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); RegionNode2D minus = root.getMinus(); minus.cut(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION)); @@ -1059,7 +1059,7 @@ public class RegionBSPTree2DTest { public void testTransform_halfSpace() { // arrange RegionBSPTree2D tree = RegionBSPTree2D.empty(); - tree.getRoot().insertCut(Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION)); + tree.getRoot().insertCut(Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION)); AffineTransformMatrix2D transform = AffineTransformMatrix2D.createScale(0.5, 2) .rotate(Geometry.HALF_PI) diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java index 704795b..92ddd06 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SegmentTest.java @@ -569,7 +569,7 @@ public class SegmentTest { Segment aSeg = Segment.fromPoints(Vector2D.of(1, 0), Vector2D.of(2, 0), TEST_PRECISION); Segment bSeg = Segment.fromPoints(Vector2D.of(-1, -1), Vector2D.of(1, 1), TEST_PRECISION); - Line xAxis = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line xAxis = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); Line yAxis = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.HALF_PI, TEST_PRECISION); Line angledLine = Line.fromPoints(Vector2D.of(1, 1), Vector2D.of(2, 0), TEST_PRECISION); diff --git a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java index 71f371e..5a42865 100644 --- a/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java +++ b/commons-geometry-euclidean/src/test/java/org/apache/commons/geometry/euclidean/twod/SubLineTest.java @@ -147,7 +147,7 @@ public class SubLineTest { @Test public void testAdd_lineSegment() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Line otherLine = Line.fromPointAndAngle(Vector2D.of(0, 1), 1e-11, TEST_PRECISION); SubLine subline = new SubLine(line); @@ -173,7 +173,7 @@ public class SubLineTest { @Test public void testAdd_subLine() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); SubLine a = new SubLine(line); RegionBSPTree1D aTree = a.getSubspaceRegion(); @@ -215,7 +215,7 @@ public class SubLineTest { @Test public void testAdd_argumentsFromDifferentLine() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Line otherLine = Line.fromPointAndAngle(Vector2D.of(0, 1), 1e-2, TEST_PRECISION); SubLine subline = new SubLine(line); @@ -237,7 +237,7 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), 0.1 * Geometry.PI, TEST_PRECISION); @@ -265,7 +265,7 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); Line splitter = Line.fromPointAndAngle(Vector2D.of(1, 0), -0.9 * Geometry.PI, TEST_PRECISION); @@ -293,7 +293,7 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); Line splitter = Line.fromPointAndAngle(Vector2D.of(-1, 0), 0.1 * Geometry.PI, TEST_PRECISION); @@ -315,7 +315,7 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); Line splitter = Line.fromPointAndAngle(Vector2D.of(10, 0), 0.1 * Geometry.PI, TEST_PRECISION); @@ -337,10 +337,10 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); - Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line splitter = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); // act Split<SubLine> split = subline.split(splitter); @@ -359,10 +359,10 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); - Line splitter = Line.fromPointAndAngle(Vector2D.of(0, -1), Geometry.ZERO_PI, TEST_PRECISION); + Line splitter = Line.fromPointAndAngle(Vector2D.of(0, -1), 0.0, TEST_PRECISION); // act Split<SubLine> split = subline.split(splitter); @@ -381,10 +381,10 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); - Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); // act Split<SubLine> split = subline.split(splitter); @@ -403,7 +403,7 @@ public class SubLineTest { subRegion.add(Interval.of(0, 2, TEST_PRECISION)); subRegion.add(Interval.of(3, 4, TEST_PRECISION)); - Line line = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION); SubLine subline = new SubLine(line, subRegion); Line splitter = Line.fromPointAndAngle(Vector2D.ZERO, Geometry.PI, TEST_PRECISION); @@ -425,7 +425,7 @@ public class SubLineTest { .createRotation(Vector2D.of(0, 1), Geometry.HALF_PI) .scale(Vector2D.of(3, 2)); - SubLine subline = new SubLine(Line.fromPointAndAngle(Vector2D.ZERO, Geometry.ZERO_PI, TEST_PRECISION)); + SubLine subline = new SubLine(Line.fromPointAndAngle(Vector2D.ZERO, 0.0, TEST_PRECISION)); subline.getSubspaceRegion().add(Interval.of(0, 1, TEST_PRECISION)); subline.getSubspaceRegion().add(Interval.min(3, TEST_PRECISION)); @@ -453,7 +453,7 @@ public class SubLineTest { // arrange AffineTransformMatrix2D mat = AffineTransformMatrix2D.createScale(Vector2D.of(-1, 2)); - SubLine subline = new SubLine(Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION)); + SubLine subline = new SubLine(Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION)); subline.getSubspaceRegion().add(Interval.of(0, 1, TEST_PRECISION)); // act @@ -474,7 +474,7 @@ public class SubLineTest { @Test public void testBuilder_instanceMethod() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); SubLineBuilder builder = new SubLine(line).builder(); // act @@ -495,7 +495,7 @@ public class SubLineTest { @Test public void testBuilder_createEmpty() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); SubLineBuilder builder = new SubLineBuilder(line); @@ -513,7 +513,7 @@ public class SubLineTest { @Test public void testBuilder_addConvex() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Line otherLine = Line.fromPointAndAngle(Vector2D.of(0, 1), 1e-11, TEST_PRECISION); SubLineBuilder builder = new SubLineBuilder(line); @@ -541,7 +541,7 @@ public class SubLineTest { @Test public void testBuilder_addNonConvex() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); SubLine a = new SubLine(line); RegionBSPTree1D aTree = a.getSubspaceRegion(); @@ -585,7 +585,7 @@ public class SubLineTest { @Test public void testBuilder_argumentsFromDifferentLine() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); Line otherLine = Line.fromPointAndAngle(Vector2D.of(0, 1), 1e-2, TEST_PRECISION); SubLineBuilder builder = new SubLineBuilder(line); @@ -603,7 +603,7 @@ public class SubLineTest { @Test public void testBuilder_unknownSubLineType() { // arrange - Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), Geometry.ZERO_PI, TEST_PRECISION); + Line line = Line.fromPointAndAngle(Vector2D.of(0, 1), 0.0, TEST_PRECISION); AbstractSubLine unknownType = new AbstractSubLine(line) { @Override diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java index 81d9434..74113e5 100644 --- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java +++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/AngularInterval.java @@ -73,7 +73,7 @@ public class AngularInterval implements HyperplaneBoundedRegion<Point1S> { public double getMin() { return (minBoundary != null) ? minBoundary.getAzimuth() : - Geometry.ZERO_PI; + 0.0; } /** Get the minimum boundary for the interval, or null if the diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java index 630d6ef..3fc8912 100644 --- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java +++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/Point1S.java @@ -43,7 +43,7 @@ import org.apache.commons.numbers.angle.PlaneAngleRadians; public final class Point1S implements Point<Point1S> { /** A point with coordinates set to {@code 0*pi}. */ - public static final Point1S ZERO = Point1S.of(Geometry.ZERO_PI); + public static final Point1S ZERO = Point1S.of(0.0); /** A point with coordinates set to {@code pi}. */ public static final Point1S PI = Point1S.of(Geometry.PI); diff --git a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java index 15bd465..072f0ea 100644 --- a/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java +++ b/commons-geometry-spherical/src/main/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1S.java @@ -288,7 +288,7 @@ public class RegionBSPTree1S extends AbstractRegionBSPTree<Point1S, RegionBSPTre min = min.reverse(); } } else { - min = CutAngle.createNegativeFacing(Geometry.ZERO_PI, precision); + min = CutAngle.createNegativeFacing(0.0, precision); } if (max != null) { diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java index 853b297..b110eba 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/AngularIntervalTest.java @@ -297,7 +297,7 @@ public class AngularIntervalTest { // act/assert checkInterval(interval.transform(rotate), Geometry.PI, 1.5 * Geometry.PI); - checkInterval(interval.transform(invert), -0.5 * Geometry.PI, Geometry.ZERO_PI); + checkInterval(interval.transform(invert), -0.5 * Geometry.PI, 0.0); } @Test @@ -334,7 +334,7 @@ public class AngularIntervalTest { @Test public void testToTree_intervalEqualToPi() { // arrange - AngularInterval interval = AngularInterval.of(Geometry.ZERO_PI, Geometry.PI, TEST_PRECISION); + AngularInterval interval = AngularInterval.of(0.0, Geometry.PI, TEST_PRECISION); // act RegionBSPTree1S tree = interval.toTree(); @@ -837,7 +837,7 @@ public class AngularIntervalTest { // act/assert checkInterval(interval.transform(rotate), Geometry.PI, 1.5 * Geometry.PI); - checkInterval(interval.transform(invert), -0.5 * Geometry.PI, Geometry.ZERO_PI); + checkInterval(interval.transform(invert), -0.5 * Geometry.PI, 0.0); } private static void checkFull(AngularInterval interval) { diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java index 2a241b6..f670b3e 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/CutAngleTest.java @@ -44,15 +44,15 @@ public class CutAngleTest { @Test public void testFromAzimuthAndDirection() { // act/assert - checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.ZERO_PI, true, TEST_PRECISION), - Geometry.ZERO_PI, true); + checkCutAngle(CutAngle.fromAzimuthAndDirection(0.0, true, TEST_PRECISION), + 0.0, true); checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.PI, true, TEST_PRECISION), Geometry.PI, true); checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.MINUS_HALF_PI, true, TEST_PRECISION), Geometry.MINUS_HALF_PI, true); - checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.ZERO_PI, false, TEST_PRECISION), - Geometry.ZERO_PI, false); + checkCutAngle(CutAngle.fromAzimuthAndDirection(0.0, false, TEST_PRECISION), + 0.0, false); checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.PI, false, TEST_PRECISION), Geometry.PI, false); checkCutAngle(CutAngle.fromAzimuthAndDirection(Geometry.MINUS_HALF_PI, false, TEST_PRECISION), @@ -66,14 +66,14 @@ public class CutAngleTest { // act/assert checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, true, TEST_PRECISION), - Geometry.ZERO_PI, true); + 0.0, true); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.PI, true, TEST_PRECISION), Geometry.PI, true); checkCutAngle(CutAngle.fromPointAndDirection(pt, true, TEST_PRECISION), Geometry.MINUS_HALF_PI, true); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, false, TEST_PRECISION), - Geometry.ZERO_PI, false); + 0.0, false); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.PI, false, TEST_PRECISION), Geometry.PI, false); checkCutAngle(CutAngle.fromPointAndDirection(pt, false, TEST_PRECISION), @@ -84,7 +84,7 @@ public class CutAngleTest { public void testCreatePositiveFacing() { // act/assert checkCutAngle(CutAngle.createPositiveFacing(Point1S.ZERO, TEST_PRECISION), - Geometry.ZERO_PI, true); + 0.0, true); checkCutAngle(CutAngle.createPositiveFacing(Point1S.PI, TEST_PRECISION), Geometry.PI, true); checkCutAngle(CutAngle.createPositiveFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION), @@ -95,7 +95,7 @@ public class CutAngleTest { public void testCreateNegativeFacing() { // act/assert checkCutAngle(CutAngle.createNegativeFacing(Point1S.ZERO, TEST_PRECISION), - Geometry.ZERO_PI, false); + 0.0, false); checkCutAngle(CutAngle.createNegativeFacing(Point1S.PI, TEST_PRECISION), Geometry.PI, false); checkCutAngle(CutAngle.createNegativeFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION), @@ -105,8 +105,8 @@ public class CutAngleTest { @Test public void testOffset() { // arrange - CutAngle zeroPos = CutAngle.createPositiveFacing(Geometry.ZERO_PI, TEST_PRECISION); - CutAngle zeroNeg = CutAngle.createNegativeFacing(Geometry.ZERO_PI, TEST_PRECISION); + CutAngle zeroPos = CutAngle.createPositiveFacing(0.0, TEST_PRECISION); + CutAngle zeroNeg = CutAngle.createNegativeFacing(0.0, TEST_PRECISION); CutAngle negPiPos = CutAngle.createPositiveFacing(-Geometry.PI, TEST_PRECISION); CutAngle piNeg = CutAngle.createNegativeFacing(Geometry.PI, TEST_PRECISION); @@ -147,8 +147,8 @@ public class CutAngleTest { @Test public void testClassify() { // arrange - CutAngle zeroPos = CutAngle.createPositiveFacing(Geometry.ZERO_PI, TEST_PRECISION); - CutAngle zeroNeg = CutAngle.createNegativeFacing(Geometry.ZERO_PI, TEST_PRECISION); + CutAngle zeroPos = CutAngle.createPositiveFacing(0.0, TEST_PRECISION); + CutAngle zeroNeg = CutAngle.createNegativeFacing(0.0, TEST_PRECISION); CutAngle negPiPos = CutAngle.createPositiveFacing(-Geometry.PI, TEST_PRECISION); // act/assert @@ -220,8 +220,8 @@ public class CutAngleTest { @Test public void testSimilarOrientation() { // arrange - CutAngle a = CutAngle.createPositiveFacing(Geometry.ZERO_PI, TEST_PRECISION); - CutAngle b = CutAngle.createNegativeFacing(Geometry.ZERO_PI, TEST_PRECISION); + CutAngle a = CutAngle.createPositiveFacing(0.0, TEST_PRECISION); + CutAngle b = CutAngle.createNegativeFacing(0.0, TEST_PRECISION); CutAngle c = CutAngle.createPositiveFacing(Geometry.MINUS_HALF_PI, TEST_PRECISION); // act/assert @@ -244,7 +244,7 @@ public class CutAngleTest { checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * Geometry.PI), true, TEST_PRECISION).transform(transform), Geometry.TWO_PI, true); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(Geometry.MINUS_HALF_PI), false, TEST_PRECISION).transform(transform), - Geometry.ZERO_PI, false); + 0.0, false); } @Test @@ -254,9 +254,9 @@ public class CutAngleTest { // act checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, true, TEST_PRECISION).transform(transform), - Geometry.ZERO_PI, false); + 0.0, false); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.ZERO, false, TEST_PRECISION).transform(transform), - Geometry.ZERO_PI, true); + 0.0, true); checkCutAngle(CutAngle.fromPointAndDirection(Point1S.of(1.5 * Geometry.PI), true, TEST_PRECISION).transform(transform), -1.5 * Geometry.PI, false); @@ -355,7 +355,7 @@ public class CutAngleTest { @Test public void testToString() { // arrange - CutAngle pt = CutAngle.createPositiveFacing(Geometry.ZERO_PI, TEST_PRECISION); + CutAngle pt = CutAngle.createPositiveFacing(0.0, TEST_PRECISION); // act String str = pt.toString(); diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java index f4a08e6..da46a11 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/Point1STest.java @@ -78,7 +78,7 @@ public class Point1STest { @Test public void testFrom_vector() { // act/assert - checkPoint(Point1S.from(Vector2D.of(2, 0)), Geometry.ZERO_PI); + checkPoint(Point1S.from(Vector2D.of(2, 0)), 0.0); checkPoint(Point1S.from(Vector2D.of(0, 0.1)), Geometry.HALF_PI); checkPoint(Point1S.from(Vector2D.of(-0.5, 0)), Geometry.PI); checkPoint(Point1S.from(Vector2D.of(0, -100)), 1.5 * Geometry.PI); @@ -87,7 +87,7 @@ public class Point1STest { @Test public void testFrom_polar() { // act/assert - checkPoint(Point1S.from(PolarCoordinates.of(100, 0)), Geometry.ZERO_PI); + checkPoint(Point1S.from(PolarCoordinates.of(100, 0)), 0.0); checkPoint(Point1S.from(PolarCoordinates.of(1, Geometry.HALF_PI)), Geometry.HALF_PI); checkPoint(Point1S.from(PolarCoordinates.of(0.5, Geometry.PI)), Geometry.PI); checkPoint(Point1S.from(PolarCoordinates.of(1e-4, Geometry.MINUS_HALF_PI)), 1.5 * Geometry.PI); @@ -331,7 +331,7 @@ public class Point1STest { // act Point1S piNorm = pt.normalize(Point1S.PI); - Point1S zeroNorm = pt.normalize(Geometry.ZERO_PI); + Point1S zeroNorm = pt.normalize(0.0); // assert Assert.assertEquals(expectedPiNorm, piNorm.getAzimuth(), TEST_EPS); @@ -346,11 +346,11 @@ public class Point1STest { public void testNormalize_nonFinite() { // act/assert GeometryTestUtils.assertThrows(() -> { - Point1S.of(Double.POSITIVE_INFINITY).normalize(Geometry.ZERO_PI); + Point1S.of(Double.POSITIVE_INFINITY).normalize(0.0); }, GeometryValueException.class); GeometryTestUtils.assertThrows(() -> { - Point1S.of(Double.NEGATIVE_INFINITY).normalize(Geometry.ZERO_PI); + Point1S.of(Double.NEGATIVE_INFINITY).normalize(0.0); }, GeometryValueException.class); GeometryTestUtils.assertThrows(() -> { @@ -413,11 +413,11 @@ public class Point1STest { checkPoint(p4.below(p1), Geometry.MINUS_HALF_PI); checkPoint(p5.below(p1), -Geometry.TWO_PI); - checkPoint(p1.below(p3), Geometry.ZERO_PI); + checkPoint(p1.below(p3), 0.0); checkPoint(p2.below(p3), Geometry.HALF_PI); checkPoint(p3.below(p3), -Geometry.PI); checkPoint(p4.below(p3), Geometry.MINUS_HALF_PI); - checkPoint(p5.below(p3), Geometry.ZERO_PI); + checkPoint(p5.below(p3), 0.0); } @Test diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java index 6ae23a7..b501706 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/oned/RegionBSPTree1STest.java @@ -137,7 +137,7 @@ public class RegionBSPTree1STest { @Test public void testFromInterval_nonFull() { - for (double theta = Geometry.ZERO_PI; theta <= Geometry.TWO_PI; theta += 0.2) { + for (double theta = 0.0; theta <= Geometry.TWO_PI; theta += 0.2) { // arrange double min = theta; double max = theta + Geometry.HALF_PI; @@ -187,7 +187,7 @@ public class RegionBSPTree1STest { Geometry.MINUS_HALF_PI, Geometry.HALF_PI, Geometry.MINUS_HALF_PI - Geometry.TWO_PI, Geometry.HALF_PI + Geometry.TWO_PI); checkClassify(tree, RegionLocation.INSIDE, - Geometry.ZERO_PI, 0.5, -0.5, + 0.0, 0.5, -0.5, Geometry.TWO_PI, 0.5 + Geometry.TWO_PI, -0.5 - Geometry.TWO_PI); checkClassify(tree, RegionLocation.OUTSIDE, Geometry.PI, Geometry.PI + 0.5, Geometry.PI - 0.5, diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java index 0263555..9d129c7 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatArcTest.java @@ -167,7 +167,7 @@ public class GreatArcTest { // arrange GreatArc arc = GreatArc.fromInterval( GreatCircle.fromPoints(Point2S.PLUS_J, Point2S.MINUS_I, TEST_PRECISION), - AngularInterval.Convex.of(Geometry.ZERO_PI, Geometry.PI, TEST_PRECISION)); + AngularInterval.Convex.of(0.0, Geometry.PI, TEST_PRECISION)); // act List<GreatArc> result = arc.toConvex(); diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java index 6835862..b056834 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/GreatCircleTest.java @@ -145,7 +145,7 @@ public class GreatCircleTest { // poles Assert.assertEquals(Geometry.MINUS_HALF_PI, circle.offset(Point2S.of(Geometry.PI, Geometry.HALF_PI)), TEST_EPS); - Assert.assertEquals(Geometry.HALF_PI, circle.offset(Point2S.of(Geometry.ZERO_PI, Geometry.HALF_PI)), TEST_EPS); + Assert.assertEquals(Geometry.HALF_PI, circle.offset(Point2S.of(0.0, Geometry.HALF_PI)), TEST_EPS); } @Test @@ -188,18 +188,18 @@ public class GreatCircleTest { // on circle Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(0, 1, 0))), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Point2S.from(Vector3D.of(0, 0, 1))), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(0, 0, 1))), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(0, -1, 0))), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(0, 0, -1))), TEST_EPS); // +1/-1 Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 1, 0))), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, 1))), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, 1))), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, -1, 0))), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(-1, 0, -1))), TEST_EPS); Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Point2S.from(Vector3D.of(1, 1, 0))), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Point2S.from(Vector3D.of(1, 0, 1))), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Point2S.from(Vector3D.of(1, 0, 1))), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(1, -1, 0))), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Point2S.from(Vector3D.of(1, 0, -1))), TEST_EPS); @@ -218,18 +218,18 @@ public class GreatCircleTest { // on circle Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(0, 1, 0)), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Vector3D.of(0, 0, 1)), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(0, 0, 1)), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(0, -1, 0)), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(0, 0, -1)), TEST_EPS); // +1/-1 Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(-1, 1, 0)), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Vector3D.of(-1, 0, 1)), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(-1, 0, 1)), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(-1, -1, 0)), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(-1, 0, -1)), TEST_EPS); Assert.assertEquals(Geometry.HALF_PI, circle.azimuth(Vector3D.of(1, 1, 0)), TEST_EPS); - Assert.assertEquals(Geometry.ZERO_PI, circle.azimuth(Vector3D.of(1, 0, 1)), TEST_EPS); + Assert.assertEquals(0.0, circle.azimuth(Vector3D.of(1, 0, 1)), TEST_EPS); Assert.assertEquals(1.5 * Geometry.PI, circle.azimuth(Vector3D.of(1, -1, 0)), TEST_EPS); Assert.assertEquals(Geometry.PI, circle.azimuth(Vector3D.of(1, 0, -1)), TEST_EPS); @@ -245,7 +245,7 @@ public class GreatCircleTest { Vector3D.Unit.MINUS_X, Vector3D.Unit.PLUS_Z, TEST_PRECISION); // act/assert - SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Z, circle.vectorAt(Geometry.ZERO_PI), TEST_EPS); + SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Z, circle.vectorAt(0.0), TEST_EPS); SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.PLUS_Y, circle.vectorAt(Geometry.HALF_PI), TEST_EPS); SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Z, circle.vectorAt(Geometry.PI), TEST_EPS); SphericalTestUtils.assertVectorsEqual(Vector3D.Unit.MINUS_Y, circle.vectorAt(Geometry.MINUS_HALF_PI), TEST_EPS); @@ -283,9 +283,9 @@ public class GreatCircleTest { Vector3D.Unit.PLUS_Z, Vector3D.Unit.MINUS_Y, TEST_PRECISION); // act - SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.ZERO_PI, Geometry.ZERO_PI), + SphericalTestUtils.assertPointsEqual(Point2S.of(0.0, 0.0), minusXCircle.project(Point2S.from(Vector3D.Unit.MINUS_X)), TEST_EPS); - SphericalTestUtils.assertPointsEqual(Point2S.of(Geometry.ZERO_PI, Geometry.ZERO_PI), + SphericalTestUtils.assertPointsEqual(Point2S.of(0.0, 0.0), minusXCircle.project(Point2S.from(Vector3D.Unit.PLUS_X)), TEST_EPS); SphericalTestUtils.assertPointsEqual(Point2S.of(1.5 * Geometry.PI, Geometry.HALF_PI),
