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

This commit is contained in:
Karl Wright 2018-02-13 10:31:13 -05:00
parent 8a5a4a6317
commit dd08400a3d
2 changed files with 2 additions and 4 deletions

View File

@ -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;
}

View File

@ -52,7 +52,6 @@ public class RandomPlaneTest extends RandomGeo3dShapeGenerator {
}
}
@Ignore
@Test
@Repeat(iterations = 10)
public void testPlaneThreePointsAccuracy() {