Class Polygon2D

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Component2D holes
      tree of holes, or null
      private double maxX
      maximum X of this geometry's bounding box area
      private double maxY
      maximum Y of this geometry's bounding box area
      private double minX
      minimum X of this geometry's bounding box area
      private double minY
      minimum Y of this geometry's bounding box area
      (package private) EdgeTree tree
      Edges of the polygon represented as a 2-d interval tree.
    • 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.
      boolean containsLine​(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
      return true if this component2D contains the provided line
      boolean containsTriangle​(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
      return true if this component2D contains the provided triangle
      (package private) static Component2D create​(Polygon polygon)
      Builds a Polygon2D from LatLon polygon
      (package private) static Component2D create​(XYPolygon polygon)
      Builds a Polygon2D from XY polygon
      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
      boolean intersectsLine​(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY)
      return true if this component2D intersects the provided line
      boolean intersectsTriangle​(double minX, double maxX, double minY, double maxY, double aX, double aY, double bX, double bY, double cX, double cY)
      return true if this component2D intersects the provided triangle
      private int numberOfCorners​(double minX, double maxX, double minY, double maxY)  
      PointValues.Relation relate​(double minX, double maxX, double minY, double maxY)
      relates this component2D with a bounding box
      Component2D.WithinRelation withinLine​(double minX, double maxX, double minY, double maxY, double aX, double aY, boolean ab, double bX, double bY)
      Compute the within relation of this component2D with a line
      Component2D.WithinRelation withinPoint​(double x, double y)
      Compute the within relation of this component2D with a point
      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 Y of this geometry's bounding box area
      • maxY

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

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

        private final double maxX
        maximum X 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

        private 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
      • 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
      • intersectsLine

        public boolean intersectsLine​(double minX,
                                      double maxX,
                                      double minY,
                                      double maxY,
                                      double aX,
                                      double aY,
                                      double bX,
                                      double bY)
        Description copied from interface: Component2D
        return true if this component2D intersects the provided line
        Specified by:
        intersectsLine in interface Component2D
      • intersectsTriangle

        public boolean intersectsTriangle​(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
        return true if this component2D intersects the provided triangle
        Specified by:
        intersectsTriangle in interface Component2D
      • containsLine

        public boolean containsLine​(double minX,
                                    double maxX,
                                    double minY,
                                    double maxY,
                                    double aX,
                                    double aY,
                                    double bX,
                                    double bY)
        Description copied from interface: Component2D
        return true if this component2D contains the provided line
        Specified by:
        containsLine in interface Component2D
      • containsTriangle

        public boolean containsTriangle​(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
        return true if this component2D contains the provided triangle
        Specified by:
        containsTriangle in interface Component2D
      • withinLine

        public Component2D.WithinRelation withinLine​(double minX,
                                                     double maxX,
                                                     double minY,
                                                     double maxY,
                                                     double aX,
                                                     double aY,
                                                     boolean ab,
                                                     double bX,
                                                     double bY)
        Description copied from interface: Component2D
        Compute the within relation of this component2D with a line
        Specified by:
        withinLine 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
      • numberOfCorners

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

        static Component2D create​(Polygon polygon)
        Builds a Polygon2D from LatLon polygon