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

Ignacio Vera commented on LUCENE-7938:
--------------------------------------

"there are indeed some rare cases where it is difficult to compute the bounding 
box and we return a larger box as a shortcut."

What I disagree is that computing the bounding box of a bounding box should not 
be difficult. There is another "fix"  for that to make sure a bounding box 
generates the same bounds of itself. Currently the method getBounds() for 
GeoRectangle does the following:

  @Override
  public void getBounds(Bounds bounds) {
    super.getBounds(bounds);
    bounds.addHorizontalPlane(planetModel, topLat, topPlane, bottomPlane, 
leftPlane, rightPlane)
      .addVerticalPlane(planetModel, rightLon, rightPlane, topPlane, 
bottomPlane, leftPlane)
      .addHorizontalPlane(planetModel, bottomLat, bottomPlane, topPlane, 
leftPlane, rightPlane)
      .addVerticalPlane(planetModel, leftLon, leftPlane, topPlane, bottomPlane, 
rightPlane)
      .addIntersection(planetModel, leftPlane, rightPlane, topPlane, 
bottomPlane)
      .addPoint(ULHC).addPoint(URHC).addPoint(LLHC).addPoint(LRHC);
  }

Probably it will be enoughif the method does the following:

  @Override
  public void getBounds(Bounds bounds) {
    super.getBounds(bounds);
    bounds.addPoint(ULHC).addPoint(URHC).addPoint(LLHC).addPoint(LRHC);
  }

As we know the bounds of this object are the points. No need to add the panes 
as they introduce numerical imprecision.

Cheers,

I. 

> Bounds of bounding box are not equal to bounding box
> ----------------------------------------------------
>
>                 Key: LUCENE-7938
>                 URL: https://issues.apache.org/jira/browse/LUCENE-7938
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Ignacio Vera
>            Assignee: Karl Wright
>            Priority: Minor
>         Attachments: LUCENE-7938-fix.patch, LUCENE-7938-test.patch
>
>
> Hi,
> It seems if I get the bounds of a BBox and I create a new bounding box, 
> sometimes both bounding box are not equal. It is a problem with precision.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to