用什么算法来找到多边形与圆之间的交叉区域? [英] What algorithm use to find the intersection area between polygon and circle?

查看:638
本文介绍了用什么算法来找到多边形与圆之间的交叉区域?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有地图。在地图上层的顶部有一个多边形A和B.圆他们相交对方。任何算法可以计算交叉路口C的区域?

I have map. On the top of map layer have a polygon A and circle B. They are intersected each others. Any algorithm can calculate the area of intersection C ?

推荐答案

假设你愿意承担的圆圈(具有大量边的多边形...)的近似值,然后有一堆的算法计算多边形裁剪的结果(见这里,为的简短列表)。

Assuming that you're willing to take an approximation of the circle (a polygon with a large number of sides...) then there are a bunch of algorithms to compute the result of polygon clipping (see here, for a short listing).

一个简单的实现pretty的归结为:

A simple implementation pretty boils down to:

  1. 在决定如何破解多边形A的点位于多边形B中,反之亦然
  2. 确定交点为线段的点交叉该内外边界,和
  3. 从组收集点,构建新的多边形。为了计算出新的多边形的面积,你可以分解成三角形的集合,总结他们的领域。

如果你不喜欢通过所有的工作,尽量 JS快船。它可能会让你的生活更轻松。

If you don't feel like going through all of that work, try JS Clipper. It will probably make your life easier.

如果你不愿意凑合用你的圈子中的任意好的近似,我想你必须开始寻找多边形线段和你的圈子的边界之间的交点,然后分段整合各个部分。

If you're not willing to make do with an arbitrarily good approximation of your circle, I figure you have to start finding intersections between polygon line segments and the boundary of your circle, then piecewise integrating each section.

这篇关于用什么算法来找到多边形与圆之间的交叉区域?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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