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 2018/02/13 15:31:22 UTC

lucene-solr:master: LUCENE-8171: Check only for exactly zero magnitude vector, and otherwise let the iterative code try to converge.

Repository: lucene-solr
Updated Branches:
  refs/heads/master 8a5a4a631 -> dd08400a3


LUCENE-8171: Check only for exactly zero magnitude vector, and otherwise let the iterative code try to converge.


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

Branch: refs/heads/master
Commit: dd08400a3db1c4119a704610ccc4db0d055d8d7f
Parents: 8a5a4a6
Author: Karl Wright <Da...@gmail.com>
Authored: Tue Feb 13 10:31:13 2018 -0500
Committer: Karl Wright <Da...@gmail.com>
Committed: Tue Feb 13 10:31:13 2018 -0500

----------------------------------------------------------------------
 .../src/java/org/apache/lucene/spatial3d/geom/Vector.java       | 5 ++---
 .../test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java  | 1 -
 2 files changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dd08400a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java
index 5209df8..62b3f5e 100755
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/Vector.java
@@ -106,10 +106,9 @@ public class Vector {
     final double thisZ = AX * BY - AY * BX;
     
     final double magnitude = magnitude(thisX, thisY, thisZ);
-    if (magnitude < MINIMUM_RESOLUTION) {
+    if (magnitude == 0.0) {
       throw new IllegalArgumentException("Degenerate/parallel vector constructed");
     }
-    
     final double inverseMagnitude = 1.0/magnitude;
     
     double normalizeX = thisX * inverseMagnitude;
@@ -215,7 +214,7 @@ public class Vector {
     final double thisZ = A.x * B.y - A.y * B.x;
     
     final double magnitude = magnitude(thisX, thisY, thisZ);
-    if (magnitude < MINIMUM_RESOLUTION) {
+    if (magnitude == 0.0) {
       return true;
     }
     

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/dd08400a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java
index 8c94c9c..d7828bd 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomPlaneTest.java
@@ -52,7 +52,6 @@ public class RandomPlaneTest extends RandomGeo3dShapeGenerator {
     }
   }
   
-  @Ignore
   @Test
   @Repeat(iterations = 10)
   public void testPlaneThreePointsAccuracy() {