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:56:40 UTC

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

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x a4cc08278 -> 1968c6779


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/1968c677
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/1968c677
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/1968c677

Branch: refs/heads/branch_6x
Commit: 1968c67790b9b4405b993d290e2e04e3baef6751
Parents: a4cc082
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:49:29 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/1968c677/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);