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

GeoComplexPolygon failures



    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.7, 7.4, 8.0
    • modules/spatial3d
    • None
    • New


      I have tightened a bit more the random test for polygons and GeoComplexPolygons still shows issues when traveling planes that are cutting the world near the pole. I could identify three cases:


      case 1) It happens when the check point is on aone of the test point planes but the planes is close to the pole and cannot be traversed. In that case we hit the following part of the code:

      } else if (testPointFixedYPlane.evaluateIsZero(x, y, z) || testPointFixedXPlane.evaluateIsZero(x, y, z) || testPointFixedZPlane.evaluateIsZero(x, y, z)) {
        throw new IllegalArgumentException("Can't compute isWithin for specified point");
      } else {


      It seems this check is unnecesary. If removed then a traversal is choosen and evrything works as expected.


      case 2) In this case a DualCrossingEdgeIterator is used with one of the planes being close to the pole but inside current restricutions (is a valid traversal). I think the problem happens when computing the intersection points for above and below plane in computeInsideOutside:

      final GeoPoint[] outsideOutsidePoints = testPointOutsidePlane.findIntersections(planetModel, travelOutsidePlane);  //these don't add anything: , checkPointCutoffPlane, testPointCutoffPlane);
      final GeoPoint outsideOutsidePoint = pickProximate(outsideOutsidePoints);

      The intersection above results in two points close to each other and close to the intersection point, and therefore pickProximate fails in choosing the right one.

      case 3) In this case a LinearCrossingEdgeIterator is used with the plane being close to the pole. In this case when evaluating the intersection between an edge and the plane, we get two intersections (because are very close together) inside the bounds instead of one. The result is too many crossings.


      After evaluating this errors I think we should really prevent using planes that are near a pole. I attached a new version of GeoComplexPolygon that seems to solve this issues. The approach is the following:

       NEAR_EDGE_CUTOFF is not expressed as a linear distance but as a percentage, curerntly 0.75 . If ab is the value of a semiaxis, the logic disallows to travel a plane if the distance between the plane and the center of the world is bigger that  NEAR_EDGE_CUTOFF * pole.










        1. LUCENE-8276.patch
          40 kB
          Ignacio Vera
        2. LUCENE-8276-random.patch
          15 kB
          Ignacio Vera
        3. LUCENE-8276-test.patch
          6 kB
          Ignacio Vera



            kwright@metacarta.com Karl Wright
            ivera Ignacio Vera
            0 Vote for this issue
            3 Start watching this issue