Class GeoCircleFactory

java.lang.Object
org.apache.lucene.spatial3d.geom.GeoCircleFactory

public class GeoCircleFactory extends Object
Class which constructs a GeoCircle representing an arbitrary circle.
WARNING: This API is experimental and might change in incompatible ways in the next release.
  • Method Details

    • makeGeoCircle

      public static GeoCircle makeGeoCircle(PlanetModel planetModel, double latitude, double longitude, double cutoffAngle)
      Create a GeoCircle from a center and a cutoff angle. The resulting shape is a circle in spherical planets, otherwise is an ellipse. It is the most efficient shape to represent a circle on a sphere.
      Parameters:
      planetModel - is the planet model.
      latitude - is the center latitude.
      longitude - is the center longitude.
      cutoffAngle - is the cutoff angle.
      Returns:
      a GeoCircle corresponding to what was specified.
    • makeExactGeoCircle

      public static GeoCircle makeExactGeoCircle(PlanetModel planetModel, double latitude, double longitude, double radius, double accuracy)
      Create an GeoCircle from a center, a radius and a desired accuracy. It is the most accurate shape to represent a circle in non-spherical planets.

      The accuracy of the circle is defined as the maximum linear distance between any point on the surface circle and planes that describe the circle. Therefore, with planet model WSG84, since the radius of earth is 6,371,000 meters, an accuracy of 1e-6 corresponds to 6.3 meters. For an accuracy of 1.0 meters, the accuracy value would be 1.6e-7. The maximum accuracy possible is 1e-12.

      Note that this method may thrown an IllegalArgumentException if the circle being specified cannot be represented by plane approximation given the planet model provided.

      Parameters:
      planetModel - is the planet model.
      latitude - is the center latitude.
      longitude - is the center longitude.
      radius - is the radius surface distance.
      accuracy - is the maximum linear distance between the circle approximation and the real circle, as computed using the Vincenty formula.
      Returns:
      a GeoCircle corresponding to what was specified.