轴对齐的矩形交集矩形

2023-09-11 03:00:09 作者:秒杀伱的高傲

我需要一个算法,需要的轴线排列的矩形和一个排序的数组 返回任何对矩形的重叠

I need an algorithm that takes an unsorted array of axis aligned rectangles and returns any pair of rectangles that overlaps

每个矩形具有两个变量,协调左上角和右下角

Each rectangle has two variables, coordinates of the upper-left corner and the bottom-right corner

推荐答案

这可能是一个有点复杂的面试,要看是什么样的工作, 这是一个几何计算一种算法,

It might be a bit complicated for a job interview , depends what kind of job, It's a geometric computation kind of algorithm,

答案可以在这里找到: http://www.cs.princeton.edu/~rs/AlgsDS07/17GeometricSearch.pdf

The answer can be found here: http://www.cs.princeton.edu/~rs/AlgsDS07/17GeometricSearch.pdf