gpt4 book ai didi

Box2d:为什么不是凹形?

转载 作者:行者123 更新时间:2023-12-02 05:10:56 25 4
gpt4 key购买 nike

box2d 似乎不支持凹形状,但我没有找到任何关于为什么不支持凹形状的解释,以及您必须创建多个凸形状才能实现所需形状的事实。仅支持凹形形状以便您只需创建一个形状不是更容易吗?

那么聪明的人能否尝试解释一下为什么 box2d 不支持凹形,例如技术部分等?拥有多个形状而不是一个形状是否会占用更多内存?

这确实可以让世界对我来说更有意义!

最佳答案

Box2D 由 Erin Catto 和 "Box2D is not open contribution" 编写/开发。因此,对于为什么 Box2D 不支持凹形形状的答案,我们必须向他求助。

幸运的是,Box2D 有一个网络论坛,其中包含以下问题(从 2010 年开始,在其一般讨论部分):Why do shapes have to be convex?

Erin's first response is :

I think this explains it well enough: http://en.wikipedia.org/wiki/Separating_axis_theorem

There are techniques for handling concave shapes. They typically require a lot of memory and setup. For example, I've seen some papers that use signed distance maps. But they are often very light on details.

在稍后的讨论中,Erin adds我认为这是一个富有洞察力的 gem :

AFAIK there are no high quality, high performance algorithms for concave narrow-phase collision. As it stands, there is little written about how to compute contact points and normals for convex shapes, let alone concave shapes.

这让我们想到了一个相关的 StackOverflow 问题(2013 年起):Algorithms for collision detection between concave polygons 。迄今为止,这个问题只有一个答案,并且引用了 2003 年的一篇论文。这似乎证实了 Erin 的立场和主张。

关于Box2d:为什么不是凹形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41515307/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com