mirror of https://github.com/apache/lucene.git
LUCENE-8065: Some exact circles near 90 degrees are still concave because of planet model, so throw an exception when we construct one of those.
This commit is contained in:
parent
cc8802e60e
commit
a514a12d0c
|
@ -221,7 +221,11 @@ class GeoExactCircle extends GeoBaseCircle {
|
|||
this.backBounds = backPlanes;
|
||||
}
|
||||
|
||||
this.edgePoints = new GeoPoint[]{edgePoint};
|
||||
this.edgePoints = new GeoPoint[]{edgePoint};
|
||||
|
||||
if (!isWithin(northPoint) || !isWithin(southPoint) || !isWithin(eastPoint) || !isWithin(westPoint)) {
|
||||
throw new IllegalArgumentException("Exact circle cannot be constructed this large given the planet model provided");
|
||||
}
|
||||
//System.out.println("Is edgepoint within? "+isWithin(edgePoint));
|
||||
}
|
||||
|
||||
|
|
|
@ -551,4 +551,19 @@ public class GeoCircleTest extends LuceneTestCase {
|
|||
assertEquals(westPoint.getLongitude(), bounds.getLeftLongitude(), 1e-2);
|
||||
assertEquals(eastPoint.getLongitude(), bounds.getRightLongitude(), 1e-2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLUCENE8065(){
|
||||
boolean isIllegal = false;
|
||||
try {
|
||||
GeoCircle circle1 = GeoCircleFactory.makeExactGeoCircle(PlanetModel.WGS84, 0.03186456479560385, -2.2254294002683617, 1.5702573535090856, 8.184299676008562E-6);
|
||||
} catch (IllegalArgumentException e) {
|
||||
isIllegal = true;
|
||||
}
|
||||
assertTrue(isIllegal);
|
||||
/*
|
||||
GeoCircle circle2 = GeoCircleFactory.makeExactGeoCircle(PlanetModel.WGS84, 0.03186456479560385, -2.2254294002683617 , 1.5698163157923914, 1.0E-5);
|
||||
assertTrue(circle1.getRelationship(circle2) != GeoArea.DISJOINT);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue