方法来检测矩形和多边形之间的相交?多边形、矩形、方法来

由网友(初遇時紅了臉)分享简介:什么是检测红色矩形是否黑多边形重叠的最佳方法?请参阅本图片:What is the best method to detect whether the red rectangle overlaps the black polygon? Please refer to this image:推荐答案如果您的多边形是不...

什么是检测红色矩形是否黑多边形重叠的最佳方法?请参阅本图片:

What is the best method to detect whether the red rectangle overlaps the black polygon? Please refer to this image:

推荐答案

如果您的多边形是不是凸,您可以使用的镶嵌细分成凸子部分。既然你正在寻找方法来检测可能的碰撞,我想你可以看看的的 GJK算法了。即使你并不需要的东西,功能强大(它提供了两个凸形状和相关证人点之间的最小距离信息),它可能被证明是有用的,如果你决定要处理更多不同的凸形。

If your polygon is not convex, you can use tessellation to subdivide it into convex subparts. Since you are looking for methods to detect a possible collision, I think you could have a look at the GJK algorithm too. Even if you do not need something that powerful (it provides information on the minimum distance between two convex shapes and the associated witness points), it could prove to be useful if you decide to handle more different convex shapes.

克里斯特埃里克森打了一个漂亮的简报presentation 如果您想了解更多关于这算法。您还可以看看他的书,实时碰撞检测的,这既是全面和方便的人发现碰撞检测算法。

Christer Ericson made a nice Powerpoint presentation if you want to know more about this algorithm. You could also take a look at his book, Real-Time Collision Detection, which is both complete and accessible for anyone discovering collision detection algorithms.

阅读全文

相关推荐

最新文章