十字路口和多边形的联合 [英] intersection and union of polygons
问题描述
我用顶点定义了多边形,我需要计算它们的联合和交集的区域。最令人沮丧的是它在Mapping Toolbox中实现,但我无法购买它。有谁知道如何制作一个快速算法来计算它?
感谢您的时间。
我找到了我的多边形的交点并添加了交点/联合任务内/外多边形顶点(检查是否有多边形1的顶点位于多边形2内,反之亦然,使用'inpolygon')。然后将所有点转换为极坐标,中心位于矩阵的平均坐标中,并按角度排序,以形成连续的闭合轮廓。知道这一点,很容易找到使用'polyarea'的交叉点/联合区域。
I have polygons defined with their vertices's, and i need to calculate areas of their union and intersection. The most upsetting thing is that it is implemented in Mapping Toolbox, but i can't buy it. Does anyone knows how to make a fast algorithm to calculate it? Thank you for your time.
I found intersection points of my polygons and added vertices that are inside/outside polygons for intersection/union task (check if any of vertices of polygon 1 lies inside a polygon 2 and vice versa using 'inpolygon'). Then all points were transformed into polar coordinates with center in the mean coordinates of the matrix and sorted by angle, so that now they form consecutive closed contour. Knowing this it is easy to find intersection/union area using 'polyarea'.
这篇关于十字路口和多边形的联合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!