commit | 3201a5898a7b7975ad6a1dbe79083f8ed304c253 | [log] [tgz] |
---|---|---|
author | Matt Juntunen <matt.juntunen@hotmail.com> | Tue Jan 07 22:18:21 2020 -0500 |
committer | Gilles Sadowski <gilles@harfang.homelinux.org> | Wed Jan 08 13:49:47 2020 +0100 |
tree | a88f2581a62d19678e341ab402581ca6e91a4e8c | |
parent | 1ba86d5ae952309c852be9d7a78bf3d02ffe5448 [diff] |
GEOMETRY-86: adding test for numerical stability of Point2S.antipodal()
diff --git a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java index 89e973f..4b18cb7 100644 --- a/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java +++ b/commons-geometry-spherical/src/test/java/org/apache/commons/geometry/spherical/twod/Point2STest.java
@@ -228,6 +228,20 @@ } @Test + public void testAntipodal_numericalStability() { + // arrange + double eps = 1e-16; + Point2S pt = Point2S.of(1, 2); + + // act + Point2S result = pt.antipodal().antipodal(); + + // assert + Assert.assertEquals(1.0, result.getAzimuth(), eps); + Assert.assertEquals(2.0, result.getPolar(), eps); + } + + @Test public void testDimension() { // arrange Point2S pt = Point2S.of(1, 2);