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

Package org.apache.lucene.geo

# Class XYPolygon

java.lang.Object
org.apache.lucene.geo.Geometry
org.apache.lucene.geo.XYGeometry
org.apache.lucene.geo.XYPolygon

public final class XYPolygon extends XYGeometry
Represents a polygon in cartesian space. You can construct the Polygon directly with `float[]`, `float[]` x, y arrays coordinates.

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `final float`
  `maxX`
  maximum x of this polygon's bounding box area
  `final float`
  `maxY`
  maximum y of this polygon's bounding box area
  `final float`
  `minX`
  minimum x of this polygon's bounding box area
  `final float`
  `minY`
  minimum y of this polygon's bounding box area

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `XYPolygon(float[] x, float[] y, XYPolygon... holes)`
  Creates a new Polygon from the supplied x, y arrays, and optionally any holes.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `equals(Object obj)`
  `XYPolygon[]`
  `getHoles()`
  Returns a copy of the internal holes array
  `float[]`
  `getPolyX()`
  Returns a copy of the internal x array
  `float`
  `getPolyX(int vertex)`
  Returns x value at given index
  `float[]`
  `getPolyY()`
  Returns a copy of the internal y array
  `float`
  `getPolyY(int vertex)`
  Returns y value at given index
  `GeoUtils.WindingOrder`
  `getWindingOrder()`
  Returns the winding order (CW, COLINEAR, CCW) for the polygon shell
  `int`
  `hashCode()`
  `int`
  `numHoles()`
  returns the number of holes for the polygon
  `int`
  `numPoints()`
  returns the number of vertex points
  `protected Component2D`
  `toComponent2D()`
  get a Component2D from the geometry object
  `String`
  `toString()`
  `static String`
  `verticesToGeoJSON(float[] xs, float[] ys)`

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

  `create`

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

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

- ## Field Details

  - ### minX

    public final float minX
    minimum x of this polygon's bounding box area

  - ### maxX

    public final float maxX
    maximum x of this polygon's bounding box area

  - ### minY

    public final float minY
    minimum y of this polygon's bounding box area

  - ### maxY

    public final float maxY
    maximum y of this polygon's bounding box area

- ## Constructor Details

  - ### XYPolygon

    public XYPolygon(float[] x, float[] y, XYPolygon... holes)
    Creates a new Polygon from the supplied x, y arrays, and optionally any holes.

- ## Method Details

  - ### numPoints

    public int numPoints()
    returns the number of vertex points

  - ### getPolyX

    public float[] getPolyX()
    Returns a copy of the internal x array

  - ### getPolyX

    public float getPolyX(int vertex)
    Returns x value at given index

  - ### getPolyY

    public float[] getPolyY()
    Returns a copy of the internal y array

  - ### getPolyY

    public float getPolyY(int vertex)
    Returns y value at given index

  - ### getHoles

    public XYPolygon[] getHoles()
    Returns a copy of the internal holes array

  - ### getWindingOrder

    public GeoUtils.WindingOrder getWindingOrder()
    Returns the winding order (CW, COLINEAR, CCW) for the polygon shell

  - ### numHoles

    public int numHoles()
    returns the number of holes for the polygon

  - ### toComponent2D

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

  - ### hashCode

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

  - ### equals

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

  - ### verticesToGeoJSON

    public static String verticesToGeoJSON(float[] xs, float[] ys)

  - ### toString

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