Revert "Fix AAIOOBE in GeoTestUtil."

This reverts commit c3e813188e.
This commit is contained in:
Adrien Grand 2018-08-01 15:44:47 +02:00
parent c3e813188e
commit 86a39fa29f
1 changed files with 3 additions and 3 deletions

View File

@ -245,7 +245,7 @@ public class GeoTestUtil {
return new double[] { nextLatitudeBetween(polygon.minLat, polygon.maxLat), nextLongitudeBetween(polygon.minLon, polygon.maxLon) };
} else if (surpriseMe < 20) {
// target a vertex
int vertex = randomInt(polyLats.length - 2);
int vertex = randomInt(polyLats.length - 1);
return new double[] { nextLatitudeNear(polyLats[vertex], polyLats[vertex+1] - polyLats[vertex]),
nextLongitudeNear(polyLons[vertex], polyLons[vertex+1] - polyLons[vertex]) };
} else if (surpriseMe < 30) {
@ -253,12 +253,12 @@ public class GeoTestUtil {
Polygon container = boxPolygon(new Rectangle(polygon.minLat, polygon.maxLat, polygon.minLon, polygon.maxLon));
double containerLats[] = container.getPolyLats();
double containerLons[] = container.getPolyLons();
int startVertex = randomInt(containerLats.length - 2);
int startVertex = randomInt(containerLats.length - 1);
return nextPointAroundLine(containerLats[startVertex], containerLons[startVertex],
containerLats[startVertex+1], containerLons[startVertex+1]);
} else {
// target points around diagonals between vertices
int startVertex = randomInt(polyLats.length - 2);
int startVertex = randomInt(polyLats.length - 1);
// but favor edges heavily
int endVertex = randomBoolean() ? startVertex + 1 : randomInt(polyLats.length - 1);
return nextPointAroundLine(polyLats[startVertex], polyLons[startVertex],