I'm working on a dashboarding application and want to be able to quickly tell if a new widget overlaps any other and if so, which ones it overlaps. Each widget is a rectangle with a left, top, width, and height dimension. Is there an efficient data structure I can use or way to do this?
Asked
Active
Viewed 55 times
0
-
How many rectangles are you expecting to have? I would think that for most useful cases, a simple array would suffice. – Scott Sauyet Mar 09 '21 at 20:33
-
Can you share what you've tried so far? – Scott Sauyet Mar 09 '21 at 21:01
-
1Voted to reopen, as this was tagged javascript, and a python duplicate might not be appropriate. Also that was an *m x n* problem and this is *1 x n*. On the other hand, we need to OP to show more effort before answering. – Scott Sauyet Mar 09 '21 at 21:06
-
Yeah, that was the right duplicate. The top answer barely mentions Python; this isn't really a language question. – David Eisenstat Mar 10 '21 at 22:35