Class Polygon


  • public final class Polygon
    extends java.lang.Object
    Class defining (and storing the vertices of) a polygon on the unit sphere. The original 2D method comes from https://wrf.ecse.rpi.edu//Research/Short_Notes/pnpoly.html We adapted it here to the case of the sphere. Remark: in the case of polygons having all their points on a semi-hemisphere, we could have use the classical 2D algorithm on the points projected on a plane by the Gnomonic projections (centered to the center of the MEC). In the gnomonic projection, all great circles arc are strait lines.
    Author:
    F.-X. Pineau
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Polygon.ContainsSouthPoleComputer
      Defines the method used to know if the south pole is in the polygon or in its complement.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(CooXYZ p)
      Returns true if the polygon contain the point p.
      boolean intersectSegAB​(CooXYZ a, CooXYZ b)
      Returns true if an edge of the polygone intersects the line defined by the two given points.
      int nVertices()
      Returns the number of vertices the polygon contains.
      CooXYZ vertex​(int vertexIndex)
      Returns the vertex located at the given index in the polygin vertex list.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • nVertices

        public int nVertices()
        Returns the number of vertices the polygon contains.
        Returns:
        the number of vertices the polygon contains.
      • vertex

        public CooXYZ vertex​(int vertexIndex)
        Returns the vertex located at the given index in the polygin vertex list.
        Parameters:
        vertexIndex - index of the vertex we want to access (in [0, nVertices[
        Returns:
        the vertex located at the given index in the polygin vertex list.
      • contains

        public boolean contains​(CooXYZ p)
        Returns true if the polygon contain the point p.
        Parameters:
        p - point to test
        Returns:
        true if the polygon contain the point p.
      • intersectSegAB

        public boolean intersectSegAB​(CooXYZ a,
                                      CooXYZ b)
        Returns true if an edge of the polygone intersects the line defined by the two given points.
        Parameters:
        a - first segment point
        b - second segment point
        Returns:
        true if an edge of the polygone intersects the line defined by the two given points.