intersects method
Tests whether this rectangle intersects with another rectangle.
Determines if the two rectangles have any overlapping area, including cases where they share an edge or corner. The test uses standard rectangle intersection logic comparing the bounds of both rectangles.
Parameters
area: The RectangleGeographicArea to test for intersection.
Returns
trueif the rectangles intersect or touch,falseif they are completely separate.
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;
}