gpt4 book ai didi

algorithm - 检测不规则形状运动物体碰撞的数据结构和算法

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:28:44 25 4
gpt4 key购买 nike

我遇到了这个面试题

Many irregularly shaped objects are moving in random directions. Provide a data structure and algorithm to detect collisions. Remember that the number of objects is in the millions.

我假设每个对象都有一个 x 和 y 坐标。其他假设是最受欢迎的。我想也应该使用某种树,但我对算法一无所知。

有什么建议吗?

最佳答案

我会看看 Plane Sweep AlgorithmBently-Ottmann Algorithm .它使用平面扫描在 O(n log(n)) 时间(和 O(n) 空间)内确定欧几里得平面上的线的交点。

关于algorithm - 检测不规则形状运动物体碰撞的数据结构和算法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5388754/

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