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

Polygon2D does not detect crossings in some cases

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 8.x, master (9.0)
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      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);
      }

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

        Attachments

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

          Issue Links

            Activity

              People

              • Assignee:
                ivera Ignacio Vera
                Reporter:
                ivera Ignacio Vera
              • Votes:
                0 Vote for this issue
                Watchers:
                4 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