lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dsmi...@apache.org
Subject svn commit: r1683102 [3/3] - in /lucene/dev/branches/branch_5x: ./ lucene/ lucene/spatial/ lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/ lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/ lucene/spatial/src/test/org/apach...
Date Tue, 02 Jun 2015 13:16:11 GMT
Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Plane.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Plane.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Plane.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Plane.java Tue Jun  2 13:16:09 2015
@@ -51,11 +51,12 @@ public class Plane extends Vector {
   /**
    * Construct a horizontal plane at a specified Z.
    *
-   * @param height is the specified Z coordinate.
+   * @param planetModel is the planet model.
+   * @param sinLat is the sin(latitude).
    */
-  public Plane(final double height) {
+  public Plane(final PlanetModel planetModel, final double sinLat) {
     super(0.0, 0.0, 1.0);
-    D = -height;
+    D = -sinLat * computeDesiredEllipsoidMagnitude(planetModel, sinLat);
   }
 
   /**
@@ -81,6 +82,15 @@ public class Plane extends Vector {
     this.D = D;
   }
 
+  /** Construct a normalized, vertical plane through an x-y point.  If the x-y point is at (0,0), return null.
+  */
+  public static Plane constructNormalizedVerticalPlane(final double x, final double y) {
+    if (Math.abs(x) < MINIMUM_RESOLUTION && Math.abs(y) < MINIMUM_RESOLUTION)
+      return null;
+    final double denom = 1.0 / Math.sqrt(x*x + y*y);
+    return new Plane(x * denom, y * denom);
+  }
+  
   /**
    * Evaluate the plane equation for a given point, as represented
    * by a vector.
@@ -290,14 +300,26 @@ public class Plane extends Vector {
   }
 
   /**
+   * Public version of findIntersections.
+   */
+  public GeoPoint[] findIntersections(final PlanetModel planetModel, final Plane q, final Membership... bounds) {
+    if (isNumericallyIdentical(q)) {
+      return null;
+    }
+    return findIntersections(planetModel, q, bounds, NO_BOUNDS);
+  }
+  
+  /**
    * Find the intersection points between two planes, given a set of bounds.
    *
+   * @param planetModel is the planet model to use in finding points.
    * @param q          is the plane to intersect with.
    * @param bounds     is the set of bounds.
    * @param moreBounds is another set of bounds.
    * @return the intersection point(s) on the unit sphere, if there are any.
    */
-  protected GeoPoint[] findIntersections(final Plane q, final Membership[] bounds, final Membership[] moreBounds) {
+  protected GeoPoint[] findIntersections(final PlanetModel planetModel, final Plane q, final Membership[] bounds, final Membership[] moreBounds) {
+    //System.err.println("Looking for intersection between plane "+this+" and plane "+q+" within bounds");
     final Vector lineVector = new Vector(this, q);
     if (Math.abs(lineVector.x) < MINIMUM_RESOLUTION && Math.abs(lineVector.y) < MINIMUM_RESOLUTION && Math.abs(lineVector.z) < MINIMUM_RESOLUTION) {
       // Degenerate case: parallel planes
@@ -363,16 +385,18 @@ public class Plane extends Vector {
       z0 = 0.0;
     }
 
-    // Once an intersecting line is determined, the next step is to intersect that line with the unit sphere, which
+    // Once an intersecting line is determined, the next step is to intersect that line with the ellipsoid, which
     // will yield zero, one, or two points.
-    // The equation of the sphere is: 1.0 = x^2 + y^2 + z^2.  Plugging in the parameterized line values yields:
-    // 1.0 = (At+A0)^2 + (Bt+B0)^2 + (Ct+C0)^2
-    // A^2 t^2 + 2AA0t + A0^2 + B^2 t^2 + 2BB0t + B0^2 + C^2 t^2 + 2CC0t + C0^2 - 1,0 = 0.0
-    // [A^2 + B^2 + C^2] t^2 + [2AA0 + 2BB0 + 2CC0] t + [A0^2 + B0^2 + C0^2 - 1,0] = 0.0
+    // The ellipsoid equation: 1,0 = x^2/a^2 + y^2/b^2 + z^2/c^2
+    // 1.0 = (At+A0)^2/a^2 + (Bt+B0)^2/b^2 + (Ct+C0)^2/c^2
+    // A^2 t^2 / a^2 + 2AA0t / a^2 + A0^2 / a^2 + B^2 t^2 / b^2 + 2BB0t / b^2 + B0^2 / b^2 + C^2 t^2 / c^2 + 2CC0t / c^2 + C0^2 / c^2  - 1,0 = 0.0
+    // [A^2 / a^2 + B^2 / b^2 + C^2 / c^2] t^2 + [2AA0 / a^2 + 2BB0 / b^2 + 2CC0 / c^2] t + [A0^2 / a^2 + B0^2 / b^2 + C0^2 / c^2 - 1,0] = 0.0
     // Use the quadratic formula to determine t values and candidate point(s)
-    final double A = lineVector.x * lineVector.x + lineVector.y * lineVector.y + lineVector.z * lineVector.z;
-    final double B = 2.0 * (lineVector.x * x0 + lineVector.y * y0 + lineVector.z * z0);
-    final double C = x0 * x0 + y0 * y0 + z0 * z0 - 1.0;
+    final double A = lineVector.x * lineVector.x * planetModel.inverseAbSquared +
+      lineVector.y * lineVector.y * planetModel.inverseAbSquared +
+      lineVector.z * lineVector.z * planetModel.inverseCSquared;
+    final double B = 2.0 * (lineVector.x * x0 * planetModel.inverseAbSquared + lineVector.y * y0 * planetModel.inverseAbSquared + lineVector.z * z0 * planetModel.inverseCSquared);
+    final double C = x0 * x0 * planetModel.inverseAbSquared + y0 * y0 * planetModel.inverseAbSquared + z0 * z0 * planetModel.inverseCSquared - 1.0;
 
     final double BsquaredMinus = B * B - 4.0 * A * C;
     if (Math.abs(BsquaredMinus) < MINIMUM_RESOLUTION_SQUARED) {
@@ -381,6 +405,8 @@ public class Plane extends Vector {
       // One solution only
       final double t = -B * inverse2A;
       GeoPoint point = new GeoPoint(lineVector.x * t + x0, lineVector.y * t + y0, lineVector.z * t + z0);
+      //System.err.println("  point: "+point);
+      //verifyPoint(planetModel, point, q);
       if (point.isWithin(bounds, moreBounds))
         return new GeoPoint[]{point};
       return NO_POINTS;
@@ -393,6 +419,8 @@ public class Plane extends Vector {
       final double t2 = (-B - sqrtTerm) * inverse2A;
       GeoPoint point1 = new GeoPoint(lineVector.x * t1 + x0, lineVector.y * t1 + y0, lineVector.z * t1 + z0);
       GeoPoint point2 = new GeoPoint(lineVector.x * t2 + x0, lineVector.y * t2 + y0, lineVector.z * t2 + z0);
+      //verifyPoint(planetModel, point1, q);
+      //verifyPoint(planetModel, point2, q);
       //System.err.println("  "+point1+" and "+point2);
       if (point1.isWithin(bounds, moreBounds)) {
         if (point2.isWithin(bounds, moreBounds))
@@ -408,18 +436,30 @@ public class Plane extends Vector {
     }
   }
 
+  /*
+  protected void verifyPoint(final PlanetModel planetModel, final GeoPoint point, final Plane q) {
+    if (!evaluateIsZero(point))
+      throw new RuntimeException("Intersection point not on original plane; point="+point+", plane="+this);
+    if (!q.evaluateIsZero(point))
+      throw new RuntimeException("Intersection point not on intersected plane; point="+point+", plane="+q);
+    if (Math.abs(point.x * point.x * planetModel.inverseASquared + point.y * point.y * planetModel.inverseBSquared + point.z * point.z * planetModel.inverseCSquared - 1.0) >= MINIMUM_RESOLUTION) 
+      throw new RuntimeException("Intersection point not on ellipsoid; point="+point);
+  }
+  */
+  
   /**
    * Accumulate bounds information for this plane, intersected with another plane
    * and with the unit sphere.
    * Updates both latitude and longitude information, using max/min points found
    * within the specified bounds.
    *
+   * @param planetModel is the planet model to use to determine bounding points
    * @param q          is the plane to intersect with.
    * @param boundsInfo is the info to update with additional bounding information.
    * @param bounds     are the surfaces delineating what's inside the shape.
    */
-  public void recordBounds(final Plane q, final Bounds boundsInfo, final Membership... bounds) {
-    final GeoPoint[] intersectionPoints = findIntersections(q, bounds, NO_BOUNDS);
+  public void recordBounds(final PlanetModel planetModel, final Plane q, final Bounds boundsInfo, final Membership... bounds) {
+    final GeoPoint[] intersectionPoints = findIntersections(planetModel, q, bounds, NO_BOUNDS);
     for (GeoPoint intersectionPoint : intersectionPoints) {
       boundsInfo.addPoint(intersectionPoint);
     }
@@ -430,10 +470,11 @@ public class Plane extends Vector {
    * Updates both latitude and longitude information, using max/min points found
    * within the specified bounds.
    *
+   * @param planetModel is the planet model to use in determining bounds.
    * @param boundsInfo is the info to update with additional bounding information.
    * @param bounds     are the surfaces delineating what's inside the shape.
    */
-  public void recordBounds(final Bounds boundsInfo, final Membership... bounds) {
+  public void recordBounds(final PlanetModel planetModel, final Bounds boundsInfo, final Membership... bounds) {
     // For clarity, load local variables with good names
     final double A = this.x;
     final double B = this.y;
@@ -442,236 +483,27 @@ public class Plane extends Vector {
     // Now compute latitude min/max points
     if (!boundsInfo.checkNoTopLatitudeBound() || !boundsInfo.checkNoBottomLatitudeBound()) {
       //System.err.println("Looking at latitude for plane "+this);
+      // With ellipsoids, we really have only one viable way to do this computation.
+      // Specifically, we compute an appropriate vertical plane, based on the current plane's x-y orientation, and
+      // then intersect it with this one and with the ellipsoid.  This gives us zero, one, or two points to use
+      // as bounds.
+      // There is one special case: horizontal circles.  These require TWO vertical planes: one for the x, and one for
+      // the y, and we use all four resulting points in the bounds computation.
       if ((Math.abs(A) >= MINIMUM_RESOLUTION || Math.abs(B) >= MINIMUM_RESOLUTION)) {
-        //System.out.println("A = "+A+" B = "+B+" C = "+C+" D = "+D);
-        // sin (phi) = z
-        // cos (theta - phi) = D
-        // sin (theta) = C  (the dot product of (0,0,1) and (A,B,C) )
-        // Q: what is z?
-        //
-        // cos (theta-phi) = cos(theta)cos(phi) + sin(theta)sin(phi) = D
-
-        if (Math.abs(C) < MINIMUM_RESOLUTION) {
-          // Special case: circle is vertical.
-          //System.err.println(" Degenerate case; it's vertical circle");
-          // cos(phi) = D, and we want sin(phi) = z
-          // There are two solutions for phi given cos(phi) = D: a positive solution and a negative solution.
-          // So, when we compute z = sqrt(1-D^2), it's really z = +/- sqrt(1-D^2) .
-
-          double z;
-          double x;
-          double y;
-
-          final double denom = 1.0 / (A * A + B * B);
-
-          z = Math.sqrt(1.0 - D * D);
-          y = -B * D * denom;
-          x = -A * D * denom;
-          addPoint(boundsInfo, bounds, x, y, z);
-
-          z = -z;
-          addPoint(boundsInfo, bounds, x, y, z);
-        } else if (Math.abs(D) < MINIMUM_RESOLUTION) {
-          //System.err.println(" Plane through origin case");
-          // The general case is degenerate when the plane goes through the origin.
-          // Luckily there's a pretty good way to figure out the max and min for that case though.
-          // We find the two z values by computing the angle of the plane's inclination with the normal.
-          // E.g., if this.z == 1, then our z value is 0, and if this.z == 0, our z value is 1.
-          // Also if this.z == -1, then z value is 0 again.
-          // Another way of putting this is that our z = sqrt(this.x^2 + this.y^2).
-          //
-          // The only tricky part is computing x and y.
-          double z;
-          double x;
-          double y;
-
-          final double denom = 1.0 / (A * A + B * B);
-
-          z = Math.sqrt((A * A + B * B) / (A * A + B * B + C * C));
-          y = -B * (C * z) * denom;
-          x = -A * (C * z) * denom;
-          addPoint(boundsInfo, bounds, x, y, z);
-
-          z = -z;
-          y = -B * (C * z) * denom;
-          x = -A * (C * z) * denom;
-          addPoint(boundsInfo, bounds, x, y, z);
-
-        } else {
-          //System.err.println(" General latitude case");
-          // We might be able to identify a specific new latitude maximum or minimum.
-          //
-          // cos (theta-phi) = cos(theta)cos(phi) + sin(theta)sin(phi) = D
-          //
-          // This is tricky.  If cos(phi) = something, and we want to figure out
-          // what sin(phi) is, in order to capture all solutions we need to recognize
-          // that sin(phi) = +/- sqrt(1 - cos(phi)^2).  Basically, this means that
-          // whatever solution we find we have to mirror it across the x-y plane,
-          // and include both +z and -z solutions.
-          //
-          // cos (phi) = +/- sqrt(1-sin(phi)^2) = +/- sqrt(1-z^2)
-          // cos (theta) = +/- sqrt(1-sin(theta)^2) = +/- sqrt(1-C^2)
-          //
-          // D = cos(theta)cos(phi) + sin(theta)sin(phi)
-          // Substitute:
-          // D = sqrt(1-C^2) * sqrt(1-z^2) -/+ C * z
-          // Solve for z...
-          // D +/- Cz = sqrt(1-C^2)*sqrt(1-z^2) = sqrt(1 - z^2 - C^2 + z^2*C^2)
-          // Square both sides.
-          // (D +/- Cz)^2 = 1 - z^2 - C^2 + z^2*C^2
-          // D^2 +/- 2DCz + C^2*z^2 = 1 - z^2 - C^2 + z^2*C^2
-          // D^2 +/- 2DCz  = 1 - C^2 - z^2
-          // 0 = z^2 +/- 2DCz + (C^2 +D^2-1) = 0
-          //
-          // z = (+/- 2DC +/- sqrt(4*D^2*C^2 - 4*(C^2+D^2-1))) / (2)
-          // z  = +/- DC +/- sqrt(D^2*C^2 + 1 - C^2 - D^2 )
-          //    = +/- DC +/- sqrt(D^2*C^2 + 1 - C^2 - D^2)
-          //
-          // NOTE WELL: The above is clearly degenerate when D = 0.  So we'll have to
-          // code a different solution for that case!
-
-          // To get x and y, we need to plug z into the equations, as follows:
-          //
-          // Ax + By = -Cz - D
-          // x^2 + y^2 = 1 - z^2
-          //
-          // x = (-Cz -D -By) /A
-          // y = (-Cz -D -Ax) /B
-          //
-          // [(-Cz -D -By) /A]^2 + y^2 = 1 - z^2
-          // [-Cz -D -By]^2 + A^2*y^2 = A^2 - A^2*z^2
-          // C^2*z^2 + D^2 + B^2*y^2 + 2CDz + 2CBzy + 2DBy + A^2*y^2 - A^2 + A^2*z^2 = 0
-          // y^2 [A^2 + B^2]  + y [2DB + 2CBz] + [C^2*z^2 + D^2 + 2CDz - A^2 + A^2*z^2] = 0
-          //
-          //
-          // Use quadratic formula, where:
-          // a = [A^2 + B^2]
-          // b = [2BD + 2CBz]
-          // c = [C^2*z^2 + D^2 + 2CDz - A^2 + A^2*z^2]
-          //
-          // y = (-[2BD + 2CBz] +/- sqrt([2BD + 2CBz]^2 - 4 * [A^2 + B^2] * [C^2*z^2 + D^2 + 2CDz - A^2 + A^2*z^2]) ) / (2 * [A^2 + B^2])
-          // Take out a 2:
-          // y = (-[DB +CBz] +/- sqrt([DB + CBz]^2 - [A^2 + B^2] * [C^2*z^2 + D^2 + 2CDz - A^2 + A^2*z^2]) ) / [A^2 + B^2]
-          //
-          // The sqrt term simplifies:
-          //
-          // B^2*D^2 + C^2*B^2*z^2 + 2C*D*B^2*z - [A^2 + B^2] * [C^2*z^2 + D^2 + 2CDz - A^2 + A^2*z^2] = ?
-          // B^2*D^2 + C^2*B^2*z^2 + 2C*D*B^2*z - [A^2 * C^2 * z^2 + A^2 * D^2 + 2 * A^2 * CDz - A^4 + A^4*z^2
-          //                  + B^2 * C^2 * z^2 + B^2 * D^2 + 2 * B^2 * CDz - A^2 * B^2 + B^2 * A^2 * z^2] =?
-          // C^2*B^2*z^2 + 2C*D*B^2*z - [A^2 * C^2 * z^2 + A^2 * D^2 + 2 * A^2 * CDz - A^4 + A^4*z^2
-          //                  + B^2 * C^2 * z^2 + 2 * B^2 * CDz - A^2 * B^2 + B^2 * A^2 * z^2] =?
-          // 2C*D*B^2*z - [A^2 * C^2 * z^2 + A^2 * D^2 + 2 * A^2 * CDz - A^4 + A^4*z^2
-          //                  + 2 * B^2 * CDz - A^2 * B^2 + B^2 * A^2 * z^2] =?
-          // - [A^2 * C^2 * z^2 + A^2 * D^2 + 2 * A^2 * CDz - A^4 + A^4*z^2
-          //                  - A^2 * B^2 + B^2 * A^2 * z^2] =?
-          // - A^2 * [C^2 * z^2 + D^2 + 2 * CDz - A^2 + A^2*z^2
-          //                  - B^2 + B^2 * z^2] =?
-          // - A^2 * [z^2[A^2 + B^2 + C^2] - [A^2 + B^2 - D^2] + 2CDz] =?
-          // - A^2 * [z^2 - [A^2 + B^2 - D^2] + 2CDz] =?
-          //
-          // y = (-[DB +CBz] +/- A*sqrt([A^2 + B^2 - D^2] - z^2 - 2CDz) ) / [A^2 + B^2]
-          //
-          // correspondingly:
-          // x = (-[DA +CAz] +/- B*sqrt([A^2 + B^2 - D^2] - z^2 - 2CDz) ) / [A^2 + B^2]
-          //
-          // However, for the maximum or minimum we seek, the clause inside the sqrt should be zero.  If
-          // it is NOT zero, then we aren't looking at the right z value.
-
-          double z;
-          double x;
-          double y;
-
-          double sqrtValue = D * D * C * C + 1.0 - C * C - D * D;
-          double denom = 1.0 / (A * A + B * B);
-          if (Math.abs(sqrtValue) < MINIMUM_RESOLUTION_SQUARED) {
-            //System.err.println(" One latitude solution");
-            double insideValue;
-            double sqrtTerm;
-
-            z = D * C;
-            // Since we squared both sides of the equation, we may have introduced spurious solutions, so we have to check.
-            // But the same check applies to BOTH solutions -- the +z one as well as the -z one.
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-            // Check the solution on the other side of the x-y plane
-            z = -z;
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-          } else if (sqrtValue > 0.0) {
-            //System.err.println(" Two latitude solutions");
-            double sqrtResult = Math.sqrt(sqrtValue);
-
-            double insideValue;
-            double sqrtTerm;
-
-            z = D * C + sqrtResult;
-            //System.out.println("z= "+z+" D-C*z = " + (D-C*z) + " Math.sqrt(1.0 - z*z - C*C + z*z*C*C) = "+(Math.sqrt(1.0 - z*z - C*C + z*z*C*C)));
-            // Since we squared both sides of the equation, we may have introduced spurios solutions, so we have to check.
-            // But the same check applies to BOTH solutions -- the +z one as well as the -z one.
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            //System.err.println(" z="+z+" C="+C+" D="+D+" inside value "+insideValue);
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-            // Check the solution on the other side of the x-y plane
-            z = -z;
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            //System.err.println(" z="+z+" C="+C+" D="+D+" inside value "+insideValue);
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-            z = D * C - sqrtResult;
-            //System.out.println("z= "+z+" D-C*z = " + (D-C*z) + " Math.sqrt(1.0 - z*z - C*C + z*z*C*C) = "+(Math.sqrt(1.0 - z*z - C*C + z*z*C*C)));
-            // Since we squared both sides of the equation, we may have introduced spurios solutions, so we have to check.
-            // But the same check applies to BOTH solutions -- the +z one as well as the -z one.
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            //System.err.println(" z="+z+" C="+C+" D="+D+" inside value "+insideValue);
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-            // Check the solution on the other side of the x-y plane
-            z = -z;
-            insideValue = A * A + B * B - D * D - z * z - 2.0 * C * D * z;
-            //System.err.println(" z="+z+" C="+C+" D="+D+" inside value "+insideValue);
-            if (Math.abs(insideValue) < MINIMUM_RESOLUTION) {
-              y = -B * (D + C * z) * denom;
-              x = -A * (D + C * z) * denom;
-              if (evaluateIsZero(x, y, z)) {
-                addPoint(boundsInfo, bounds, x, y, z);
-              }
-            }
-          }
+        // NOT a horizontal circle!
+        //System.err.println(" Not a horizontal circle");
+        final Plane verticalPlane = constructNormalizedVerticalPlane(A,B);
+        final GeoPoint[] points = findIntersections(planetModel, verticalPlane, NO_BOUNDS, NO_BOUNDS);
+        for (final GeoPoint point : points) {
+          addPoint(boundsInfo, bounds, point.x, point.y, point.z);
         }
       } else {
-        // Horizontal circle.
-        // Since the recordBounds() method will be called ONLY for planes that constitute edges of a shape,
-        // we can be sure that some part of the horizontal circle will be part of the boundary, so we don't need
-        // to check Membership objects.
-        boundsInfo.addHorizontalCircle(-D * C);
+        // Horizontal circle.  Since a==b, one vertical plane suffices.
+        final Plane verticalPlane = new Plane(1.0,0.0);
+        final GeoPoint[] points = findIntersections(planetModel, verticalPlane, NO_BOUNDS, NO_BOUNDS);
+        // There will always be two points; we only need one.
+        final GeoPoint point = points[0];
+        boundsInfo.addHorizontalCircle(point.z/Math.sqrt(point.x * point.x + point.y * point.y + point.z * point.z));
       }
       //System.err.println("Done latitude bounds");
     }
@@ -697,8 +529,8 @@ public class Plane extends Vector {
             // Geometrically, we have a line segment in x-y space.  We need to locate the endpoints
             // of that line.  But luckily, we know some things: specifically, since it is a
             // degenerate situation in projection, the C value had to have been 0.  That
-            // means that our line's endpoints will coincide with the unit circle.  All we
-            // need to do then is to find the intersection of the unit circle and the line
+            // means that our line's endpoints will coincide with the projected ellipse.  All we
+            // need to do then is to find the intersection of the projected ellipse and the line
             // equation:
             //
             // A x + B y + D = 0
@@ -706,20 +538,20 @@ public class Plane extends Vector {
             // Since A != 0:
             // x = (-By - D)/A
             //
-            // The unit circle:
-            // x^2 + y^2 - 1 = 0
+            // The projected ellipse:
+            // x^2/a^2 + y^2/b^2 - 1 = 0
             // Substitute:
-            // [(-By-D)/A]^2 + y^2 -1 = 0
+            // [(-By-D)/A]^2/a^2 + y^2/b^2 -1 = 0
             // Multiply through by A^2:
-            // [-By - D]^2 + A^2*y^2 - A^2 = 0
+            // [-By - D]^2/a^2 + A^2*y^2/b^2 - A^2 = 0
             // Multiply out:
-            // B^2*y^2 + 2BDy + D^2 + A^2*y^2 - A^2 = 0
+            // B^2*y^2/a^2 + 2BDy/a^2 + D^2/a^2 + A^2*y^2/b^2 - A^2 = 0
             // Group:
-            // y^2 * [B^2 + A^2] + y [2BD] + [D^2-A^2] = 0
+            // y^2 * [B^2/a^2 + A^2/b^2] + y [2BD/a^2] + [D^2/a^2-A^2] = 0
 
-            a = B * B + A * A;
-            b = 2.0 * B * D;
-            c = D * D - A * A;
+            a = B * B * planetModel.inverseAbSquared + A * A * planetModel.inverseAbSquared;
+            b = 2.0 * B * D * planetModel.inverseAbSquared;
+            c = D * D * planetModel.inverseAbSquared - A * A;
 
             double sqrtClause = b * b - 4.0 * a * c;
 
@@ -750,9 +582,9 @@ public class Plane extends Vector {
             // Use equation suitable for B != 0
             // Since I != 0, we rewrite:
             // y = (-Ax - D)/B
-            a = B * B + A * A;
-            b = 2.0 * A * D;
-            c = D * D - B * B;
+            a = B * B * planetModel.inverseAbSquared + A * A * planetModel.inverseAbSquared;
+            b = 2.0 * A * D * planetModel.inverseAbSquared;
+            c = D * D * planetModel.inverseAbSquared - B * B;
 
             double sqrtClause = b * b - 4.0 * a * c;
 
@@ -786,25 +618,25 @@ public class Plane extends Vector {
         // They are for lat/lon calculation purposes only.  x-y is meant to be used for longitude determination,
         // and z for latitude, and that's all the values are good for.
 
-        // (1) Intersect the plane and the unit sphere, and project the results into the x-y plane:
+        // (1) Intersect the plane and the ellipsoid, and project the results into the x-y plane:
         // From plane:
         // z = (-Ax - By - D) / C
-        // From unit sphere:
-        // x^2 + y^2 + [(-Ax - By - D) / C]^2 = 1
+        // From ellipsoid:
+        // x^2/a^2 + y^2/b^2 + [(-Ax - By - D) / C]^2/c^2 = 1
         // Simplify/expand:
-        // C^2*x^2 + C^2*y^2 + (-Ax - By - D)^2 = C^2
+        // C^2*x^2/a^2 + C^2*y^2/b^2 + (-Ax - By - D)^2/c^2 = C^2
         //
-        // x^2 * C^2 + y^2 * C^2 + x^2 * (A^2 + ABxy + ADx) + (ABxy + y^2 * B^2 + BDy) + (ADx + BDy + D^2) = C^2
+        // x^2 * C^2/a^2 + y^2 * C^2/b^2 + x^2 * A^2/c^2 + ABxy/c^2 + ADx/c^2 + ABxy/c^2 + y^2 * B^2/c^2 + BDy/c^2 + ADx/c^2 + BDy/c^2 + D^2/c^2 = C^2
         // Group:
-        // [A^2 + C^2] x^2 + [B^2 + C^2] y^2 + [2AB]xy + [2AD]x + [2BD]y + [D^2-C^2] = 0
+        // [A^2/c^2 + C^2/a^2] x^2 + [B^2/c^2 + C^2/b^2] y^2 + [2AB/c^2]xy + [2AD/c^2]x + [2BD/c^2]y + [D^2/c^2-C^2] = 0
         // For convenience, introduce post-projection coefficient variables to make life easier.
         // E x^2 + F y^2 + G xy + H x + I y + J = 0
-        double E = A * A + C * C;
-        double F = B * B + C * C;
-        double G = 2.0 * A * B;
-        double H = 2.0 * A * D;
-        double I = 2.0 * B * D;
-        double J = D * D - C * C;
+        double E = A * A * planetModel.inverseCSquared + C * C * planetModel.inverseAbSquared;
+        double F = B * B * planetModel.inverseCSquared + C * C * planetModel.inverseAbSquared;
+        double G = 2.0 * A * B * planetModel.inverseCSquared;
+        double H = 2.0 * A * D * planetModel.inverseCSquared;
+        double I = 2.0 * B * D * planetModel.inverseCSquared;
+        double J = D * D * planetModel.inverseCSquared - C * C;
 
         //System.err.println("E = " + E + " F = " + F + " G = " + G + " H = "+ H + " I = " + I + " J = " + J);
 
@@ -962,6 +794,7 @@ public class Plane extends Vector {
    * Determine whether the plane intersects another plane within the
    * bounds provided.
    *
+   * @param planetModel is the planet model to use in determining intersection.
    * @param q                 is the other plane.
    * @param notablePoints     are points to look at to disambiguate cases when the two planes are identical.
    * @param moreNotablePoints are additional points to look at to disambiguate cases when the two planes are identical.
@@ -969,7 +802,7 @@ public class Plane extends Vector {
    * @param moreBounds        are more bounds.
    * @return true if there's an intersection.
    */
-  public boolean intersects(final Plane q, final GeoPoint[] notablePoints, final GeoPoint[] moreNotablePoints, final Membership[] bounds, final Membership... moreBounds) {
+  public boolean intersects(final PlanetModel planetModel, final Plane q, final GeoPoint[] notablePoints, final GeoPoint[] moreNotablePoints, final Membership[] bounds, final Membership... moreBounds) {
     //System.err.println("Does plane "+this+" intersect with plane "+q);
     // If the two planes are identical, then the math will find no points of intersection.
     // So a special case of this is to check for plane equality.  But that is not enough, because
@@ -994,7 +827,7 @@ public class Plane extends Vector {
       //System.err.println("  no notable points inside found; no intersection");
       return false;
     }
-    return findIntersections(q, bounds, moreBounds).length > 0;
+    return findIntersections(planetModel, q, bounds, moreBounds).length > 0;
   }
 
   /**
@@ -1042,8 +875,8 @@ public class Plane extends Vector {
   /**
    * Find a sample point on the intersection between two planes and the unit sphere.
    */
-  public GeoPoint getSampleIntersectionPoint(final Plane q) {
-    final GeoPoint[] intersections = findIntersections(q, NO_BOUNDS, NO_BOUNDS);
+  public GeoPoint getSampleIntersectionPoint(final PlanetModel planetModel, final Plane q) {
+    final GeoPoint[] intersections = findIntersections(planetModel, q, NO_BOUNDS, NO_BOUNDS);
     if (intersections.length == 0)
       return null;
     return intersections[0];

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/SidedPlane.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/SidedPlane.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/SidedPlane.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/SidedPlane.java Tue Jun  2 13:16:09 2015
@@ -53,10 +53,11 @@ public class SidedPlane extends Plane im
    * Construct a sided plane from a point and a Z coordinate.
    *
    * @param p      point to evaluate.
-   * @param height is the Z coordinate of the plane.
+   * @param planetModel is the planet model.
+   * @param sinLat is the sin of the latitude of the plane.
    */
-  public SidedPlane(Vector p, double height) {
-    super(height);
+  public SidedPlane(Vector p, final PlanetModel planetModel, double sinLat) {
+    super(planetModel, sinLat);
     sigNum = Math.signum(evaluate(p));
   }
 
@@ -84,6 +85,28 @@ public class SidedPlane extends Plane im
     sigNum = Math.signum(evaluate(p));
   }
 
+  /** Construct a sided plane from two points and a third normal vector.
+   */
+  public static SidedPlane constructNormalizedPerpendicularSidedPlane(final Vector insidePoint,
+    final Vector normalVector, final Vector point1, final Vector point2) {
+    final Vector pointsVector = new Vector(point1.x - point2.x, point1.y - point2.y, point1.z - point2.z);
+    final Vector newNormalVector = new Vector(normalVector, pointsVector).normalize();
+    // To construct the plane, we now just need D, which is simply the negative of the evaluation of the circle normal vector at one of the points.
+    return new SidedPlane(insidePoint, newNormalVector, -newNormalVector.dotProduct(point1));
+  }
+  
+  /** Construct a sided plane from three points.
+   */
+  public static SidedPlane constructNormalizedThreePointSidedPlane(final Vector insidePoint,
+    final Vector point1, final Vector point2, final Vector point3) {
+    final Vector planeNormal = new Vector(
+      new Vector(point1.x - point2.x, point1.y - point2.y, point1.z - point2.z),
+      new Vector(point2.x - point3.x, point2.y - point3.y, point2.z - point3.z)).normalize();
+    if (planeNormal == null)
+      return null;
+    return new SidedPlane(insidePoint, planeNormal, -planeNormal.dotProduct(point2));
+  }
+
   /**
    * Check if a point is within this shape.
    *

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Vector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Vector.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Vector.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/java/org/apache/lucene/spatial/spatial4j/geo3d/Vector.java Tue Jun  2 13:16:09 2015
@@ -114,14 +114,20 @@ public class Vector {
    */
   public boolean isWithin(final Membership[] bounds, final Membership[] moreBounds) {
     // Return true if the point described is within all provided bounds
+    //System.err.println("  checking if "+this+" is within bounds");
     for (Membership bound : bounds) {
-      if (bound != null && !bound.isWithin(this))
+      if (bound != null && !bound.isWithin(this)) {
+        //System.err.println("    NOT within "+bound);
         return false;
+      }
     }
     for (Membership bound : moreBounds) {
-      if (bound != null && !bound.isWithin(this))
+      if (bound != null && !bound.isWithin(this)) {
+        //System.err.println("    NOT within "+bound);
         return false;
+      }
     }
+    //System.err.println("    is within");
     return true;
   }
 
@@ -301,6 +307,28 @@ public class Vector {
     return Math.sqrt(x * x + y * y + z * z);
   }
 
+  /** Compute the desired magnitude of a unit vector projected to a given
+   * planet model.
+   * @param planetModel is the planet model.
+   * @param x is the unit vector x value.
+   * @param y is the unit vector y value.
+   * @param z is the unit vector z value.
+   * @return a magnitude value for that (x,y,z) that projects the vector onto the specified ellipsoid.
+   */
+  protected static double computeDesiredEllipsoidMagnitude(final PlanetModel planetModel, final double x, final double y, final double z) {
+    return 1.0 / Math.sqrt(x*x*planetModel.inverseAbSquared + y*y*planetModel.inverseAbSquared + z*z*planetModel.inverseCSquared);
+  }
+
+  /** Compute the desired magnitude of a unit vector projected to a given
+   * planet model.  The unit vector is specified only by a z value.
+   * @param planetModel is the planet model.
+   * @param z is the unit vector z value.
+   * @return a magnitude value for that z value that projects the vector onto the specified ellipsoid.
+   */
+  protected static double computeDesiredEllipsoidMagnitude(final PlanetModel planetModel, final double z) {
+    return 1.0 / Math.sqrt((1.0-z*z)*planetModel.inverseAbSquared + z*z*planetModel.inverseCSquared);
+  }
+
   @Override
   public boolean equals(Object o) {
     if (!(o instanceof Vector))

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/Geo3dRptTest.java Tue Jun  2 13:16:09 2015
@@ -39,6 +39,7 @@ import org.apache.lucene.spatial.spatial
 import org.apache.lucene.spatial.spatial4j.geo3d.GeoPoint;
 import org.apache.lucene.spatial.spatial4j.geo3d.GeoPolygonFactory;
 import org.apache.lucene.spatial.spatial4j.geo3d.GeoShape;
+import org.apache.lucene.spatial.spatial4j.geo3d.PlanetModel;
 import org.junit.Test;
 
 import static com.spatial4j.core.distance.DistanceUtils.DEGREES_TO_RADIANS;
@@ -81,12 +82,12 @@ public class Geo3dRptTest extends Random
   public void testFailure1() throws IOException {
     setupStrategy();
     final List<GeoPoint> points = new ArrayList<GeoPoint>();
-    points.add(new GeoPoint(18 * DEGREES_TO_RADIANS, -27 * DEGREES_TO_RADIANS));
-    points.add(new GeoPoint(-57 * DEGREES_TO_RADIANS, 146 * DEGREES_TO_RADIANS));
-    points.add(new GeoPoint(14 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS));
-    points.add(new GeoPoint(-15 * DEGREES_TO_RADIANS, 153 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 18 * DEGREES_TO_RADIANS, -27 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -57 * DEGREES_TO_RADIANS, 146 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 14 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -15 * DEGREES_TO_RADIANS, 153 * DEGREES_TO_RADIANS));
     
-    final Shape triangle = new Geo3dShape(GeoPolygonFactory.makeGeoPolygon(points,0),ctx);
+    final Shape triangle = new Geo3dShape(GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points,0),ctx);
     final Rectangle rect = ctx.makeRectangle(-49, -45, 73, 86);
     testOperation(rect,SpatialOperation.Intersects,triangle, false);
   }
@@ -101,11 +102,11 @@ public class Geo3dRptTest extends Random
 
   private Shape makeTriangle(double x1, double y1, double x2, double y2, double x3, double y3) {
     final List<GeoPoint> geoPoints = new ArrayList<>();
-    geoPoints.add(new GeoPoint(y1 * DEGREES_TO_RADIANS, x1 * DEGREES_TO_RADIANS));
-    geoPoints.add(new GeoPoint(y2 * DEGREES_TO_RADIANS, x2 * DEGREES_TO_RADIANS));
-    geoPoints.add(new GeoPoint(y3 * DEGREES_TO_RADIANS, x3 * DEGREES_TO_RADIANS));
+    geoPoints.add(new GeoPoint(PlanetModel.SPHERE, y1 * DEGREES_TO_RADIANS, x1 * DEGREES_TO_RADIANS));
+    geoPoints.add(new GeoPoint(PlanetModel.SPHERE, y2 * DEGREES_TO_RADIANS, x2 * DEGREES_TO_RADIANS));
+    geoPoints.add(new GeoPoint(PlanetModel.SPHERE, y3 * DEGREES_TO_RADIANS, x3 * DEGREES_TO_RADIANS));
     final int convexPointIndex = 0;
-    final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(geoPoints, convexPointIndex);
+    final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, geoPoints, convexPointIndex);
     return new Geo3dShape(shape, ctx);
   }
 
@@ -125,12 +126,12 @@ public class Geo3dRptTest extends Random
           final List<GeoPoint> geoPoints = new ArrayList<>();
           while (geoPoints.size() < vertexCount) {
             final Point point = randomPoint();
-            final GeoPoint gPt = new GeoPoint(point.getY() * DEGREES_TO_RADIANS, point.getX() * DEGREES_TO_RADIANS);
+            final GeoPoint gPt = new GeoPoint(PlanetModel.SPHERE, point.getY() * DEGREES_TO_RADIANS, point.getX() * DEGREES_TO_RADIANS);
             geoPoints.add(gPt);
           }
           final int convexPointIndex = random().nextInt(vertexCount);       //If we get this wrong, hopefully we get IllegalArgumentException
           try {
-            final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(geoPoints, convexPointIndex);
+            final GeoShape shape = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, geoPoints, convexPointIndex);
             return new Geo3dShape(shape, ctx);
           } catch (IllegalArgumentException e) {
             // This is what happens when we create a shape that is invalid.  Although it is conceivable that there are cases where
@@ -145,7 +146,7 @@ public class Geo3dRptTest extends Random
           final int circleRadius = random().nextInt(179) + 1;
           final Point point = randomPoint();
           try {
-            final GeoShape shape = new GeoCircle(point.getY() * DEGREES_TO_RADIANS, point.getX() * DEGREES_TO_RADIANS,
+            final GeoShape shape = new GeoCircle(PlanetModel.SPHERE, point.getY() * DEGREES_TO_RADIANS, point.getX() * DEGREES_TO_RADIANS,
               circleRadius * DEGREES_TO_RADIANS);
             return new Geo3dShape(shape, ctx);
           } catch (IllegalArgumentException e) {
@@ -167,7 +168,7 @@ public class Geo3dRptTest extends Random
             lrhcPoint = temp;
           }
           try {
-            final GeoShape shape = GeoBBoxFactory.makeGeoBBox(ulhcPoint.getY() * DEGREES_TO_RADIANS,
+            final GeoShape shape = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, ulhcPoint.getY() * DEGREES_TO_RADIANS,
               lrhcPoint.getY() * DEGREES_TO_RADIANS,
               ulhcPoint.getX() * DEGREES_TO_RADIANS,
               lrhcPoint.getX() * DEGREES_TO_RADIANS);
@@ -186,7 +187,7 @@ public class Geo3dRptTest extends Random
         final double width = (random().nextInt(89)+1) * DEGREES_TO_RADIANS;
         while (true) {
           try {
-            final GeoPath path = new GeoPath(width);
+            final GeoPath path = new GeoPath(PlanetModel.SPHERE, width);
             for (int i = 0; i < pointCount; i++) {
               final Point nextPoint = randomPoint();
               path.addPoint(nextPoint.getY() * DEGREES_TO_RADIANS, nextPoint.getX() * DEGREES_TO_RADIANS);

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoBBoxTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoBBoxTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoBBoxTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoBBoxTest.java Tue Jun  2 13:16:09 2015
@@ -36,14 +36,14 @@ public class GeoBBoxTest {
     GeoConvexPolygon cp;
     int relationship;
     List<GeoPoint> points = new ArrayList<GeoPoint>();
-    points.add(new GeoPoint(24 * DEGREES_TO_RADIANS, -30 * DEGREES_TO_RADIANS));
-    points.add(new GeoPoint(-11 * DEGREES_TO_RADIANS, 101 * DEGREES_TO_RADIANS));
-    points.add(new GeoPoint(-49 * DEGREES_TO_RADIANS, -176 * DEGREES_TO_RADIANS));
-    GeoMembershipShape shape = GeoPolygonFactory.makeGeoPolygon(points, 0);
-    box = GeoBBoxFactory.makeGeoBBox(-64 * DEGREES_TO_RADIANS, -64 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS, 180 * DEGREES_TO_RADIANS);
+    points.add(new GeoPoint(PlanetModel.SPHERE, 24 * DEGREES_TO_RADIANS, -30 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -11 * DEGREES_TO_RADIANS, 101 * DEGREES_TO_RADIANS));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -49 * DEGREES_TO_RADIANS, -176 * DEGREES_TO_RADIANS));
+    GeoMembershipShape shape = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points, 0);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, -64 * DEGREES_TO_RADIANS, -64 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS, 180 * DEGREES_TO_RADIANS);
     relationship = box.getRelationship(shape);
     assertEquals(GeoArea.CONTAINS, relationship);
-    box = GeoBBoxFactory.makeGeoBBox(-61.85 * DEGREES_TO_RADIANS, -67.5 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS, -168.75 * DEGREES_TO_RADIANS);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, -61.85 * DEGREES_TO_RADIANS, -67.5 * DEGREES_TO_RADIANS, -180 * DEGREES_TO_RADIANS, -168.75 * DEGREES_TO_RADIANS);
     System.out.println("Shape = " + shape + " Rect = " + box);
     relationship = box.getRelationship(shape);
     assertEquals(GeoArea.CONTAINS, relationship);
@@ -54,52 +54,52 @@ public class GeoBBoxTest {
     GeoBBox box;
     GeoPoint gp;
     // Standard normal Rect box, not crossing dateline
-    box = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, -1.0, 1.0);
-    gp = new GeoPoint(-0.1, 0.0);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -1.0, 1.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, 0.0);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(0.1, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, 0.0);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, 0.0);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, 1.1);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.1);
     assertFalse(box.isWithin(gp));
     // Standard normal Rect box, crossing dateline
-    box = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, Math.PI - 1.0, -Math.PI + 1.0);
-    gp = new GeoPoint(-0.1, -Math.PI);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, Math.PI - 1.0, -Math.PI + 1.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(0.1, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, -Math.PI);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, -Math.PI);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI + 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI + 1.1);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI - 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI - 1.1);
     assertFalse(box.isWithin(gp));
     // Latitude zone rectangle
-    box = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, -Math.PI, Math.PI);
-    gp = new GeoPoint(-0.1, -Math.PI);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -Math.PI, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(0.1, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, -Math.PI);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, -Math.PI);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI + 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI + 1.1);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI - 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI - 1.1);
     assertTrue(box.isWithin(gp));
     // World
-    box = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, Math.PI);
-    gp = new GeoPoint(-0.1, -Math.PI);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(0.1, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, -Math.PI);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, -Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, -Math.PI);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI + 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI + 1.1);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -Math.PI - 1.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -Math.PI - 1.1);
     assertTrue(box.isWithin(gp));
 
   }
@@ -109,23 +109,23 @@ public class GeoBBoxTest {
     GeoBBox box;
     GeoPoint gp;
     // Standard normal Rect box, not crossing dateline
-    box = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, -1.0, 1.0);
+    box = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -1.0, 1.0);
     box = box.expand(0.1);
-    gp = new GeoPoint(0.05, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.0);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(0.15, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.15, 0.0);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.25 - 0.05, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.05, 0.0);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.25 - 0.15, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.15, 0.0);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -1.05);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.05);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, -1.15);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.15);
     assertFalse(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, 1.05);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, 1.05);
     assertTrue(box.isWithin(gp));
-    gp = new GeoPoint(-0.1, 1.15);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, 1.15);
     assertFalse(box.isWithin(gp));
   }
 
@@ -134,7 +134,7 @@ public class GeoBBoxTest {
     GeoBBox c;
     Bounds b;
 
-    c = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, -1.0, 1.0);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -1.0, 1.0);
 
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
@@ -145,7 +145,7 @@ public class GeoBBoxTest {
     assertEquals(-Math.PI * 0.25, b.getMinLatitude(), 0.000001);
     assertEquals(0.0, b.getMaxLatitude(), 0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, 1.0, -1.0);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, 1.0, -1.0);
 
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
@@ -156,7 +156,7 @@ public class GeoBBoxTest {
     assertEquals(-Math.PI * 0.25, b.getMinLatitude(), 0.000001);
     assertEquals(0.0, b.getMaxLatitude(), 0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -1.0, 1.0);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -1.0, 1.0);
 
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
@@ -165,7 +165,7 @@ public class GeoBBoxTest {
     assertEquals(-1.0, b.getLeftLongitude(), 0.000001);
     assertEquals(1.0, b.getRightLongitude(), 0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, 1.0, -1.0);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 1.0, -1.0);
 
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
@@ -176,7 +176,7 @@ public class GeoBBoxTest {
 
     // Check wide variants of rectangle and longitude slice
 
-    c = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, -Math.PI + 0.1, Math.PI - 0.1);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, -Math.PI + 0.1, Math.PI - 0.1);
 
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
@@ -187,7 +187,7 @@ public class GeoBBoxTest {
     assertEquals(-Math.PI * 0.25, b.getMinLatitude(), 0.000001);
     assertEquals(0.0, b.getMaxLatitude(), 0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(0.0, -Math.PI * 0.25, Math.PI - 0.1, -Math.PI + 0.1);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 0.0, -Math.PI * 0.25, Math.PI - 0.1, -Math.PI + 0.1);
 
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
@@ -198,7 +198,7 @@ public class GeoBBoxTest {
     assertEquals(-Math.PI * 0.25, b.getMinLatitude(), 0.000001);
     assertEquals(0.0, b.getMaxLatitude(), 0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -Math.PI + 0.1, Math.PI - 0.1);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI + 0.1, Math.PI - 0.1);
 
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
@@ -207,7 +207,7 @@ public class GeoBBoxTest {
     //assertEquals(-Math.PI+0.1,b.getLeftLongitude(),0.000001);
     //assertEquals(Math.PI-0.1,b.getRightLongitude(),0.000001);
 
-    c = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, Math.PI - 0.1, -Math.PI + 0.1);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, Math.PI - 0.1, -Math.PI + 0.1);
 
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
@@ -217,7 +217,7 @@ public class GeoBBoxTest {
     assertEquals(-Math.PI + 0.1, b.getRightLongitude(), 0.000001);
 
     // Check latitude zone
-    c = GeoBBoxFactory.makeGeoBBox(1.0, -1.0, -Math.PI, Math.PI);
+    c = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, 1.0, -1.0, -Math.PI, Math.PI);
 
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
@@ -230,8 +230,8 @@ public class GeoBBoxTest {
     GeoBBox c1;
     GeoBBox c2;
 
-    c1 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
-    c2 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
+    c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
+    c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
 
     b = new Bounds();
     b = c1.getBounds(b);
@@ -240,8 +240,8 @@ public class GeoBBoxTest {
     assertTrue(b.checkNoTopLatitudeBound());
     assertTrue(b.checkNoBottomLatitudeBound());
 
-    c1 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
-    c2 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI * 0.5);
+    c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI, 0.0);
+    c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI * 0.5);
 
     b = new Bounds();
     b = c1.getBounds(b);
@@ -252,8 +252,8 @@ public class GeoBBoxTest {
     //assertEquals(-Math.PI,b.getLeftLongitude(),0.000001);
     //assertEquals(Math.PI*0.5,b.getRightLongitude(),0.000001);
 
-    c1 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, -Math.PI * 0.5, 0.0);
-    c2 = GeoBBoxFactory.makeGeoBBox(Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
+    c1 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, -Math.PI * 0.5, 0.0);
+    c2 = GeoBBoxFactory.makeGeoBBox(PlanetModel.SPHERE, Math.PI * 0.5, -Math.PI * 0.5, 0.0, Math.PI);
 
     b = new Bounds();
     b = c1.getBounds(b);

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoCircleTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoCircleTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoCircleTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoCircleTest.java Tue Jun  2 13:16:09 2015
@@ -30,16 +30,16 @@ public class GeoCircleTest {
   public void testCircleDistance() {
     GeoCircle c;
     GeoPoint gp;
-    c = new GeoCircle(0.0, -0.5, 0.1);
-    gp = new GeoPoint(0.0, 0.0);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertEquals(Double.MAX_VALUE, c.computeArcDistance(gp), 0.0);
     assertEquals(Double.MAX_VALUE, c.computeLinearDistance(gp), 0.0);
     assertEquals(Double.MAX_VALUE, c.computeNormalDistance(gp), 0.0);
-    gp = new GeoPoint(0.0, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
     assertEquals(0.0, c.computeArcDistance(gp), 0.000001);
     assertEquals(0.0, c.computeLinearDistance(gp), 0.000001);
     assertEquals(0.0, c.computeNormalDistance(gp), 0.000001);
-    gp = new GeoPoint(0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, -0.5);
     assertEquals(0.05, c.computeArcDistance(gp), 0.000001);
     assertEquals(0.049995, c.computeLinearDistance(gp), 0.000001);
     assertEquals(0.049979, c.computeNormalDistance(gp), 0.000001);
@@ -49,18 +49,18 @@ public class GeoCircleTest {
   public void testCirclePointWithin() {
     GeoCircle c;
     GeoPoint gp;
-    c = new GeoCircle(0.0, -0.5, 0.1);
-    gp = new GeoPoint(0.0, 0.0);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.55);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.55);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.45);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.45);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertFalse(c.isWithin(gp));
   }
 
@@ -71,7 +71,7 @@ public class GeoCircleTest {
 
 
     // Vertical circle cases
-    c = new GeoCircle(0.0, -0.5, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, -0.5, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -80,7 +80,7 @@ public class GeoCircleTest {
     assertEquals(-0.4, b.getRightLongitude(), 0.000001);
     assertEquals(-0.1, b.getMinLatitude(), 0.000001);
     assertEquals(0.1, b.getMaxLatitude(), 0.000001);
-    c = new GeoCircle(0.0, 0.5, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, 0.5, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -89,7 +89,7 @@ public class GeoCircleTest {
     assertEquals(0.6, b.getRightLongitude(), 0.000001);
     assertEquals(-0.1, b.getMinLatitude(), 0.000001);
     assertEquals(0.1, b.getMaxLatitude(), 0.000001);
-    c = new GeoCircle(0.0, 0.0, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, 0.0, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -98,7 +98,7 @@ public class GeoCircleTest {
     assertEquals(0.1, b.getRightLongitude(), 0.000001);
     assertEquals(-0.1, b.getMinLatitude(), 0.000001);
     assertEquals(0.1, b.getMaxLatitude(), 0.000001);
-    c = new GeoCircle(0.0, Math.PI, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.0, Math.PI, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -108,13 +108,13 @@ public class GeoCircleTest {
     assertEquals(-0.1, b.getMinLatitude(), 0.000001);
     assertEquals(0.1, b.getMaxLatitude(), 0.000001);
     // Horizontal circle cases
-    c = new GeoCircle(Math.PI * 0.5, 0.0, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, Math.PI * 0.5, 0.0, 0.1);
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
     assertTrue(b.checkNoTopLatitudeBound());
     assertFalse(b.checkNoBottomLatitudeBound());
     assertEquals(Math.PI * 0.5 - 0.1, b.getMinLatitude(), 0.000001);
-    c = new GeoCircle(-Math.PI * 0.5, 0.0, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, -Math.PI * 0.5, 0.0, 0.1);
     b = c.getBounds(null);
     assertTrue(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -122,7 +122,7 @@ public class GeoCircleTest {
     assertEquals(-Math.PI * 0.5 + 0.1, b.getMaxLatitude(), 0.000001);
 
     // Now do a somewhat tilted plane, facing different directions.
-    c = new GeoCircle(0.01, 0.0, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, 0.0, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -132,7 +132,7 @@ public class GeoCircleTest {
     assertEquals(-0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(0.01, Math.PI, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -142,7 +142,7 @@ public class GeoCircleTest {
     assertEquals(Math.PI - 0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(-Math.PI + 0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(0.01, Math.PI * 0.5, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI * 0.5, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -152,7 +152,7 @@ public class GeoCircleTest {
     assertEquals(Math.PI * 0.5 - 0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(Math.PI * 0.5 + 0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(0.01, -Math.PI * 0.5, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, -Math.PI * 0.5, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -163,7 +163,7 @@ public class GeoCircleTest {
     assertEquals(-Math.PI * 0.5 + 0.1, b.getRightLongitude(), 0.00001);
 
     // Slightly tilted, PI/4 direction.
-    c = new GeoCircle(0.01, Math.PI * 0.25, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, Math.PI * 0.25, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -173,7 +173,7 @@ public class GeoCircleTest {
     assertEquals(Math.PI * 0.25 - 0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(0.01, -Math.PI * 0.25, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, -Math.PI * 0.25, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -183,7 +183,7 @@ public class GeoCircleTest {
     assertEquals(-Math.PI * 0.25 - 0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(-Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(-0.01, Math.PI * 0.25, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, -0.01, Math.PI * 0.25, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -193,7 +193,7 @@ public class GeoCircleTest {
     assertEquals(Math.PI * 0.25 - 0.1, b.getLeftLongitude(), 0.00001);
     assertEquals(Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
 
-    c = new GeoCircle(-0.01, -Math.PI * 0.25, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, -0.01, -Math.PI * 0.25, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());
@@ -204,7 +204,7 @@ public class GeoCircleTest {
     assertEquals(-Math.PI * 0.25 + 0.1, b.getRightLongitude(), 0.00001);
 
     // Now do a somewhat tilted plane.
-    c = new GeoCircle(0.01, -0.5, 0.1);
+    c = new GeoCircle(PlanetModel.SPHERE, 0.01, -0.5, 0.1);
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());
     assertFalse(b.checkNoTopLatitudeBound());

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoConvexPolygonTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoConvexPolygonTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoConvexPolygonTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoConvexPolygonTest.java Tue Jun  2 13:16:09 2015
@@ -30,37 +30,37 @@ public class GeoConvexPolygonTest {
   public void testPolygonPointWithin() {
     GeoConvexPolygon c;
     GeoPoint gp;
-    c = new GeoConvexPolygon(-0.1, -0.5);
+    c = new GeoConvexPolygon(PlanetModel.SPHERE, -0.1, -0.5);
     c.addPoint(0.0, -0.6, false);
     c.addPoint(0.1, -0.5, false);
     c.addPoint(0.0, -0.4, false);
     c.donePoints(false);
     // Sample some points within
-    gp = new GeoPoint(0.0, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.55);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.55);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.45);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.45);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(-0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.05, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, -0.5);
     assertTrue(c.isWithin(gp));
     // Sample some nearby points outside
-    gp = new GeoPoint(0.0, -0.65);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.65);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.35);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.35);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(-0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.15, -0.5);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.15, -0.5);
     assertFalse(c.isWithin(gp));
     // Random points outside
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertFalse(c.isWithin(gp));
   }
 
@@ -69,7 +69,7 @@ public class GeoConvexPolygonTest {
     GeoConvexPolygon c;
     Bounds b;
 
-    c = new GeoConvexPolygon(-0.1, -0.5);
+    c = new GeoConvexPolygon(PlanetModel.SPHERE, -0.1, -0.5);
     c.addPoint(0.0, -0.6, false);
     c.addPoint(0.1, -0.5, false);
     c.addPoint(0.0, -0.4, false);

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPathTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPathTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPathTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPathTest.java Tue Jun  2 13:16:09 2015
@@ -30,47 +30,47 @@ public class GeoPathTest {
     // Start with a really simple case
     GeoPath p;
     GeoPoint gp;
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     p.addPoint(0.0, 0.0);
     p.addPoint(0.0, 0.1);
     p.addPoint(0.0, 0.2);
     p.done();
-    gp = new GeoPoint(Math.PI * 0.5, 0.15);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.15);
     assertEquals(Double.MAX_VALUE, p.computeArcDistance(gp), 0.0);
-    gp = new GeoPoint(0.05, 0.15);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.15);
     assertEquals(0.15 + 0.05, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(0.0, 0.12);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.12);
     assertEquals(0.12 + 0.0, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(-0.15, 0.05);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.15, 0.05);
     assertEquals(Double.MAX_VALUE, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(0.0, 0.25);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.25);
     assertEquals(0.20 + 0.05, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(0.0, -0.05);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.05);
     assertEquals(0.0 + 0.05, p.computeArcDistance(gp), 0.000001);
 
     // Compute path distances now
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     p.addPoint(0.0, 0.0);
     p.addPoint(0.0, 0.1);
     p.addPoint(0.0, 0.2);
     p.done();
-    gp = new GeoPoint(0.05, 0.15);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, 0.15);
     assertEquals(0.15 + 0.05, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(0.0, 0.12);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.12);
     assertEquals(0.12, p.computeArcDistance(gp), 0.000001);
 
     // Now try a vertical path, and make sure distances are as expected
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     p.addPoint(-Math.PI * 0.25, -0.5);
     p.addPoint(Math.PI * 0.25, -0.5);
     p.done();
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertEquals(Double.MAX_VALUE, p.computeArcDistance(gp), 0.0);
-    gp = new GeoPoint(-0.1, -1.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.1, -1.0);
     assertEquals(Double.MAX_VALUE, p.computeArcDistance(gp), 0.0);
-    gp = new GeoPoint(Math.PI * 0.25 + 0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.25 + 0.05, -0.5);
     assertEquals(Math.PI * 0.5 + 0.05, p.computeArcDistance(gp), 0.000001);
-    gp = new GeoPoint(-Math.PI * 0.25 - 0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.25 - 0.05, -0.5);
     assertEquals(0.0 + 0.05, p.computeArcDistance(gp), 0.000001);
   }
 
@@ -79,47 +79,48 @@ public class GeoPathTest {
     // Tests whether we can properly detect whether a point is within a path or not
     GeoPath p;
     GeoPoint gp;
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     // Build a diagonal path crossing the equator
     p.addPoint(-0.2, -0.2);
     p.addPoint(0.2, 0.2);
     p.done();
     // Test points on the path
-    gp = new GeoPoint(-0.2, -0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.2, -0.2);
     assertTrue(p.isWithin(gp));
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertTrue(p.isWithin(gp));
-    gp = new GeoPoint(0.1, 0.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, 0.1);
     assertTrue(p.isWithin(gp));
     // Test points off the path
-    gp = new GeoPoint(-0.2, 0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.2, 0.2);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, 0.0);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(0.2, -0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.2, -0.2);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertFalse(p.isWithin(gp));
     // Repeat the test, but across the terminator
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     // Build a diagonal path crossing the equator
     p.addPoint(-0.2, Math.PI - 0.2);
     p.addPoint(0.2, -Math.PI + 0.2);
+    p.done();
     // Test points on the path
-    gp = new GeoPoint(-0.2, Math.PI - 0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.2, Math.PI - 0.2);
     assertTrue(p.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertTrue(p.isWithin(gp));
-    gp = new GeoPoint(0.1, -Math.PI + 0.1);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.1, -Math.PI + 0.1);
     assertTrue(p.isWithin(gp));
     // Test points off the path
-    gp = new GeoPoint(-0.2, -Math.PI + 0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.2, -Math.PI + 0.2);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(-Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, -Math.PI * 0.5, 0.0);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(0.2, Math.PI - 0.2);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.2, Math.PI - 0.2);
     assertFalse(p.isWithin(gp));
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertFalse(p.isWithin(gp));
 
   }
@@ -131,31 +132,31 @@ public class GeoPathTest {
 
     // Start by testing the basic kinds of relationship, increasing in order of difficulty.
 
-    p = new GeoPath(0.1);
+    p = new GeoPath(PlanetModel.SPHERE, 0.1);
     p.addPoint(-0.3, -0.3);
     p.addPoint(0.3, 0.3);
     p.done();
     // Easiest: The path is wholly contains the georect
-    rect = new GeoRectangle(0.05, -0.05, -0.05, 0.05);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.05, -0.05, -0.05, 0.05);
     assertEquals(GeoArea.CONTAINS, rect.getRelationship(p));
     // Next easiest: Some endpoints of the rectangle are inside, and some are outside.
-    rect = new GeoRectangle(0.05, -0.05, -0.05, 0.5);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.05, -0.05, -0.05, 0.5);
     assertEquals(GeoArea.OVERLAPS, rect.getRelationship(p));
     // Now, all points are outside, but the figures intersect
-    rect = new GeoRectangle(0.05, -0.05, -0.5, 0.5);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.05, -0.05, -0.5, 0.5);
     assertEquals(GeoArea.OVERLAPS, rect.getRelationship(p));
     // Finally, all points are outside, and the figures *do not* intersect
-    rect = new GeoRectangle(0.5, -0.5, -0.5, 0.5);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.5, -0.5, -0.5, 0.5);
     assertEquals(GeoArea.WITHIN, rect.getRelationship(p));
     // Check that segment edge overlap detection works
-    rect = new GeoRectangle(0.1, 0.0, -0.1, 0.0);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.1, 0.0, -0.1, 0.0);
     assertEquals(GeoArea.OVERLAPS, rect.getRelationship(p));
-    rect = new GeoRectangle(0.2, 0.1, -0.2, -0.1);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.2, 0.1, -0.2, -0.1);
     assertEquals(GeoArea.DISJOINT, rect.getRelationship(p));
     // Check if overlap at endpoints behaves as expected next
-    rect = new GeoRectangle(0.5, -0.5, -0.5, -0.35);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.5, -0.5, -0.5, -0.35);
     assertEquals(GeoArea.OVERLAPS, rect.getRelationship(p));
-    rect = new GeoRectangle(0.5, -0.5, -0.5, -0.45);
+    rect = new GeoRectangle(PlanetModel.SPHERE, 0.5, -0.5, -0.5, -0.45);
     assertEquals(GeoArea.DISJOINT, rect.getRelationship(p));
 
   }
@@ -165,7 +166,7 @@ public class GeoPathTest {
     GeoPath c;
     Bounds b;
 
-    c = new GeoPath(0.1);
+    c = new GeoPath(PlanetModel.SPHERE, 0.1);
     c.addPoint(-0.3, -0.3);
     c.addPoint(0.3, 0.3);
     c.done();

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPolygonTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPolygonTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPolygonTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/GeoPolygonTest.java Tue Jun  2 13:16:09 2015
@@ -36,49 +36,49 @@ public class GeoPolygonTest {
     List<GeoPoint> points;
 
     points = new ArrayList<GeoPoint>();
-    points.add(new GeoPoint(-0.1, -0.5));
-    points.add(new GeoPoint(0.0, -0.6));
-    points.add(new GeoPoint(0.1, -0.5));
-    points.add(new GeoPoint(0.0, -0.4));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.6));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.4));
 
-    c = GeoPolygonFactory.makeGeoPolygon(points, 0);
+    c = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points, 0);
     // Sample some points within
-    gp = new GeoPoint(0.0, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.55);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.55);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.45);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.45);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(-0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.05, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, -0.5);
     assertTrue(c.isWithin(gp));
     // Sample some nearby points outside
-    gp = new GeoPoint(0.0, -0.65);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.65);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.35);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.35);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(-0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.15, -0.5);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.15, -0.5);
     assertFalse(c.isWithin(gp));
     // Random points outside
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertFalse(c.isWithin(gp));
 
     points = new ArrayList<GeoPoint>();
-    points.add(new GeoPoint(-0.1, -0.5));
-    points.add(new GeoPoint(-0.01, -0.6));
-    points.add(new GeoPoint(-0.1, -0.7));
-    points.add(new GeoPoint(0.0, -0.8));
-    points.add(new GeoPoint(0.1, -0.7));
-    points.add(new GeoPoint(0.01, -0.6));
-    points.add(new GeoPoint(0.1, -0.5));
-    points.add(new GeoPoint(0.0, -0.4));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -0.01, -0.6));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -0.1, -0.7));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.8));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.1, -0.7));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.01, -0.6));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.4));
         
         /*
         System.out.println("Points: ");
@@ -87,33 +87,33 @@ public class GeoPolygonTest {
         }
         */
 
-    c = GeoPolygonFactory.makeGeoPolygon(points, 0);
+    c = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points, 0);
     // Sample some points within
-    gp = new GeoPoint(0.0, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.55);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.55);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.45);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.45);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(-0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.05, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.05, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.05, -0.5);
     assertTrue(c.isWithin(gp));
-    gp = new GeoPoint(0.0, -0.7);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.7);
     assertTrue(c.isWithin(gp));
     // Sample some nearby points outside
-    gp = new GeoPoint(0.0, -0.35);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, -0.35);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(-0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, -0.15, -0.5);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.15, -0.5);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.15, -0.5);
     assertFalse(c.isWithin(gp));
     // Random points outside
-    gp = new GeoPoint(0.0, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(Math.PI * 0.5, 0.0);
+    gp = new GeoPoint(PlanetModel.SPHERE, Math.PI * 0.5, 0.0);
     assertFalse(c.isWithin(gp));
-    gp = new GeoPoint(0.0, Math.PI);
+    gp = new GeoPoint(PlanetModel.SPHERE, 0.0, Math.PI);
     assertFalse(c.isWithin(gp));
 
   }
@@ -125,12 +125,12 @@ public class GeoPolygonTest {
     List<GeoPoint> points;
 
     points = new ArrayList<GeoPoint>();
-    points.add(new GeoPoint(-0.1, -0.5));
-    points.add(new GeoPoint(0.0, -0.6));
-    points.add(new GeoPoint(0.1, -0.5));
-    points.add(new GeoPoint(0.0, -0.4));
+    points.add(new GeoPoint(PlanetModel.SPHERE, -0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.6));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.1, -0.5));
+    points.add(new GeoPoint(PlanetModel.SPHERE, 0.0, -0.4));
 
-    c = GeoPolygonFactory.makeGeoPolygon(points, 0);
+    c = GeoPolygonFactory.makeGeoPolygon(PlanetModel.SPHERE, points, 0);
 
     b = c.getBounds(null);
     assertFalse(b.checkNoLongitudeBound());

Modified: lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/PlaneTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/PlaneTest.java?rev=1683102&r1=1683101&r2=1683102&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/PlaneTest.java (original)
+++ lucene/dev/branches/branch_5x/lucene/spatial/src/test/org/apache/lucene/spatial/spatial4j/geo3d/PlaneTest.java Tue Jun  2 13:16:09 2015
@@ -30,7 +30,7 @@ public class PlaneTest {
 
   @Test
   public void testIdenticalPlanes() {
-    final GeoPoint p = new GeoPoint(0.123, -0.456);
+    final GeoPoint p = new GeoPoint(PlanetModel.SPHERE, 0.123, -0.456);
     final Plane plane1 = new Plane(p, 0.0);
     final Plane plane2 = new Plane(p, 0.0);
     assertTrue(plane1.isNumericallyIdentical(plane2));



Mime
View raw message