ellipsoid tessellation sometimes fails with either NullPointerException or Apache Commons Math exceptions
When the tolerance with which the geographic zone is defined is too
large (1.0e-6 or above in the examples),
tessallation fails. In some cases a NullPointerException is triggered in
EllipsoidTessellator.recurseMeetInside,
in other cases an Apache Commons Math exception is triggered.
One such case is tesselating the following zone, tolerance at 1.0e-6
triggers the NPE, tolerance at 1.0e-4
triggers the Apache Commons Math exception.
final ConstantAzimuthAiming aiming = new
ConstantAzimuthAiming(ellipsoid,
FastMath.toRadians(-168.178485));
EllipsoidTessellator tessellator =
new EllipsoidTessellator(ellipsoid, aiming, 16);
SphericalPolygonsSet small = buildSimpleZone(tolerance, new
double[][]{
{ -0.01048739, 0.01598931 }, { -0.00789627, 0.01555693 }, { -0.00558595,
0.01430664 },
{ -0.00380677, 0.01237394 }, { -0.00275154, 0.00996826 }, { -0.00253461,
0.00735029 },
{ -0.00317949, 0.00480374 }, { -0.00461629, 0.00260455 }, { -0.00668931,
0.00099105 },
{ -0.00917392, 0.00013808 }, { -0.01180086, 0.00013808 }, { -0.01428546,
0.00099105 },
{ -0.01635849, 0.00260455 }, { -0.01779529, 0.00480374 }, { -0.01844016,
0.00735029 },
{ -0.01822323, 0.00996826 }, { -0.01716800, 0.01237394 }, { -0.01538882,
0.01430664 },
{ -0.01307850, 0.01555693 }
});
final double maxWidth = 40000.0;
final double maxLength = 40000.0;
final List<List>tiles =
tessellator.tessellate(small, maxWidth, maxLength, 0, 0, false, true);
where buildSimpleZone is the utility method from EllipsoidTessellatorTest.
(from redmine: issue id 215, created on 2015-09-06, closed on 2016-02-10)