You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by iv...@apache.org on 2022/04/27 05:33:55 UTC
[lucene] branch main updated: LUCENE-10508: Fix error for rectangles with an extent close to 180 degrees (#824)
This is an automated email from the ASF dual-hosted git repository.
ivera pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 2b20b3f2ca0 LUCENE-10508: Fix error for rectangles with an extent close to 180 degrees (#824)
2b20b3f2ca0 is described below
commit 2b20b3f2ca03eaca97f30342aa63e3b019bdc0b6
Author: Ignacio Vera <iv...@apache.org>
AuthorDate: Wed Apr 27 07:33:49 2022 +0200
LUCENE-10508: Fix error for rectangles with an extent close to 180 degrees (#824)
This commit introduces a GeoWideRectangle.MIN_WIDE_EXTENT that takes into account the angular resolution
in order to build a GeoWideRectangle.
---
.../src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java | 2 +-
.../src/java/org/apache/lucene/spatial3d/geom/GeoWideRectangle.java | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
index 3d73fb1fd84..6aa9a80da03 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoBBoxFactory.java
@@ -98,7 +98,7 @@ public class GeoBBoxFactory {
return new GeoDegenerateVerticalLine(planetModel, topLat, bottomLat, leftLon);
}
// System.err.println(" not vertical line");
- if (extent >= Math.PI) {
+ if (extent >= GeoWideRectangle.MIN_WIDE_EXTENT) {
if (latitudesEquals(topLat, bottomLat)) {
if (isNorthPole(topLat)) {
return new GeoDegeneratePoint(planetModel, topLat, 0.0);
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideRectangle.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideRectangle.java
index 227a9d0bb14..e6f9a0d93fe 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideRectangle.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideRectangle.java
@@ -26,6 +26,10 @@ import java.io.OutputStream;
* @lucene.internal
*/
class GeoWideRectangle extends GeoBaseBBox {
+
+ /** Minimum extent for a rectangle of this type */
+ public static final double MIN_WIDE_EXTENT = Math.PI - Vector.MINIMUM_ANGULAR_RESOLUTION;
+
/** The top latitude */
protected final double topLat;
/** The bottom latitude */
@@ -111,7 +115,7 @@ class GeoWideRectangle extends GeoBaseBBox {
if (extent < 0.0) {
extent += 2.0 * Math.PI;
}
- if (extent < Math.PI) {
+ if (extent < MIN_WIDE_EXTENT) {
throw new IllegalArgumentException("Width of rectangle too small");
}