Math, asked by Mayuri912, 1 year ago

Is collection of rectangles in a given plane,a set?

Answers

Answered by Anonymous
9
The easiest solution if you know the distribution of the data is to build a grid and index all the rectangles keyed by all the grid points they overlap. Then at intersection time you look at the points that your curent rectangle is overlapping and at the points close to them.

Quad trees are another option. Somewhat easy to implement and some decent performance.

Or you could transform each rectangle in a point in 4d and the problem becomes answering 4d orthogonal range queries. You can use a range tree for that.
Similar questions