org.apache.lucene.geo

## Class Polygon2D

- java.lang.Object
- - org.apache.lucene.geo.EdgeTree
  - - org.apache.lucene.geo.Polygon2D

-     public final class Polygon2D
      extends EdgeTree

  2D polygon implementation represented as a balanced interval tree of edges.

  Loosely based on the algorithm described in http://www-ma2.upc.es/geoc/Schirra-pointPolygon.pdf.

  NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.geo.EdgeTree

      `left, maxLat, maxLon, maxX, maxY, minLat, minLon, right, splitX, tree`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected PointValues.Relation` | `componentRelate(double minLat, double maxLat, double minLon, double maxLon)` Returns relation to the provided rectangle for this component
    `protected PointValues.Relation` | `componentRelateTriangle(double ax, double ay, double bx, double by, double cx, double cy)`
    `boolean` | `contains(double latitude, double longitude)` Returns true if the point is contained within this polygon.
    `static Polygon2D` | `create(Polygon... polygons)` Builds a Polygon2D from multipolygon

    - ### Methods inherited from class org.apache.lucene.geo.EdgeTree

      `createTree, internalComponentRelate, relate, relateTriangle`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### contains

          public boolean contains(double latitude,
                                  double longitude)

      Returns true if the point is contained within this polygon.

      See https://www.ecse.rpi.edu/~wrf/Research/Short_Notes/pnpoly.html for more information.

    - #### componentRelateTriangle

          protected PointValues.Relation componentRelateTriangle(double ax,
                                                                 double ay,
                                                                 double bx,
                                                                 double by,
                                                                 double cx,
                                                                 double cy)

      Overrides:
        `componentRelateTriangle` in class `EdgeTree`

    - #### componentRelate

          protected PointValues.Relation componentRelate(double minLat,
                                                         double maxLat,
                                                         double minLon,
                                                         double maxLon)

      Returns relation to the provided rectangle for this component
      Overrides:
        `componentRelate` in class `EdgeTree`

    - #### create

          public static Polygon2D create(Polygon... polygons)

      Builds a Polygon2D from multipolygon

Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.