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

Karl Wright edited comment on LUCENE-7642 at 3/31/18 11:44 AM:
---------------------------------------------------------------

The problem is being looked at, and it seems to be occurring because the three 
edge planes being constructed for one of the convex polygons in the tile are 
almost coplanar.  This allows a point that is supposed to be (barely) outside 
of the polygon to be returned as being inside.  A GeoComplexPolygon correctly 
shows the point to be outside.

Here's a log of the edge memberships for one of these points:

{code}
   [junit4]   1> localIsWithin start for point 
[0.2416235655409041,5.90945326539883E-48,0.9682657046994557]
   [junit4]   1>  For edge [A=-1.224646799147353E-16, B=-1.0, 
C=-7.498798913309287E-33, D=0.0, side=1.0] the point evaluation is 
-2.959035261382389E-17
   [junit4]   1>  For edge [A=-3.0261581679831E-12, B=-0.9999999999999999, 
C=-1.8529874570670608E-28, D=0.0, side=1.0] the point evaluation is 
-7.31191126438807E-13
   [junit4]   1>  For edge [A=4.234084035470679E-12, B=1.0, 
C=-1.5172037954732973E-12, D=0.0, side=1.0] the point evaluation is 
-4.460019207463956E-13
{code}

When polygon edges have such a small angle between them, several unfortunate 
effects occur.  The first is that sometimes points on the opposite side of the 
world become "in set", because the planes are too close to parallel.  We've 
done work to make bounds determination work with such situations in the past.  
The second problem is that even on the correct side of the world, the boundary 
between what's in-set and what's not becomes fuzzy, and the numeric tolerances 
become impossible to maintain.  I believe that's what's happening here.

Ideally, we should detect these kinds of situations during tiling and either 
prevent them or use GeoComplexPolygons when they are found.  I will need to 
think through how that might work.

 


was (Author: [email protected]):
The problem is being looked at, and it seems to be occurring because the three 
edge planes being constructed for one of the convex polygons in the tile are 
almost coplanar.  This allows a point that is supposed to be (barely) outside 
of the polygon to be returned as being inside.  A GeoComplexPolygon correctly 
shows the point to be outside.

Here's a log of the edge memberships for one of these points:

{code}
   [junit4]   1> localIsWithin start for point 
[0.2416235655409041,5.90945326539883E-48,0.9682657046994557]
   [junit4]   1>  For edge [A=-1.224646799147353E-16, B=-1.0, 
C=-7.498798913309287E-33, D=0.0, side=1.0] the point evaluation is 
-2.959035261382389E-17
   [junit4]   1>  For edge [A=-3.0261581679831E-12, B=-0.9999999999999999, 
C=-1.8529874570670608E-28, D=0.0, side=1.0] the point evaluation is 
-7.31191126438807E-13
   [junit4]   1>  For edge [A=4.234084035470679E-12, B=1.0, 
C=-1.5172037954732973E-12, D=0.0, side=1.0] the point evaluation is 
-4.460019207463956E-13
{code}

Convex polygons that are constructed in this way do not have reliable bounds 
for each edge, so errors get large compared with the allowed values.  These 
could be addressed by explicitly constructing bounds for each edge, at the 
expense of slower GeoConvex or GeoConcave polygon construction.  But I think 
that's likely to be needed in any case.  The alternative would be to detect 
pathological cases when we're tiling, and throw a TileException so that a 
GeoComplexPolygon is built instead.
 

> TestGeo3DPoint.testGeo3DRelations() failure: invalid hits for 
> shape=GeoCompositeMembershipShape
> -----------------------------------------------------------------------------------------------
>
>                 Key: LUCENE-7642
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7642
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: modules/spatial3d
>    Affects Versions: 6.5
>            Reporter: Steve Rowe
>            Assignee: Karl Wright
>            Priority: Major
>         Attachments: verbose_output.txt
>
>
> Reproducing branch_6x failure from 
> [https://builds.apache.org/job/Lucene-Solr-NightlyTests-6.x/260/]:
> {noformat}
>    [junit4] Suite: org.apache.lucene.spatial3d.TestGeo3DPoint
>    [junit4]   1> doc=92 should match but did not
>    [junit4]   1>   point=[X=0.24162356556559528, Y=2.3309121299774915E-10, 
> Z=0.9682657049003708]
>    [junit4]   1>   mappedPoint=[lat=1.3262481806651818, 
> lon=2.4457272005608357E-47([X=0.2416235655409041, Y=5.90945326539883E-48, 
> Z=0.9682657046994557])]
>    [junit4]   1> doc=148 should match but did not
>    [junit4]   1>   point=[X=0.221555587372385, Y=2.3309121299774915E-10, 
> Z=0.9730217464933492]
>    [junit4]   1>   mappedPoint=[lat=1.3469149072042264, 
> lon=3.401370501882173E-238([X=0.22155558726547467, Y=7.535926390519672E-239, 
> Z=0.9730217465957189])]
>    [junit4]   1> doc=190 should match but did not
>    [junit4]   1>   point=[X=0.23438408720886705, Y=-2.3309121299774915E-10, 
> Z=0.9700316761883178]
>    [junit4]   1>   mappedPoint=[lat=1.3337152373863173, 
> lon=-5.6921031450828363E-213([X=0.2343840870847516, 
> Y=-1.334138399252484E-213, Z=0.9700316762323898])]
>    [junit4]   1> doc=303 should match but did not
>    [junit4]   1>   point=[X=0.12120594107288729, Y=2.3309121299774915E-10, 
> Z=0.9904226661241288]
>    [junit4]   1>   mappedPoint=[lat=1.4490238255501429, 
> lon=2.4457272005608357E-47([X=0.12120594090167151, Y=2.9643666653278715E-48, 
> Z=0.9904226661406688])]
>    [junit4]   1> doc=479 should match but did not
>    [junit4]   1>   point=[X=0.21420828008815918, Y=2.3309121299774915E-10, 
> Z=0.974654593795364]
>    [junit4]   1>   mappedPoint=[lat=1.3544571537806853, 
> lon=2.4457272005608357E-47([X=0.21420828010427287, Y=5.2389501723637466E-48, 
> Z=0.9746545936871422])]
>    [junit4]   1> doc=513 should match but did not
>    [junit4]   1>   point=[X=0.20747646693442123, Y=2.3309121299774915E-10, 
> Z=0.976100033897399]
>    [junit4]   1>   mappedPoint=[lat=1.361356816555577, 
> lon=2.4457272005608357E-47([X=0.20747646708772866, Y=5.07430839032723E-48, 
> Z=0.9761000340691431])]
>    [junit4]   1> doc=602 should match but did not
>    [junit4]   1>   point=[X=0.1885198457342102, Y=2.3309121299774915E-10, 
> Z=0.9799121264712828]
>    [junit4]   1>   mappedPoint=[lat=1.3807340292637948, 
> lon=2.4457272005608357E-47([X=0.18851984575419603, Y=4.6106811460657045E-48, 
> Z=0.9799121264737999])]
>    [junit4]   1> doc=722 should match but did not
>    [junit4]   1>   point=[X=0.1246621061616181, Y=2.3309121299774915E-10, 
> Z=0.9899964574426151]
>    [junit4]   1>   mappedPoint=[lat=1.4455338464779226, 
> lon=2.4457272005608357E-47([X=0.1246621062549677, Y=3.048895041469796E-48, 
> Z=0.9899964573672254])]
>    [junit4]   1> doc=763 should match but did not
>    [junit4]   1>   point=[X=0.22763237132881609, Y=-2.3309121299774915E-10, 
> Z=0.971627487161317]
>    [junit4]   1>   mappedPoint=[lat=1.3406672985164874, 
> lon=-5.567004318295207E-15([X=0.22763237129900588, Y=-1.2672303940053436E-15, 
> Z=0.971627487381394])]
>    [junit4]   1> doc=786 should match but did not
>    [junit4]   1>   point=[X=0.1555323782186121, Y=2.3309121299774915E-10, 
> Z=0.9856476094161765]
>    [junit4]   1>   mappedPoint=[lat=1.4142896695536051, 
> lon=0.0([X=0.1555323784076407, Y=0.0, Z=0.9856476093651012])]
>    [junit4]   1> doc=798 should match but did not
>    [junit4]   1>   point=[X=0.22207908739383908, Y=2.3309121299774915E-10, 
> Z=0.9729031972347834]
>    [junit4]   1>   mappedPoint=[lat=1.3463770376441213, 
> lon=0.0([X=0.2220790873239817, Y=0.0, Z=0.9729031972871128])]
>    [junit4]   1> doc=933 should match but did not
>    [junit4]   1>   point=[X=0.2361548047000931, Y=2.3309121299774915E-10, 
> Z=0.9696049910683647]
>    [junit4]   1>   mappedPoint=[lat=1.331890093345172, 
> lon=0.0([X=0.2361548045618497, Y=0.0, Z=0.9696049913006971])]
>    [junit4]   1> doc=1097 should match but did not
>    [junit4]   1>   point=[X=0.17156903922120204, Y=-2.3309121299774915E-10, 
> Z=0.9830008703471477]
>    [junit4]   1>   mappedPoint=[lat=1.3980009088259264, 
> lon=-1.639086675334973E-201([X=0.17156903914379532, 
> Y=-2.812165259606193E-202, Z=0.983000870561174])]
>    [junit4]   1> doc=1293 should match but did not
>    [junit4]   1>   point=[X=0.13247272092481832, Y=2.3309121299774915E-10, 
> Z=0.9889883971515679]
>    [junit4]   1>   mappedPoint=[lat=1.4376412078585403, 
> lon=2.4457272005608357E-47([X=0.13247272102463187, Y=3.239921371422495E-48, 
> Z=0.9889883969926163])]
>    [junit4]   1> doc=1375 should match but did not
>    [junit4]   1>   point=[X=0.21564004705963968, Y=-2.3309121299774915E-10, 
> Z=0.9743409332060463]
>    [junit4]   1>   mappedPoint=[lat=1.3529883743500268, 
> lon=-1.829240006021561E-158([X=0.2156400472266687, Y=-3.944574012874012E-159, 
> Z=0.9743409332980286])]
>    [junit4]   1> doc=1376 should match but did not
>    [junit4]   1>   point=[X=0.12693389936724297, Y=2.3309121299774915E-10, 
> Z=0.9897096736687033]
>    [junit4]   1>   mappedPoint=[lat=1.443239010492359, 
> lon=2.4457272005608357E-47([X=0.12693389941476824, Y=3.1044569047195174E-48, 
> Z=0.9897096735149449])]
>    [junit4]   1> doc=1458 should match but did not
>    [junit4]   1>   point=[X=0.26389889470295536, Y=2.3309121299774915E-10, 
> Z=0.9624724302524913]
>    [junit4]   1>   mappedPoint=[lat=1.3031846953285613, 
> lon=2.4457272005608357E-47([X=0.26389889476745054, Y=6.454247051306955E-48, 
> Z=0.9624724302171447])]
>    [junit4]   1> doc=1686 should match but did not
>    [junit4]   1>   point=[X=0.13005870525085317, Y=-2.3309121299774915E-10, 
> Z=0.9893066067489985]
>    [junit4]   1>   mappedPoint=[lat=1.4400814251559886, 
> lon=-1.6747638468238218E-206([X=0.13005870531118505, 
> Y=-2.178176176198861E-207, Z=0.9893066065572187])]
>    [junit4]   1> doc=1829 should match but did not
>    [junit4]   1>   point=[X=0.13581406528202644, Y=2.3309121299774915E-10, 
> Z=0.9885381185390353]
>    [junit4]   1>   mappedPoint=[lat=1.4342623030067558, 
> lon=0.0([X=0.13581406543593716, Y=0.0, Z=0.9885381186033142])]
>    [junit4]   1> doc=1958 should match but did not
>    [junit4]   1>   point=[X=0.21384294690637928, Y=2.3309121299774915E-10, 
> Z=0.9747342774250746]
>    [junit4]   1>   mappedPoint=[lat=1.3548318564540318, 
> lon=2.4457272005608357E-47([X=0.21384294699178844, Y=5.230015121059059E-48, 
> Z=0.9747342773324366])]
>    [junit4]   1> doc=1981 should match but did not
>    [junit4]   1>   point=[X=0.25949689721812896, Y=2.3309121299774915E-10, 
> Z=0.9636605949958151]
>    [junit4]   1>   mappedPoint=[lat=1.307753396763122, 
> lon=0.0([X=0.2594968974335508, Y=0.0, Z=0.9636605948394177])]
>    [junit4]   1> doc=2111 should match but did not
>    [junit4]   1>   point=[X=0.1657336888122819, Y=2.3309121299774915E-10, 
> Z=0.9839948244241666]
>    [junit4]   1>   mappedPoint=[lat=1.4039330187863033, 
> lon=0.0([X=0.16573368876190184, Y=0.0, Z=0.983994824536461])]
>    [junit4]   1> doc=2180 should match but did not
>    [junit4]   1>   point=[X=0.24421808241308163, Y=2.3309121299774915E-10, 
> Z=0.9676189275981865]
>    [junit4]   1>   mappedPoint=[lat=1.3235687998823915, 
> lon=1.0822122318786984E-166([X=0.24421808226412325, 
> Y=2.6429579587219238E-167, Z=0.967618927597835])]
>    [junit4]   1> doc=2628 should match but did not
>    [junit4]   1>   point=[X=0.18026294427859113, Y=2.3309121299774915E-10, 
> Z=0.9814542243713412]
>    [junit4]   1>   mappedPoint=[lat=1.3891515951653701, 
> lon=2.4457272005608357E-47([X=0.18026294435875917, Y=4.4087398627140175E-48, 
> Z=0.9814542242696033])]
>    [junit4]   1> doc=2794 should match but did not
>    [junit4]   1>   point=[X=0.19561541450839848, Y=2.3309121299774915E-10, 
> Z=0.978529695119763]
>    [junit4]   1>   mappedPoint=[lat=1.3734897209484462, 
> lon=2.4457272005608357E-47([X=0.19561541470871582, Y=4.784219406020945E-48, 
> Z=0.9785296949882676])]
>    [junit4]   1> doc=2814 should match but did not
>    [junit4]   1>   point=[X=0.2169693853608453, Y=2.3309121299774915E-10, 
> Z=0.9740477501459729]
>    [junit4]   1>   mappedPoint=[lat=1.3516242525980415, 
> lon=2.4457272005608357E-47([X=0.21696938523182926, Y=5.306479271504473E-48, 
> Z=0.974047750355191])]
>    [junit4]   1> doc=2897 should match but did not
>    [junit4]   1>   point=[X=0.2200405779345539, Y=2.3309121299774915E-10, 
> Z=0.9733631710432294]
>    [junit4]   1>   mappedPoint=[lat=1.3484711384140997, 
> lon=0.0([X=0.2200405779812659, Y=0.0, Z=0.9733631711488628])]
>    [junit4]   1> doc=2956 should match but did not
>    [junit4]   1>   point=[X=0.22448570568506854, Y=2.3309121299774915E-10, 
> Z=0.9723544184712797]
>    [junit4]   1>   mappedPoint=[lat=1.3439035240356338, 
> lon=0.0([X=0.22448570568557055, Y=0.0, Z=0.9723544182987026])]
>    [junit4]   1> doc=3138 should match but did not
>    [junit4]   1>   point=[X=0.23811188374411751, Y=2.3309121299774915E-10, 
> Z=0.9691294421050661]
>    [junit4]   1>   mappedPoint=[lat=1.3298719328775956, 
> lon=0.0([X=0.23811188357289037, Y=0.0, Z=0.9691294419974701])]
>    [junit4]   1> doc=3652 should match but did not
>    [junit4]   1>   point=[X=0.24214002157059256, Y=2.3309121299774915E-10, 
> Z=0.9681375443587282]
>    [junit4]   1>   mappedPoint=[lat=1.325714972537541, 
> lon=0.0([X=0.24214002163565146, Y=0.0, Z=0.9681375443529582])]
>    [junit4]   1> doc=3710 should match but did not
>    [junit4]   1>   point=[X=0.13912245240644638, Y=2.3309121299774915E-10, 
> Z=0.98808102154234]
>    [junit4]   1>   mappedPoint=[lat=1.4309152103876182, 
> lon=2.4457272005608357E-47([X=0.13912245255318162, Y=3.402555664180506E-48, 
> Z=0.9880810213144329])]
>    [junit4]   1> doc=3728 should match but did not
>    [junit4]   1>   point=[X=0.170488642335478, Y=2.3309121299774915E-10, 
> Z=0.98318756894984]
>    [junit4]   1>   mappedPoint=[lat=1.3990996683784152, 
> lon=0.0([X=0.17048864240253972, Y=0.0, Z=0.9831875688630223])]
>    [junit4]   1> doc=3950 should match but did not
>    [junit4]   1>   point=[X=0.18732329669995484, Y=2.3309121299774915E-10, 
> Z=0.9801400304724265]
>    [junit4]   1>   mappedPoint=[lat=1.3819546750439136, 
> lon=8.935716330912668E-164([X=0.18732329683085783, Y=1.6738678426518975E-164, 
> Z=0.9801400306878956])]
>    [junit4]   1> doc=4139 should match but did not
>    [junit4]   1>   point=[X=0.227719851393419, Y=-2.3309121299774915E-10, 
> Z=0.9716071257114968]
>    [junit4]   1>   mappedPoint=[lat=1.3405772942709289, 
> lon=-1.5440923848976664E-179([X=0.22771985146412338, 
> Y=-3.516204885357806E-180, Z=0.9716071256497173])]
>    [junit4]   1> doc=4282 should match but did not
>    [junit4]   1>   point=[X=0.21813564838761346, Y=2.3309121299774915E-10, 
> Z=0.9737889760107622]
>    [junit4]   1>   mappedPoint=[lat=1.3504271380754562, 
> lon=0.0([X=0.21813564824645176, Y=0.0, Z=0.9737889761680473])]
>    [junit4]   1> doc=5053 should match but did not
>    [junit4]   1>   point=[X=0.13887067566944988, Y=-2.3309121299774915E-10, 
> Z=0.9881162019991178]
>    [junit4]   1>   mappedPoint=[lat=1.4311699866353502, 
> lon=-3.4138983692749655E-99([X=0.1388706757894652, Y=-4.740903736177677E-100, 
> Z=0.9881162018393943])]
>    [junit4]   1> doc=5100 should match but did not
>    [junit4]   1>   point=[X=0.1819991176520509, Y=-2.3309121299774915E-10, 
> Z=0.9811359005592163]
>    [junit4]   1>   mappedPoint=[lat=1.3873827183881913, 
> lon=-1.749937721526353E-211([X=0.18199911780642491, 
> Y=-3.184871215339815E-212, Z=0.9811359003685468])]
>    [junit4]   1> doc=5171 should match but did not
>    [junit4]   1>   point=[X=0.18554822273395788, Y=2.3309121299774915E-10, 
> Z=0.9804753559576275]
>    [junit4]   1>   mappedPoint=[lat=1.3837649828222947, 
> lon=2.4457272005608357E-47([X=0.1855482229122976, Y=4.5380033579233156E-48, 
> Z=0.9804753558489193])]
>    [junit4]   2> NOTE: download the large Jenkins line-docs file by running 
> 'ant get-jenkins-line-docs' in the lucene directory.
>    [junit4]   2> NOTE: reproduce with: ant test  -Dtestcase=TestGeo3DPoint 
> -Dtests.method=testGeo3DRelations -Dtests.seed=B21A2F0654DE93CA 
> -Dtests.multiplier=2 -Dtests.nightly=true -Dtests.slow=true 
> -Dtests.linedocsfile=/home/jenkins/jenkins-slave/workspace/Lucene-Solr-NightlyTests-6.x/test-data/enwiki.random.lines.txt
>  -Dtests.locale=es-CU -Dtests.timezone=Europe/Brussels -Dtests.asserts=true 
> -Dtests.file.encoding=UTF-8
>    [junit4] FAILURE 4.13s J1 | TestGeo3DPoint.testGeo3DRelations <<<
>    [junit4]    > Throwable #1: java.lang.AssertionError: invalid hits for 
> shape=GeoCompositeMembershipShape: {[GeoConvexPolygon: 
> {planetmodel=PlanetModel.WGS84, points=[[lat=-1.2267098126036888, 
> lon=3.141592653589793([X=-0.33671029227864785, Y=4.123511816790159E-17, 
> Z=-0.9396354281810864])], [lat=0.2892272352400239, 
> lon=0.017453291479645996([X=0.9591279281485559, Y=0.01674163926221766, 
> Z=0.28545251693892165])], [lat=-1.5707963267948966, 
> lon=1.6247683074702402E-201([X=6.109531986173988E-17, 
> Y=9.926573944611206E-218, Z=-0.997762292022105])]], internalEdges={2}}, 
> GeoConvexPolygon: {planetmodel=PlanetModel.WGS84, 
> points=[[lat=-1.2267098126036888, 
> lon=3.141592653589793([X=-0.33671029227864785, Y=4.123511816790159E-17, 
> Z=-0.9396354281810864])], [lat=-1.5707963267948966, 
> lon=1.6247683074702402E-201([X=6.109531986173988E-17, 
> Y=9.926573944611206E-218, Z=-0.997762292022105])], [lat=0.6723906085905078, 
> lon=-3.0261581679831E-12([X=0.7821883235431606, Y=-2.367025584191143E-12, 
> Z=0.6227413298552851])]], internalEdges={0}}]}
>    [junit4]    >      at 
> __randomizedtesting.SeedInfo.seed([B21A2F0654DE93CA:2655292DB933D56]:0)
>    [junit4]    >      at 
> org.apache.lucene.spatial3d.TestGeo3DPoint.testGeo3DRelations(TestGeo3DPoint.java:464)
>    [junit4]    >      at java.lang.Thread.run(Thread.java:745)
>    [junit4]   2> NOTE: leaving temporary files on disk at: 
> /x1/jenkins/jenkins-slave/workspace/Lucene-Solr-NightlyTests-6.x/checkout/lucene/build/spatial3d/test/J1/temp/lucene.spatial3d.TestGeo3DPoint_B21A2F0654DE93CA-001
>    [junit4]   2> NOTE: test params are: codec=Asserting(Lucene62): 
> {id=Lucene50(blocksize=128)}, docValues:{id=DocValuesFormat(name=Memory), 
> point=DocValuesFormat(name=Lucene54)}, maxPointsInLeafNode=1433, 
> maxMBSortInHeap=5.739918094516457, 
> sim=RandomSimilarity(queryNorm=true,coord=yes): {}, locale=es-CU, 
> timezone=Europe/Brussels
>    [junit4]   2> NOTE: Linux 3.13.0-85-generic amd64/Oracle Corporation 
> 1.8.0_102 (64-bit)/cpus=4,threads=1,free=124827312,total=445120512
>    [junit4]   2> NOTE: All tests run in this JVM: [TestGeo3DPoint]
>    [junit4] Completed [10/11 (1!)] on J1 in 2615.65s, 14 tests, 1 failure <<< 
> FAILURES!
> {noformat}



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