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

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

Looking elsewhere, I find that the code for colinearity has been changed, and I 
don't fully understand it anymore.  But since that's not a current problem, and 
since that code seems to be going to great lengths to find chords that aren't 
colinear, I'm going to concentrate on the failure case.  Once that's 
understood, we may want to revisit the other parts of the code to see if 
there's a more general solution.

The code that fails is this:

{code}
          // thePoint is on the wrong side of the complementary plane.  That 
means we cannot build a concave polygon, because the complement would not
          // be a legal convex polygon.
          // But we can take advantage of the fact that the distance between 
the edge and thePoint is less than 180 degrees, and so we can split the
          // would-be concave polygon into three segments.  The first segment 
includes the edge and thePoint, and uses the sense of the edge to determine the 
sense
          // of the polygon.
          
          // This should be the only problematic part of the polygon.
          // We know that thePoint is on the "wrong" side of the edge -- that 
is, it's on the side that the
          // edge is pointing at.
          final List<GeoPoint> thirdPartPoints = new ArrayList<>(3);
          final BitSet thirdPartInternal = new BitSet();
          thirdPartPoints.add(checkEdge.startPoint);
          thirdPartInternal.set(0, checkEdge.isInternal);
          thirdPartPoints.add(checkEdge.endPoint);
          thirdPartInternal.set(1, true);
          thirdPartPoints.add(thePoint);
          assert checkEdge.plane.isWithin(thePoint) : "Point was on wrong side 
of complementary plane, so must be on the right side of the non-complementary 
plane!";
          final GeoPolygon convexPart = new GeoConvexPolygon(planetModel, 
thirdPartPoints, holes, thirdPartInternal, true);
...
{code}

It is building a polygon with only three points, and the three points are 
coplanar.  So the polygon obviously cannot be built.  In fact, the problem must 
be in the logic that leads to the decision to build it at all.

The simplest thing to do is not generate this triangle if it's coplanar, and 
just keep going.  That's easy to detect and trivial to code.  Things may blow 
up in the subsequent steps, however.  Trying this 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