lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ignacio Vera (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (LUCENE-7938) Bounds of bounding box are not equal to bounding box
Date Tue, 22 Aug 2017 07:46:00 GMT

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

Ignacio Vera edited comment on LUCENE-7938 at 8/22/17 7:45 AM:
---------------------------------------------------------------

"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 about is that computing the bounding box of a bounding box should not be difficult.
Maybe there is a better implementation of getbounds() for GeoRectangle. Currently the method
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 enough if 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 planes as they introduce
numerical imprecision.

Cheers,

I. 


was (Author: ivera):
"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-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message