LUCENE-8133: Increase MINIMUM_RESOLUTION to 1.5e-12.

This commit is contained in:
Karl Wright 2018-01-23 07:34:49 -05:00
parent bdfbe433a3
commit a7a28ec170
3 changed files with 22 additions and 2 deletions

View File

@ -190,6 +190,7 @@ public class SidedPlane extends Plane implements Membership {
@Override
public boolean isWithin(double x, double y, double z) {
double evalResult = evaluate(x, y, z);
//System.out.println(Math.abs(evalResult));
if (Math.abs(evalResult) < MINIMUM_RESOLUTION)
return true;
double sigNum = Math.signum(evalResult);

View File

@ -27,7 +27,7 @@ public class Vector {
* Values that are all considered to be essentially zero have a magnitude
* less than this.
*/
public static final double MINIMUM_RESOLUTION = 1.0e-12;
public static final double MINIMUM_RESOLUTION = 1.5e-12;
/**
* Angular version of minimum resolution.
*/

View File

@ -1029,5 +1029,24 @@ shape:
GeoPolygon polygon2 = GeoPolygonFactory.makeGeoConvexPolygon(PlanetModel.SPHERE,points,Collections.singletonList(hole));
assertEquals(polygon,polygon2);
}
@Test
public void testLUCENE8133() {
GeoPoint point1 = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434456), Geo3DUtil.fromDegrees(14.459204));
GeoPoint point2 = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.43394), Geo3DUtil.fromDegrees(14.459206));
GeoPoint check = new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434067), Geo3DUtil.fromDegrees(14.458927));
SidedPlane plane = new SidedPlane(check, point1, point2);
assertTrue(plane.isWithin(check));
assertTrue(plane.isWithin(point1));
assertTrue(plane.isWithin(point2));
//POLYGON((14.459204 -23.434456, 14.459206 -23.43394,14.458647 -23.434196, 14.458646 -23.434452,14.459204 -23.434456))
List<GeoPoint> points = new ArrayList<>();
points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434456), Geo3DUtil.fromDegrees(14.459204)));
points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees( -23.43394), Geo3DUtil.fromDegrees(14.459206)));
points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434196), Geo3DUtil.fromDegrees(14.458647)));
points.add(new GeoPoint(PlanetModel.SPHERE, Geo3DUtil.fromDegrees(-23.434452), Geo3DUtil.fromDegrees(14.458646)));
GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points);
}
}