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

Polygon2D does not detect crossings in some cases

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

    Details

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

      Nick Knize 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

          Activity

            People

            • Assignee:
              ivera Ignacio Vera
              Reporter:
              ivera Ignacio Vera

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

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

                  Issue deployment