Class XYRectangle2D

  • All Implemented Interfaces:
    Component2D

    public class XYRectangle2D
    extends java.lang.Object
    implements Component2D
    2D rectangle implementation containing cartesian spatial logic.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private double maxX  
      private double maxY  
      private double minX  
      private double minY  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected XYRectangle2D​(double minX, double maxX, double minY, double maxY)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean contains​(double x, double y)
      relates this component2D with a point
      static Component2D create​(XYRectangle... rectangles)
      create a component2D from provided array of rectangles
      private boolean edgesIntersect​(double ax, double ay, double bx, double by)  
      boolean equals​(java.lang.Object o)  
      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
      int hashCode()  
      private int numberOfCorners​(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
      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
      java.lang.String toString()  
      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, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • minX

        private final double minX
      • maxX

        private final double maxX
      • minY

        private final double minY
      • maxY

        private final double maxY
    • Constructor Detail

      • XYRectangle2D

        protected XYRectangle2D​(double minX,
                                double maxX,
                                double minY,
                                double maxY)
    • 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
      • contains

        public boolean contains​(double x,
                                double y)
        Description copied from interface: Component2D
        relates this component2D with a point
        Specified by:
        contains 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
      • 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
      • edgesIntersect

        private boolean edgesIntersect​(double ax,
                                       double ay,
                                       double bx,
                                       double by)
      • numberOfCorners

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

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • create

        public static Component2D create​(XYRectangle... rectangles)
        create a component2D from provided array of rectangles