Class RealRect


  • public class RealRect
    extends Object
    A class for representing a rectangular region, in real coordinates.
    Author:
    Barry DeZonia, Curtis Rueden
    • Field Detail

      • x

        public double x
      • y

        public double y
      • width

        public double width
      • height

        public double height
    • Constructor Detail

      • RealRect

        public RealRect()
      • RealRect

        public RealRect​(double x,
                        double y,
                        double width,
                        double height)
    • Method Detail

      • intersects

        public boolean intersects​(RealRect r)
        Returns true if this rect intersects the given rect.
      • intersection

        public RealRect intersection​(RealRect r)
        Returns a Rect representing the intersection of this Rect with the given Rect. If the two Rects do not intersect, the result is an empty Rect.
      • contains

        public boolean contains​(RealCoords coords)
        Tests whether the given coordinates lie within the rectangle.
      • getTopLeft

        public RealCoords getTopLeft()
        Gets the top left coordinate of the rectangle.
      • getBottomRight

        public RealCoords getBottomRight()
        Gets the bottom right coordinate of the rectangle.
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object