如何找到矩形的区域被覆盖另一个矩形矩形、被覆、区域

由网友(云雾)分享简介:我有一点名单[XMIN,YMIN,XMAX,YMAX]每个作为展示用黑点I have a list of point [xmin,ymin,xmax,ymax] for each as show by black point如何找到它们正在覆盖另一个矩形和多少被覆盖.the算法应该是有效的矩形。一个解决办法是检查每...

我有一点名单[XMIN,YMIN,XMAX,YMAX]每个作为展示用黑点

I have a list of point [xmin,ymin,xmax,ymax] for each as show by black point

如何找到它们正在覆盖另一个矩形和多少被覆盖.the算法应该是有效的矩形。一个解决办法是检查每一个矩形相互长方形这将需要哦的时间复杂度(N ^ 2),但我需要高效的算法。

How to find which are the rectangles that are being covered by another rectangle and how much it is being covered .the algorithm should be efficient. one solution would be to check every rectangle with each other rectangle which would take a time complexity of O(n^2) , but I need efficient algorithm.

请注意,有很多这样的长方形的秀形象。红色应该去除,绿一片被检测应保持。

Note that there are many such rectangle as show in image.the red one should be detected for removal and green one should be kept.

输入为n的矩形 输出覆盖和矩形ID其所覆盖的区域。 这将是preferable给予一定的算法和解释。

Input is n rectangle output is area of covering and rectangle id to which it cover . It would be preferable to give some algorithm and explanation.

推荐答案

说矩形的名单,说最后的名单,只有拥有绿色的是< codeG 。该矩形可以添加一个又一个G之前每次添加,它是在

阅读全文

相关推荐

最新文章