Class Rectangle

    • Constructor Summary

      Constructors 
      Constructor Description
      Rectangle​(float x, float y, float x2, float y2)
      Creates a new Rectangle with the given coordinates.
      Rectangle​(Region src)  
    • Constructor Detail

      • Rectangle

        public Rectangle​(float x,
                         float y,
                         float x2,
                         float y2)
        Creates a new Rectangle with the given coordinates. Note that the coordinates are assigned such that lx <= rx and by <= ty. So, e.g. x2 could be assigned to rx() or lx().
      • Rectangle

        public Rectangle​(Region src)
    • Method Detail

      • xpos

        public final float xpos()
        Specified by:
        xpos in interface Region
      • endxpos

        public final float endxpos()
        Specified by:
        endxpos in interface Region
      • ypos

        public final float ypos()
        Specified by:
        ypos in interface Region
      • width

        public final float width()
        Description copied from interface: Region
        The width of this region.
        Specified by:
        width in interface Region
      • endypos

        public final float endypos()
        Specified by:
        endypos in interface Region
      • height

        public final float height()
        Description copied from interface: Region
        The total height of this region.
        Specified by:
        height in interface Region
      • area

        public final float area()
        Description copied from interface: Region
        The total area of this region.
        Specified by:
        area in interface Region
      • bounds

        public Region bounds()
        Description copied from interface: Region
        Instances of Region will always return themselves from their bounds implementations.
        Specified by:
        bounds in interface Bounded
        Specified by:
        bounds in interface Region
      • lx

        public float lx()
        Description copied from interface: Region
        The left edge of this region.
        Specified by:
        lx in interface Region
      • rx

        public float rx()
        Description copied from interface: Region
        The right edge of this region.
        Specified by:
        rx in interface Region
      • by

        public float by()
        Description copied from interface: Region
        The bottom edge of this region.
        Specified by:
        by in interface Region
      • ty

        public float ty()
        Description copied from interface: Region
        The top edge of this region.
        Specified by:
        ty in interface Region
      • intersects

        public static boolean intersects​(Region r1,
                                         Region r2)
        Returns true only if any portion of the two Regions intersect.
      • contains

        public static boolean contains​(Region query,
                                       Region r)
        Returns true only if r is entirely contained within query.
      • union

        public static final Rectangle union​(Region... regions)
        Returns a Rectangle whose coordinates represent the minimum bounding rectangle of all of the provided rectangles.
        Throws:
        IllegalArgumentException - if no regions are provided
      • intersection

        public static Rectangle intersection​(Region... regions)
        Returns a Rectangle that is the intersection of start and all of the remaining provided Regions, or null if there is no common intersection.
        Throws:
        IllegalArgumentException - if no regions are provided