makeIntersection method
Creates a new RectangleGeographicArea as the intersection of this rectangle and another rectangle.
Parameters
- IN area The RectangleGeographicArea to intersect with.
Returns
- A new RectangleGeographicArea object representing the intersection.
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),
),
);
}