LUCENE-8054: Fix exact circle construction to correct failing test.

This commit is contained in:
Karl Wright 2017-11-21 04:59:11 -05:00
parent 1794ff679e
commit 0516a58827
2 changed files with 10 additions and 3 deletions

View File

@ -99,8 +99,8 @@ class GeoExactCircle extends GeoBaseCircle {
edgePoint = eastPoint;
} else {
// z will be less than x or y, so ellipse is shorter than it is tall
slices.add(new ApproximationSlice(center, northPoint, Math.PI * 2.0, southPoint, Math.PI, eastPoint, Math.PI * 0.5));
slices.add(new ApproximationSlice(center, southPoint, Math.PI, northPoint, 0.0, westPoint, Math.PI * 1.5));
slices.add(new ApproximationSlice(center, northPoint, 0.0, southPoint, Math.PI, eastPoint, Math.PI * 0.5));
slices.add(new ApproximationSlice(center, southPoint, Math.PI, northPoint, Math.PI * 2.0, westPoint, Math.PI * 1.5));
edgePoint = northPoint;
}

View File

@ -500,6 +500,13 @@ public class GeoCircleTest extends LuceneTestCase {
assertTrue(success);
}
@Test
public void testLUCENE8054(){
GeoCircle circle1 = GeoCircleFactory.makeExactGeoCircle(PlanetModel.WGS84, -1.0394053553992673, -1.9037325881389144, 1.1546166170607672, 4.231100485201301E-4);
GeoCircle circle2 = GeoCircleFactory.makeExactGeoCircle(PlanetModel.WGS84, -1.3165961602008989, -1.887137823746273, 1.432516663588956, 3.172052880854355E-4);
// Relationship between circles must be different than DISJOINT as centers are closer than the radius.
int rel = circle1.getRelationship(circle2);
assertTrue(rel != GeoArea.DISJOINT);
}
}