intersects method

bool intersects(
  1. RectangleGeographicArea area
)

Checks if this rectangle intersects with another rectangle.

Parameters

Returns

  • True if the rectangles intersect, false otherwise.

Implementation

bool intersects(final RectangleGeographicArea area) {
  return bottomRight.longitude >= area.topLeft.longitude &&
      area.bottomRight.longitude >= topLeft.longitude &&
      topLeft.latitude >= area.bottomRight.latitude &&
      area.topLeft.latitude >= bottomRight.latitude;
}