[英]Algorithm required to determine if a rectangle is completely covered by a set of polygons
Given a set of polygons P and a rectangular area A, I need to verify if A is completely covered by P. 给定一组多边形P和矩形区域A,我需要验证A是否被P完全覆盖。
The number and complexity of the polygons and the total area A are significantly large and so, a polygon union-based approach might not work in time. 多边形的数量和复杂性以及总面积A非常大,因此,基于多边形联合的方法可能无法及时发挥作用。 To make things a bit simpler, I defined A' as the size of the smallest area inside A whose coverage I care about.
为了使事情变得简单,我将A'定义为A中最小区域的大小,我关心它的覆盖范围。 I thought of building up a 2D segment-tree like structure dividing the area in 2D repeatedly(each area square breaks into 4 child squares until the child square size is A') but since we are dealing with polygons here, I am not sure if this would be efficient enough.
我想要建立一个2D段 - 树状结构,重复划分2D区域(每个区域方块分成4个子方块,直到子方块大小为A')但是由于我们在这里处理多边形,我不确定是否这样就足够了。
You can use polygon intersection or difference instead of union: 您可以使用多边形交集或差异而不是联合:
Consider A itself as a polygon and each time pick a polygon P' and refine A as A - P', and check to see if A is empty. 将A本身视为多边形,每次选择一个多边形P'并将A精炼为A-P',并检查A是否为空。 After checking all polygons you can say for sure whether A is covered by P or not.
检查完所有多边形后,您可以确定A是否被P覆盖。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.