Example #1
0
 public boolean equals(Object other) {
     if (other == this) return true;
     if (other == null) return false;
     if (other.getClass() != this.getClass()) return false;
     RectHV that = (RectHV) other;
     if (this.xmin != that.xmin) return false;
     if (this.ymin != that.ymin) return false;
     if (this.xmax != that.xmax) return false;
     if (this.ymax != that.ymax) return false;
     return true;
 }
Example #2
0
 /**
  * Returns true if the two rectangles intersect. This includes
  * <em>improper intersections</em> (at points on the boundary
  * of each rectangle) and <em>nested intersctions</em>
  * (when one rectangle is contained inside the other)
  *
  * @param  that the other rectangle
  * @return {@code true} if this rectangle intersect the argument
            rectangle at one or more points
  */
 public boolean intersects(RectHV that) {
     return this.xmax >= that.xmin && this.ymax >= that.ymin
         && that.xmax >= this.xmin && that.ymax >= this.ymin;
 }