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

Karl Wright commented on LUCENE-8245:
-------------------------------------

Here's the revised output for these two edges:

{code}
   [junit4]   1> Considering edge [lat=-1.4506713533447755, 
lon=-1.2251247551355924([X=0.04060395941016342, Y=-0.11274773940940182, 
Z=-0.9927936672533157])] -> [lat=4.9E-324, lon=0.0([X=1.0, Y=0.0, Z=4.9E-324])]
   [junit4]   1>  start point travel dist=-0.11274773940907501; end point 
travel dist=3.268072236836579E-13
   [junit4]   1>  start point travel above dist=-0.11274773940806501; end point 
travel above dist=1.336807223683658E-12
   [junit4]   1>  start point travel below dist=-0.11274773941008501; end point 
travel below dist=-6.831927763163422E-13
   [junit4]   1>  start point testpoint dist=-0.34019438500826027; end point 
testpoint dist=0.6525992822450555
   [junit4]   1>  start point testpoint above dist=-0.3401943850072502; end 
point testpoint above dist=0.6525992822460656
   [junit4]   1>  start point testpoint below dist=-0.34019438500927035; end 
point testpoint below dist=0.6525992822440454
   [junit4]   1>   Travel inner point [X=1.0, Y=-1.336807223683658E-12, 
Z=-1.1771178322187736E-11]
   [junit4]   1>   Test point inner point [X=0.7540698997149413, 
Y=-0.07411317803504912, Z=-0.6525992822440454]
   [junit4]   1>  Edge added 2 to innerCrossingCount
   [junit4]   1>   Test point outer point [X=0.7540698997131706, 
Y=-0.07411317803527853, Z=-0.6525992822460656]
   [junit4]   1>  Edge added 1 to outerCrossingCount
   [junit4]   1>
   [junit4]   1> Considering edge [lat=4.9E-324, lon=0.0([X=1.0, Y=0.0, 
Z=4.9E-324])] -> [lat=0.13953211802880663, 
lon=-2.443438340098597([X=-0.7585849990851791, Y=-0.6365576248361361, 
Z=0.139079795174987])]
   [junit4]   1>  start point travel dist=3.268072236836579E-13; end point 
travel dist=-0.6365576248358092
   [junit4]   1>  start point travel above dist=1.336807223683658E-12; end 
point travel above dist=-0.6365576248347993
   [junit4]   1>  start point travel below dist=-6.831927763163422E-13; end 
point travel below dist=-0.6365576248368193
   [junit4]   1>  start point testpoint dist=0.6525992822450555; end point 
testpoint dist=0.7916790774200425
   [junit4]   1>  start point testpoint above dist=0.6525992822460656; end 
point testpoint above dist=0.7916790774210526
   [junit4]   1>  start point testpoint below dist=0.6525992822440454; end 
point testpoint below dist=0.7916790774190324
   [junit4]   1>   Travel inner point [X=1.0, Y=-1.3368072236836578E-12, 
Z=2.920754816285907E-13]
   [junit4]   1>  Edge added 1 to innerCrossingCount
   [junit4]   1>   Travel outer point [X=1.0, Y=6.831927763163421E-13, 
Z=-1.4926898632243605E-13]
   [junit4]   1>  Edge added 1 to outerCrossingCount
{code}

The first edge's endpoint is on the "below" travel plane, but not the "above" 
one, and that's of course true as well for the start point of the second edge, 
since they're shared.  And indeed we see two "inner" crossings of the travel 
plane -- one from each edge.  Those are correct.

So we're seeing an extra crossing of the outer plane that we should not, 
specifically this one:

{code}
   [junit4]   1> Considering edge [lat=4.9E-324, lon=0.0([X=1.0, Y=0.0, 
Z=4.9E-324])] -> [lat=0.13953211802880663, 
lon=-2.443438340098597([X=-0.7585849990851791, Y=-0.6365576248361361, 
Z=0.139079795174987])]
   [junit4]   1>   Travel outer point [X=1.0, Y=6.831927763163421E-13, 
Z=-1.4926898632243605E-13]
   [junit4]   1>  Edge added 1 to outerCrossingCount
{code}

We compute this by calling Plane.findCrossings() between the travel plane and 
the edge plane, with the computed bounds planes.  We should not find this 
intersection, but we do anyway.

The numeric precision of that method under these conditions is not adequate to 
this kind of find-grained envelope computation.  The next step is to see 
whether the point that it finds is off the two intersecting planes, and if so, 
by how much.  If that's what is going wrong, we may need to increase 
MINIMUM_RESOLUTION somewhat to cover the computation issues, maybe to 2e-12.  
OR we can try a successive approximation approach to the intersection math -- 
but I don't relish that idea, frankly.



> GeoComplexPolygon fails when intersection of travel plane with edge is near 
> polygon point
> -----------------------------------------------------------------------------------------
>
>                 Key: LUCENE-8245
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8245
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>            Priority: Major
>             Fix For: 6.7, 7.4, master (8.0)
>
>         Attachments: LUCENE-8245-case2.patch, LUCENE-8245.jpg, 
> LUCENE-8245.patch
>
>
> When a travel plane crosses an edge close to an edge point , it is possible 
> that the above and below planes crosses different edges. In the current 
> implementation one of the crosses is missed because we only check edges that 
> are crossed by the main plain and the {{within}} result is wrong.
> One possible fix is to check always the intersection of planes and edges 
> regardless if they are crossed by main plane. That fixed the above issue but 
> shows other issues like travel planes crossing two edges when it should be 
> only one due to the fuzziness at edge intersections.
> Not sure of a fix so I add the test showing the issue.
>  
>  



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