Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-8712

Polygon2D does not detect crossings in some cases

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 8.x, 9.0
    • None
    • None
    • New

    Description

      Polygon2D does not detect crossing if the triangle crosses through points of the polygon and none of the points are inside it. For example:

       

      public void testLineCrossingPolygonPoints() {
        Polygon p = new Polygon(new double[] {0, -1, 0, 1, 0}, new double[] {-1, 0, 1, 0, -1});
        Polygon2D polygon2D = Polygon2D.create(p);
        PointValues.Relation rel = polygon2D.relateTriangle(GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(-1.5)),
            GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0)),
            GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(1.5)),
            GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0)),
            GeoEncodingUtils.decodeLongitude(GeoEncodingUtils.encodeLongitude(-1.5)),
            GeoEncodingUtils.decodeLatitude(GeoEncodingUtils.encodeLatitude(0)));
        assertEquals(PointValues.Relation.CELL_CROSSES_QUERY, rel);
      }

      nknize you might want to look at this as I am not sure what to do.

      Attachments

        1. LUCENE-8712.patch
          13 kB
          Ignacio Vera
        2. LUCENE-8712.patch
          6 kB
          Nick Knize
        3. LUCENE-8712.patch
          5 kB
          Ignacio Vera

        Issue Links

          Activity

            People

              ivera Ignacio Vera
              ivera Ignacio Vera
              Votes:
              0 Vote for this issue
              Watchers:
              5 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