Class Polygon2D

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Component2D holes
      tree of holes, or null
      private double maxX
      maximum longitude of this geometry's bounding box area
      private double maxY
      maximum latitude of this geometry's bounding box area
      private double minX
      minimum longitude of this geometry's bounding box area
      private double minY
      minimum latitude of this geometry's bounding box area
      (package private) EdgeTree tree
      Edges of the polygon represented as a 2-d interval tree.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Polygon2D​(double minX, double maxX, double minY, double maxY, double[] x, double[] y, Component2D holes)  
      protected Polygon2D​(Polygon polygon, Component2D holes)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(double x, double y)
      Returns true if the point is contained within this polygon.
      static Component2D create​(Polygon... polygons)
      Builds a Polygon2D from multipolygon
      double getMaxX()
      max X value for the component
      double getMaxY()
      max Y value for the component
      double getMinX()
      min X value for the component
      double getMinY()
      min Y value for the component
      private boolean internalContains​(double x, double y)  
      private int numberOfCorners​(double minX, double maxX, double minY, double maxY)  
      private int numberOfTriangleCorners​(double ax, double ay, double bx, double by, double cx, double cy)  
      PointValues.Relation relate​(double minX, double maxX, double minY, double maxY)
      relates this component2D with a bounding box
      private PointValues.Relation relateIndexedLineSegment​(double minX, double maxX, double minY, double maxY, double a2x, double a2y, double b2x, double b2y)
      relates an indexed line segment (a "flat triangle") with the polygon
      private PointValues.Relation relateIndexedTriangle​(double minX, double maxX, double minY, double maxY, double ax, double ay, double bx, double by, double cx, double cy)
      relates an indexed triangle with the polygon
      PointValues.Relation relateTriangle​(double minX, double maxX, double minY, double maxY, double ax, double ay, double bx, double by, double cx, double cy)
      relates this component2D with a triangle
      Component2D.WithinRelation withinTriangle​(double minX, double maxX, double minY, double maxY, double ax, double ay, boolean ab, double bx, double by, boolean bc, double cx, double cy, boolean ca)
      Compute the within relation of this component2D with a triangle
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • minY

        private final double minY
        minimum latitude of this geometry's bounding box area
      • maxY

        private final double maxY
        maximum latitude of this geometry's bounding box area
      • minX

        private final double minX
        minimum longitude of this geometry's bounding box area
      • maxX

        private final double maxX
        maximum longitude of this geometry's bounding box area
      • holes

        protected final Component2D holes
        tree of holes, or null
      • tree

        final EdgeTree tree
        Edges of the polygon represented as a 2-d interval tree.
    • Constructor Detail

      • Polygon2D

        protected Polygon2D​(double minX,
                            double maxX,
                            double minY,
                            double maxY,
                            double[] x,
                            double[] y,
                            Component2D holes)
    • Method Detail

      • getMinX

        public double getMinX()
        Description copied from interface: Component2D
        min X value for the component
        Specified by:
        getMinX in interface Component2D
      • getMaxX

        public double getMaxX()
        Description copied from interface: Component2D
        max X value for the component
        Specified by:
        getMaxX in interface Component2D
      • getMinY

        public double getMinY()
        Description copied from interface: Component2D
        min Y value for the component
        Specified by:
        getMinY in interface Component2D
      • getMaxY

        public double getMaxY()
        Description copied from interface: Component2D
        max Y value for the component
        Specified by:
        getMaxY in interface Component2D
      • internalContains

        private boolean internalContains​(double x,
                                         double y)
      • relate

        public PointValues.Relation relate​(double minX,
                                           double maxX,
                                           double minY,
                                           double maxY)
        Description copied from interface: Component2D
        relates this component2D with a bounding box
        Specified by:
        relate in interface Component2D
      • relateTriangle

        public PointValues.Relation relateTriangle​(double minX,
                                                   double maxX,
                                                   double minY,
                                                   double maxY,
                                                   double ax,
                                                   double ay,
                                                   double bx,
                                                   double by,
                                                   double cx,
                                                   double cy)
        Description copied from interface: Component2D
        relates this component2D with a triangle
        Specified by:
        relateTriangle in interface Component2D
      • withinTriangle

        public Component2D.WithinRelation withinTriangle​(double minX,
                                                         double maxX,
                                                         double minY,
                                                         double maxY,
                                                         double ax,
                                                         double ay,
                                                         boolean ab,
                                                         double bx,
                                                         double by,
                                                         boolean bc,
                                                         double cx,
                                                         double cy,
                                                         boolean ca)
        Description copied from interface: Component2D
        Compute the within relation of this component2D with a triangle
        Specified by:
        withinTriangle in interface Component2D
      • relateIndexedLineSegment

        private PointValues.Relation relateIndexedLineSegment​(double minX,
                                                              double maxX,
                                                              double minY,
                                                              double maxY,
                                                              double a2x,
                                                              double a2y,
                                                              double b2x,
                                                              double b2y)
        relates an indexed line segment (a "flat triangle") with the polygon
      • relateIndexedTriangle

        private PointValues.Relation relateIndexedTriangle​(double minX,
                                                           double maxX,
                                                           double minY,
                                                           double maxY,
                                                           double ax,
                                                           double ay,
                                                           double bx,
                                                           double by,
                                                           double cx,
                                                           double cy)
        relates an indexed triangle with the polygon
      • numberOfTriangleCorners

        private int numberOfTriangleCorners​(double ax,
                                            double ay,
                                            double bx,
                                            double by,
                                            double cx,
                                            double cy)
      • numberOfCorners

        private int numberOfCorners​(double minX,
                                    double maxX,
                                    double minY,
                                    double maxY)
      • create

        public static Component2D create​(Polygon... polygons)
        Builds a Polygon2D from multipolygon