You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by kw...@apache.org on 2017/05/24 13:46:35 UTC

lucene-solr:master: LUCENE-7849: GeoWideLongitudeSlice can fail to construct

Repository: lucene-solr
Updated Branches:
  refs/heads/master 851ab0ad3 -> fed7343d2


LUCENE-7849: GeoWideLongitudeSlice can fail to construct


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/fed7343d
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/fed7343d
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/fed7343d

Branch: refs/heads/master
Commit: fed7343d2ea8136126084517ade408faaff279f2
Parents: 851ab0a
Author: Karl Wright <Da...@gmail.com>
Authored: Wed May 24 09:46:15 2017 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Wed May 24 09:46:15 2017 -0400

----------------------------------------------------------------------
 .../apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/fed7343d/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java
index f208266..705d961 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/GeoWideLongitudeSlice.java
@@ -75,7 +75,13 @@ class GeoWideLongitudeSlice extends GeoBaseBBox {
     while (leftLon > rightLon) {
       rightLon += Math.PI * 2.0;
     }
-    final double middleLon = (leftLon + rightLon) * 0.5;
+    double middleLon = (leftLon + rightLon) * 0.5;
+    while (middleLon > Math.PI) {
+        middleLon -= Math.PI * 2.0;
+    }
+    while (middleLon < -Math.PI) {
+        middleLon += Math.PI * 2.0;
+    }
     this.centerPoint = new GeoPoint(planetModel, 0.0, middleLon);
 
     this.leftPlane = new SidedPlane(centerPoint, cosLeftLon, sinLeftLon);