Skip to content

Apache Lucene open-source search software

LUCENE-8089: Add PlanetModel method that returns true if planetmodel is a sphere.

Karl Wright952f4c4e59ff
diff --git a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/PlanetModel.java b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/PlanetModel.java
index 2aabfc1b824..55b730d626c 100644
--- a/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/PlanetModel.java
+++ b/lucene/spatial3d/src/java/org/apache/lucene/spatial3d/geom/PlanetModel.java
@@ -122,6 +122,13 @@ public class PlanetModel implements SerializableObject {
SerializableObject.writeDouble(outputStream, c);
}
+ /** Does this planet model describe a sphere?
+ *@return true if so.
+ */
+ public boolean isSphere() {
+ return this.ab == this.c;
+ }
+
/** Find the minimum magnitude of all points on the ellipsoid.
* @return the minimum magnitude for the planet.
*/