[
https://issues.apache.org/jira/browse/GEOMETRY-86?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Baljit Singh updated GEOMETRY-86:
---------------------------------
Description:
{code:java}
@Test
public void testAntipodal() {
Point2S point = Point2S.of(1.0, 1.0);
Point2S antipodal = point.antipodal();
Point2S fromNeg = Point2S.from(point.getVector().negate());
System.out.println(String.format("Point2S: %s, Vector: %s", point,
point.getVector()));
System.out.println(String.format("Point2S: %s, Vector: %s", antipodal,
antipodal.getVector()));
System.out.println(String.format("Point2S: %s, Vector: %s", fromNeg,
fromNeg.getVector()));
}
{code}
This prints:
Point2S: (1.0, 1.0), Vector: (0.4546487134128409, 0.7080734182735712,
0.5403023058681398)
Point2S: (5.283185307179586, 2.141592653589793), Vector: (-0.4546487134128409,
-0.7080734182735712, -0.5403023058681398)
Point2S: (4.141592653589792, 2.141592653589793), Vector: (-0.4546487134128409,
-0.7080734182735712, -0.5403023058681398)
SphericalTestUtils.assertPointsEq does not detect the error because the
point.getVector() and copy.getVector() are equal, and therefore the distance
between these points is equal.
was:
The antipodal calculation is invalid.
{code:java}
@Test
public void testAntipodal() {
Point2S point = Point2S.of(0.0, 0.0).antipodal();
Point2S copy = Point2S.from(point.getVector());
System.out.println(point);
System.out.println(copy);
}
{code}
This prints:
(0.0, 3.141592653589793)
(3.141592653589793, 3.141592653589793)
SphericalTestUtils.assertPointsEq does not detect the error because the
point.getVector() and copy.getVector() are equal, and therefore the distance
between these points is equal.
> Point2S.antipodal() is incorrect.
> ---------------------------------
>
> Key: GEOMETRY-86
> URL: https://issues.apache.org/jira/browse/GEOMETRY-86
> Project: Apache Commons Geometry
> Issue Type: Bug
> Reporter: Baljit Singh
> Priority: Major
>
> {code:java}
> @Test
> public void testAntipodal() {
> Point2S point = Point2S.of(1.0, 1.0);
> Point2S antipodal = point.antipodal();
> Point2S fromNeg = Point2S.from(point.getVector().negate());
> System.out.println(String.format("Point2S: %s, Vector: %s", point,
> point.getVector()));
> System.out.println(String.format("Point2S: %s, Vector: %s",
> antipodal, antipodal.getVector()));
> System.out.println(String.format("Point2S: %s, Vector: %s", fromNeg,
> fromNeg.getVector()));
> }
> {code}
> This prints:
> Point2S: (1.0, 1.0), Vector: (0.4546487134128409, 0.7080734182735712,
> 0.5403023058681398)
> Point2S: (5.283185307179586, 2.141592653589793), Vector:
> (-0.4546487134128409, -0.7080734182735712, -0.5403023058681398)
> Point2S: (4.141592653589792, 2.141592653589793), Vector:
> (-0.4546487134128409, -0.7080734182735712, -0.5403023058681398)
> SphericalTestUtils.assertPointsEq does not detect the error because the
> point.getVector() and copy.getVector() are equal, and therefore the distance
> between these points is equal.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)