makeIntersection method

RectangleGeographicArea makeIntersection(
  1. RectangleGeographicArea area
)

Creates a new RectangleGeographicArea as the intersection of this rectangle and another rectangle.

Parameters

Returns

Implementation

RectangleGeographicArea makeIntersection(final RectangleGeographicArea area) {
  return RectangleGeographicArea(
    topLeft: Coordinates(
      longitude: max(topLeft.longitude, area.topLeft.longitude),
      latitude: min(topLeft.latitude, area.topLeft.latitude),
    ),
    bottomRight: Coordinates(
      longitude: min(bottomRight.longitude, area.bottomRight.longitude),
      latitude: max(bottomRight.latitude, area.bottomRight.latitude),
    ),
  );
}