You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by sh...@apache.org on 2017/09/18 16:24:46 UTC
[44/50] lucene-solr:feature/autoscaling: LUCENE-7906: Fix random
shape generator. Committed on behalf of Ignacio Vera.
LUCENE-7906: Fix random shape generator. Committed on behalf of Ignacio Vera.
Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/12b0acdf
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/12b0acdf
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/12b0acdf
Branch: refs/heads/feature/autoscaling
Commit: 12b0acdf7c03a905151300c9b635c23e9453e26d
Parents: b125107
Author: Karl Wright <Da...@gmail.com>
Authored: Thu Sep 14 03:51:54 2017 -0400
Committer: Karl Wright <Da...@gmail.com>
Committed: Thu Sep 14 03:51:54 2017 -0400
----------------------------------------------------------------------
.../geom/RandomGeo3dShapeGenerator.java | 20 +++++++-------------
1 file changed, 7 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/12b0acdf/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeo3dShapeGenerator.java
----------------------------------------------------------------------
diff --git a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeo3dShapeGenerator.java b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeo3dShapeGenerator.java
index 72b7109..d41bf1b 100644
--- a/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeo3dShapeGenerator.java
+++ b/lucene/spatial3d/src/test/org/apache/lucene/spatial3d/geom/RandomGeo3dShapeGenerator.java
@@ -174,13 +174,13 @@ public class RandomGeo3dShapeGenerator extends LuceneTestCase {
public GeoPoint randomGeoPoint(PlanetModel planetModel, Constraints constraints) {
int iterations = 0;
while (iterations < MAX_POINT_ITERATIONS) {
- double lat = randomDouble();
- if (Math.PI/2 - Math.abs(lat) <0){
- continue;
+ double lat = randomDouble() * Math.PI/2;
+ if (random().nextBoolean()) {
+ lat = (-1)*lat;
}
- double lon = randomDouble();
- if (Math.PI - Math.abs(lat) <0){
- continue;
+ double lon = randomDouble() * Math.PI;
+ if (random().nextBoolean()) {
+ lon = (-1)*lon;
}
iterations++;
GeoPoint point = new GeoPoint(planetModel, lat, lon);
@@ -810,13 +810,7 @@ public class RandomGeo3dShapeGenerator extends LuceneTestCase {
* @return the cutoff angle.
*/
private double randomCutoffAngle() {
- while(true) {
- double radius = randomDouble();
- if (radius <0 || radius > Math.PI){
- continue;
- }
- return radius;
- }
+ return randomDouble() * Math.PI;
}
/**