如何相交多个多边形? [英] How to intersect multiple polygons?

查看:161
本文介绍了如何相交多个多边形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在寻找一种算法具有以下输入和输出:

I am looking for an algorithm with the following input and output:

输入:一组在一个平面多边形。例如。 P1,... P n与S。(P1,...的Pn可能是凹的,S是凸的。)

Input: A set of polygons in a plane. E.g. P1...Pn and S. (P1...Pn might be concave, S is convex.)

输出:在此平面多边形theset那等于S的差异,P1的结合......该地区的Pn

Output: The area of theset of polygons in this plane that equals the difference of S and the union of P1...Pn.

我发现算法相交或合并两个多边形。但由于每个这些操作可能会产生一些多边形我createt多边形吨,如果我做到了天真的。

I found algorithms to intersect or merge TWO polygons. But since each of those operations might produce several polygons I createt tons of polygons if I did it naively.

所以:?如何处理多个多边形的交叉

So: How to handle the intersection of multiple polygons?

这将是确定,如果所有的多边形是连接在一起的,因为只有该地区是我后。我的想法是利用定向多边形来模拟孔,但后来我再次有问题找出来,如果​​我有一个最小的重presentation为N可能会爆炸。 [你明白我在说什么?这是相当奇怪的......)

It would be ok, if all polygons are connected together since only the area is what I am after. My thought was to use directed polygons to simulate holes but then I again have the problem to find out if I have a "minimal representation" as n could blow up. [Do you understand what I am talking about? It's quite strange...)

推荐答案

您可能抛出的所有边连成一个扫描线算法。它可能不是最优的(?),但至少你会得到你所寻找的最小重新presentation。

You could throw all edges together into a sweep line algorithm. It may not be optimal (?) but at least you will get the minimal representation you are looking for.

这篇关于如何相交多个多边形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆