General problem statement:
Design on-canvas shape selection engine
Given:
Arbitrary convex shapes on the 2D plane. ( say represted by std::vector < IShape* >, IShape has getBBox() member )
Question:
Find and return collection/subset of shapes that are within given rectangular region.
(in this particular example should return shapes A and B )
I know this typical range range-seach/range-query problem, however the "classical" examples are referring to searching of points in the given region to illustrate how kdtree can be used to solve the problem.
I can't figure out how to "extend" algorithm to work on shapes instead. I am more looking for idea rather than exact implementation.
( I am not considering trivial looping over each shape to see whether is in or out of given region )