Uploaded image for project: 'Commons Geometry'
  1. Commons Geometry
  2. GEOMETRY-86

Point2S.antipodal() or Point2S.from() is incorrect.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • None
    • None

    Description

          @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()));
          }
      

      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 0.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              balsingh Baljit Singh
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 20m
                  20m