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

Karl Wright commented on LUCENE-8211:
-------------------------------------

The logic that is incorrect is here:

{code}
    // If we're right on top of any of the test planes, we navigate solely on 
that plane.
    if (testPointFixedYPlane.evaluateIsZero(x, y, z)) {
      // Use the XZ plane exclusively.
      final LinearCrossingEdgeIterator crossingEdgeIterator = new 
LinearCrossingEdgeIterator(testPointFixedYPlane, testPointFixedYAbovePlane, 
testPointFixedYBelowPlane, x, y, z);
      // Traverse our way from the test point to the check point.  Use the y 
tree because that's fixed.
      if (!yTree.traverse(crossingEdgeIterator, testPoint.y)) {
        // Endpoint is on edge
        return true;
      }
      return ((crossingEdgeIterator.crossingCount & 1) == 
0)?testPointInSet:!testPointInSet;
    } else if (testPointFixedXPlane.evaluateIsZero(x, y, z)) {
      // Use the YZ plane exclusively.
      final LinearCrossingEdgeIterator crossingEdgeIterator = new 
LinearCrossingEdgeIterator(testPointFixedXPlane, testPointFixedXAbovePlane, 
testPointFixedXBelowPlane, x, y, z);
      // Traverse our way from the test point to the check point.  Use the x 
tree because that's fixed.
      if (!xTree.traverse(crossingEdgeIterator, testPoint.x)) {
        // Endpoint is on edge
        return true;
      }
      return ((crossingEdgeIterator.crossingCount & 1) == 
0)?testPointInSet:!testPointInSet;
    } else if (testPointFixedZPlane.evaluateIsZero(x, y, z)) {
      // Use the XY plane exclusively.
      final LinearCrossingEdgeIterator crossingEdgeIterator = new 
LinearCrossingEdgeIterator(testPointFixedZPlane, testPointFixedZAbovePlane, 
testPointFixedZBelowPlane, x, y, z);
      // Traverse our way from the test point to the check point.  Use the z 
tree because that's fixed.
      if (!zTree.traverse(crossingEdgeIterator, testPoint.z)) {
        // Endpoint is on edge
        return true;
      }
      return ((crossingEdgeIterator.crossingCount & 1) == 
0)?testPointInSet:!testPointInSet;
    } else {
      
      // This is the expensive part!!
...
{code}

This code is looking for the "shortcut" solution in either of the three planes 
(X, Y, or Z) that go through the test point.  Unfortunately, that logic is 
incorrect because it uses the same point as a sidedness check for the cutoff 
planes it's going to construct!  I'll need to rethink a bit about how best to 
do this...


> GeoComplexPolygon throws error when checking within() for a point parallel to 
> test point
> ----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8211
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8211
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: LUCENE-8211.patch
>
>
> If a GeoComplexPolygon is created with test point (x, y, z) and we try to 
> check if point(-x,-y,-z) is {{within()}}then an error is thrown. It seems we 
> need to handle the case when a point is parallel to the test point but not 
> identical.
>  



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to