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

Karl Wright commented on LUCENE-6759:
-------------------------------------

[~mikemccand] ooh, this is interesting.  This test passes:

{code}
    // BKD failure
    points = new ArrayList<GeoPoint>();
    points.add(new GeoPoint(PlanetModel.WGS84, -0.36716183577912814, 
1.4836349969188696));
    points.add(new GeoPoint(PlanetModel.WGS84, 0.7846038240742979, 
-0.02743348424931823));
    points.add(new GeoPoint(PlanetModel.WGS84, -0.7376479402362607, 
-0.5072961758807019));
    points.add(new GeoPoint(PlanetModel.WGS84, -0.3760415907667887, 
1.4970455334565513));
    
    c = GeoPolygonFactory.makeGeoPolygon(PlanetModel.WGS84, points, 1);
    System.err.println("c="+c);
    
    point = new GeoPoint(PlanetModel.WGS84, -0.01580760332365284, 
-0.03956004622490505);
    assertTrue(c.isWithin(point));
    xyzb = new XYZBounds();
    c.getBounds(xyzb);
    area = GeoAreaFactory.makeGeoArea(PlanetModel.WGS84,
      xyzb.getMinimumX(), xyzb.getMaximumX(), xyzb.getMinimumY(), 
xyzb.getMaximumY(), xyzb.getMinimumZ(), xyzb.getMaximumZ());
    assertTrue(area.isWithin(point));
    System.err.println("area="+area);
{code}

The shape and the bounds it prints out look like this:

{code}
   [junit4] Started J0 PID(11304@localhost).
   [junit4] Suite: org.apache.lucene.geo3d.GeoPolygonTest
   [junit4]   2> c=GeoCompositeMembershipShape: {[GeoCompositeMembershipShape: 
{[GeoConvexPolygon: {planetmodel=PlanetModel.WGS84, 
points=[[lat=-0.36716183577912814, lon=1.4836349969188696], 
[lat=-0.7376479402362607, lon=-0.5072961758807019], [lat=-0.3760415907667887, 
lon=1.4970455334565513]]}]}, GeoConvexPolygon: {planetmodel=PlanetModel.WGS84, 
points=[[lat=0.7846038240742979, lon=-0.02743348424931823], 
[lat=-0.7376479402362607, lon=-0.5072961758807019], [lat=-0.36716183577912814, 
lon=1.4836349969188696]]}]}
   [junit4]   2> area=XYZSolid: {planetmodel=PlanetModel.WGS84, 
isWholeWorld=false, minXplane=[A=1.0, B=0.0, C=0.0, D=-0.06858082595452562, 
side=1.0], maxXplane=[A=1.0, B=0.0, C=0.0, D=-1.0011188430710465, side=-1.0], 
minYplane=[A=0.0, B=1.0, C=0.0, D=0.3602066444438738, side=1.0], 
maxYplane=[A=0.0, B=1.0, C=0.0, D=-0.9487384224599528, side=-1.0], 
minZplane=[A=0.0, B=0.0, C=1.0, D=0.7797276450646676, side=1.0], 
maxZplane=[A=0.0, B=0.0, C=1.0, D=-0.7061485118699775, side=-1.0]}
   [junit4] OK      0.06s | GeoPolygonTest.testPolygonBounds
   [junit4] Completed [1/1] in 0.11s, 1 test
{code}

Compare/contrast the XYZSolid bounds with the bounds that the bkd test printed 
before.  Note that the signs are flipped; D is the negative of the min/max 
values:

{code}
   [junit4]   1>   root cell: cell=35789 x: 147111611 TO 2147483647, y: 
-772673398 TO 2035123315, z: -1672581053 TO 1514747655, splits: 0
   [junit4]   1>   cycle: cell=35789 x: 147111611 TO 2147483647, y: -772673398 
TO 2035123315, z: -1672581053 TO 1514747655, splits: 0 queue.size()=0
   [junit4]   1>     minx=0.06858082567195825 maxx=1.0011188183041375 
miny=-0.3602066448989628 maxy=0.948738422799356 minz=-0.7797276453057644 
maxz=0.7061485123150968
{code}

So the Geo3d bounds are right, but when the root cell is constructed it's not 
actually using those bounds, but instead something smaller, probably because 
it's max'd (or min'd) out.  I suspected this might happen...

There are two ways forward.  First way: if the bounds exceeds the planetmodel 
max/min, set to Integer.MAX_VALUE or Integer.MIN_VALUE, respectively, rather 
than convert from the double.  That's easy to try.  If that doesn't work, then 
we have to change the encoding to allow for a slightly larger value.


> Integrate lat/long BKD and spatial 3d, part 2
> ---------------------------------------------
>
>                 Key: LUCENE-6759
>                 URL: https://issues.apache.org/jira/browse/LUCENE-6759
>             Project: Lucene - Core
>          Issue Type: New Feature
>            Reporter: Michael McCandless
>         Attachments: LUCENE-6699.patch, LUCENE-6699.patch, LUCENE-6699.patch, 
> LUCENE-6699.patch, LUCENE-6699.patch, LUCENE-6699.patch, LUCENE-6699.patch, 
> LUCENE-6699.patch, LUCENE-6699.patch, LUCENE-6699.patch, LUCENE-6699.patch
>
>
> This is just a continuation of LUCENE-6699, which became too big.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to