Find area of region where k rectangles intersect?

Revision en2, by DollarAkshay, 2019-07-26 02:04:06

Given a list rectangles [R1, R2, R3] defined by their lower left and upper right [(x1, y1), (x2, y2)] coordinates, and a value k.

Is there an optimal way to find area where k rectangles overlap?

For example:

R1: [(1, 1), (5, 5)]
R2: [(4, 4), (7, 6)]
R3: [(3, 3), (8, 7)]

rectangles = [R1, R2, R3]
k = 2

The area which is overlapped by two rectangles is 8.

Source : https://stackoverflow.com/questions/57192928/given-n-rectangles-coordinates-find-area-of-region-where-k-rectangles-intersect/

Grid Image

Tags #grid, #geometry, #help

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English DollarAkshay 2019-07-26 02:04:06 0 (published)
en1 English DollarAkshay 2019-07-26 02:03:20 644 Initial revision (saved to drafts)