[ 
https://issues.apache.org/jira/browse/LUCENE-8220?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16412462#comment-16412462
 ] 

Karl Wright commented on LUCENE-8220:
-------------------------------------

Ok, this is the actual test case that is failing:

{code}
  @Test
  public void testCoplanarityTileConvex() throws Exception {
    //POLYGON((24.39398 65.77519,24.3941 65.77498,24.394024 65.77497,24.393976 
65.77495,24.393963 65.77493,24.394068 65.774925,24.394156 65.77495,24.394201 
65.77495,24.394234 65.77496,24.394266 65.77498,24.394318 65.77498,24.39434 
65.774956,24.394377 65.77495,24.394451 65.77494,24.394476 65.77495,24.394457 
65.77498,24.39398 65.77519))"
    List<GeoPoint> points = new ArrayList<>();
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77519), Geo3DUtil.fromDegrees(24.39398)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77498), Geo3DUtil.fromDegrees(24.3941)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77497), Geo3DUtil.fromDegrees(24.394024)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77495), Geo3DUtil.fromDegrees(24.393976)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77493), Geo3DUtil.fromDegrees(24.393963)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.774925), Geo3DUtil.fromDegrees(24.394068)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77495), Geo3DUtil.fromDegrees(24.394156)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77495), Geo3DUtil.fromDegrees(24.394201)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77496), Geo3DUtil.fromDegrees(24.394234)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77498), Geo3DUtil.fromDegrees(24.394266)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77498), Geo3DUtil.fromDegrees(24.394318)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.774956), Geo3DUtil.fromDegrees(24.39434)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77495), Geo3DUtil.fromDegrees(24.394377)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77494), Geo3DUtil.fromDegrees(24.394451)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77495), Geo3DUtil.fromDegrees(24.394476)));
    points.add(new GeoPoint(PlanetModel.SPHERE, 
Geo3DUtil.fromDegrees(65.77498), Geo3DUtil.fromDegrees(24.394457)));
    GeoCompositePolygon polygon = 
(GeoCompositePolygon)GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, 
points);
    assertTrue(polygon != null);
  }
{code}

It's trying, in fact, to tile the whole world EXCEPT for a small piece.  It 
slices some pieces off but then it's left with a piece that still spans, in at 
least one direction, more than 180 degrees.  That means it cannot use 
GeoConcavePolygon.  So instead, it tries to break it down further by slicing 
across, and even comes up with a way to do that, but the slice it identifies 
turns out to have colinear points.

So it's not the GeoConcavePolygon invocation where this can happen.  But, 
theoretically, it can happen any time we drop a chord across the polygon.

The easy solution is to change the algorithm so that whenever it introduces 
such a chord, it checks to see whether it's colinear with the next point in 
either direction.  If it is, it must do a further split, right there, so that 
there are two pieces built, rather than one, and thus colinearity is not 
possible.  Looking into that now.


> GeoPolygon factory still shows problems with coplanar points
> ------------------------------------------------------------
>
>                 Key: LUCENE-8220
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8220
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: concave.jpg, concaveWithTiling.jpg, 
> coplanarity-test.patch
>
>
> The attached patch contains two polygons that still shows problems with 
> co-planar points. To better explain the issue I attached some images:
> 1) concave.jpg:  This is the polygon we want to build. Note that we want to 
> build the concave part, therefore the blue part is actually not part of the 
> shape and the white part is the area cover by the shape.
> 2) concaveWithTiling.jpg: The algorithm of the polygon factory tries to tile 
> the polygon using convex polygons. In our case it creates the three colored 
> polygons on the image. What it remains is a concave polygon.
> The problem with this polygon is that the right edge of the concave polygon 
> contains co-planar points. These points cannot be merged into a single plane 
> because they have different properties (internal edges or shape edges).
> Because GeoConvexPolygon and GeoConcavePolygon cannot handle polygons with 
> co-planar points, the polygon cannot be built.
> [~kwri...@metacarta.com], Is it possible to make this polygons support such 
> an extreme case?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to