I think I'm facing a pretty common issue but cannot remember which solution is the most suitable one.
Let's put it that way: I can, in a, certain, given, language get some events anytime the user is moving the mouse. I therefore get the position the current cursor position in let's say in absolute coordinates based system.
Now considering that this system is also capable of containing up to thousands of thousands of shape objects (with a certain location point and size). In a first rough approximation, we can think about them as their related bounding boxes in order to make the lookup operation and classification a bit more simpler, let's also add another simplification by omitting the fact that shapes can overlap each other.
What can be the best data structures to retrieve the shape(s) under the cursor position and allow relative fast insertion / deletion / modification operations?
Thanks,
ps: I was thinking about some sort of sorted trees but I think they are pretty demanding when it comes about maintaining their internal sort.
Additional curiosity: how it works in Winforms? I mean the Control class in the .NET Framework is related to the underlying HWANDLE in windows and capable of firing events when cursor is entering or leaving a Control. I do not really think that there is a thread allocated to perform some dummy hit tests... and trigger the related events.