Circle (Lucene 10.5.1 core API)
Description: declaration: package: org.apache.lucene.geo, class: Circle

Package org.apache.lucene.geo

# Class Circle

java.lang.Object
org.apache.lucene.geo.Geometry
org.apache.lucene.geo.LatLonGeometry
org.apache.lucene.geo.Circle

public final class Circle extends LatLonGeometry
Represents a circle on the Earth's surface defined by a center point and radius.

The circle is defined using:

- Center point (latitude/longitude in degrees)
- Radius in meters

Important Notes:

- The circle is approximated on the spherical Earth model
- For very large circles or circles near poles, consider using polygons instead
- Dateline crossing is handled automatically

Example usage:

     // Create a circle with 1km radius around the Eiffel Tower
     Circle circle = new Circle(48.8584, 2.2945, 1000);

     // Create a query using this circle
     Query query = LatLonShape.newDistanceQuery("location", circle);

WARNING: This API is experimental and might change in incompatible ways in the next release.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `Circle(double lat, double lon, double radiusMeters)`
  Creates a new circle from the supplied latitude/longitude center and a radius in meters..

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object o)`
  `double`
  `getLat()`
  Returns the center's latitude
  `double`
  `getLon()`
  Returns the center's longitude
  `double`
  `getRadius()`
  Returns the radius in meters
  `int`
  `hashCode()`
  `protected Component2D`
  `toComponent2D()`
  get a Component2D from the geometry object
  `String`
  `toString()`

  ### Methods inherited from class org.apache.lucene.geo.LatLonGeometry

  `create`

  ### Methods inherited from class java.lang.Object

  `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- ## Constructor Details

  - ### Circle

    public Circle(double lat, double lon, double radiusMeters)
    Creates a new circle from the supplied latitude/longitude center and a radius in meters..

- ## Method Details

  - ### getLat

    public double getLat()
    Returns the center's latitude

  - ### getLon

    public double getLon()
    Returns the center's longitude

  - ### getRadius

    public double getRadius()
    Returns the radius in meters

  - ### toComponent2D

    protected Component2D toComponent2D()
    Description copied from class: `Geometry`
    get a Component2D from the geometry object
    Specified by:
      `toComponent2D` in class `Geometry`

  - ### equals

    public boolean equals(Object o)
    Overrides:
      `equals` in class `Object`

  - ### hashCode

    public int hashCode()
    Overrides:
      `hashCode` in class `Object`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`