圈-AABB遏制测试
我目前正在编写一个基于细分空间的系统(用于游戏),我需要能够测试一个圆是否完全包含一个正方形。
为了加分,我应该指出我的系统在 N 维上工作,所以如果你的算法通过循环每个维度并做一些事情来工作,那么就这样呈现它;)
I'm currently in the throes of writing a system based on subdividing space (it's for a game), I need to be able to test if a circle completely contains a square.
For bonus points, I should point out that my system works in N dimensions, so if your algorithm works by looping through each dimension and doing something, present it as such ;)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 2^N 个角点中,只需检查距超球面中心最远的角点是否在超球面内部。
所以:
Of the 2^N corners, you only need to check that the furthest corner from the center of the hypersphere is inside the hypersphere.
So:
您可能想要存储球体的 maxsq 而不是每次都重新计算它(这是一个非常小的费用)。
You may want to store maxsq for the sphere rather than recomputing it every time (a very minor expense).