intersects method

bool intersects(
  1. BoundingBox boundingBox
)

Returns true if the rectange overlaps with the given rectangle. The rectangles intersect if their four edges overlap at least at one point. To determine an intersection, all four conditions must be met. @param boundingBox the BoundingBox which should be checked for intersection with this BoundingBox. @return true if this BoundingBox intersects with the given BoundingBox, false otherwise.

Implementation

bool intersects(BoundingBox boundingBox) {
  if (this == boundingBox) {
    return true;
  }

  return maxLatitude >= boundingBox.minLatitude &&
      maxLongitude >= boundingBox.minLongitude &&
      minLatitude <= boundingBox.maxLatitude &&
      minLongitude <= boundingBox.maxLongitude;
}