关于Sweep and Prune 算法

简介:
在第一阶段的检测(BroadPhase)中所需要的算法就是 Sweep and Prune ,因为从未接触过此类的东西,所以不知道到底是个什么东西,今天终于找到具体资料了,一看,晕倒掉了.原来就是<游戏编程精粹2>里面所提及到的 逐维递归分组法...
貌似如果有人搜索相关词汇是能够搜索到我的blog的,特别留下此文以防止有哥们走我同样的弯路了...


顺便放一个英文东西:
来自于:http://parallel.vub.ac.be/documentation/pvm/Example/Marc_Ramaekers/node3.html
Sweep and Prune
Given a number  N  of objects,  O ( N2 ) object pairs have to be checked for collision. In general, the objects in most of the pairs aren't even close to each other so we should be able to eliminate them quickly. To do this we use a technique called Sweep and Prune ([ CLMP95 ]). In this section I will briefly introduce this technique.

To determine whether two objects are close enough to potentially collide, the Sweep and Prune checks whether the axis aligned bounding boxes of the respective objects overlap. If they do, further investigation is necessary. If not, the objects can't possibly collide and the algorithm can move on. To determine whether two bounding boxes overlap, the algorithm reduces the 3D problem to three simpler 1D problems. It does so by determining the intervals occupied by the bounding volume along each of the x,y and z axes. If and only if the intervals of two bounding volumes overlap in all of the three dimensions, the objects corresponding to these bounding volumes must overlap. To determine which intervals of the objects along an axis overlap, the list of the intervals is sorted. Normally, using quick-sort, this would be an $O(N \log N)$ process. However, by exploiting frame coherence (the similarity between situations in two subsequent frames) we can sort the lists in an expected (O(N), using insertion sort.

Another difficult part in the Sweep and Prune approach is the maintenance of the bounding volume. If the objects in the scene move or rotate, the previously calculated bounding boxes are invalid. It is important to be able to update the boxes as quickly as possible. Again, we can do this by exploiting frame coherence.

The algorithm's performance is of course dependent on the application and the typical situations that occur in that application. Many variations exists, such as reducing the overlap problem by only 1 dimension and using a rectangle intersection test. It is also possible to choose other types of bounding volumes that might be faster to update but produce a less accurate approximation of the object.

目录
相关文章
|
5月前
|
算法
【面试算法——动态规划 21】不同的子序列(hard)&& 通配符匹配(hard)
【面试算法——动态规划 21】不同的子序列(hard)&& 通配符匹配(hard)
|
5月前
|
算法 JavaScript
什么是diff算法?
什么是diff算法?
38 0
|
12月前
|
算法 JavaScript
diff算法
diff算法
|
机器学习/深度学习 自然语言处理 算法
逆向最大匹配(Backward Maximum Matching)
逆向最大匹配(Backward Maximum Matching)是一种分词算法。它的工作原理与正向最大匹配相反,即从字符串结尾开始查找。
212 1
|
机器学习/深度学习 自然语言处理 算法
正向最大匹配(Forward Maximum Matching)
正向最大匹配(Forward Maximum Matching)是一种查找文本字符串中词语的算法。
392 1
|
算法 JavaScript
什么是diff算法
什么是diff算法
60 0
通过bcftools合并不同种群的vcf文件
通过bcftools合并不同种群的vcf文件
|
算法
Brute-Force模式匹配算法
Brute-Force匹配算法,翻译过来可以叫暴力匹配算法,典型应用场景就是字符串的匹配问题,比如寻找一个子串在主串中第一次出现的下标。这种匹配算法的逻辑是这样的:选取主串中指定位置作为匹配的起点(这篇文章使用的是首位作为起点),将子串起点与该起点对比,比对成功后起点后移一位,子串的起点同样后移一位继续比较,直到将子串与主串中全部匹配;若是中途出现比对失败的情况,则将主串从原起点的下一位开始继续这种比较。下面就根据BF算法使用while循环和for循环来分别实现字符串的匹配问题。
228 0
Brute-Force模式匹配算法
|
Java
hg diff仅对当前目录下的文件有效
hg diff仅对当前目录下的文件有效
69 0
下一篇
无影云桌面