什么是有效的计算观察光线和一组对象之间的第一个十字路口的最佳方法? [英] What is the best approach to compute efficiently the first intersection between a viewing ray and a set of objects?

查看:147
本文介绍了什么是有效的计算观察光线和一组对象之间的第一个十字路口的最佳方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如:

这是方法来有效地计算观察光线和一组三个对象之间的第一个十字路口:一球一锥和一个气缸(其它3D元)

An approach to compute efficiently the first intersection between a viewing ray and a set of three objects: one sphere, one cone and one cylinder (other 3D primitives).

推荐答案

您正在寻找的是一个空间的分区方案。有很多处理这一选项,和许多这方面的研究花费也。一个良好的阅读将是克里斯特爱立信实时碰撞检测的。

What you're looking for is a spatial partitioning scheme. There are a lot of options for dealing with this, and lots of research spent in this area as well. A good read would be Christer Ericsson's Real-Time Collision Detection.

一个简单的方法包括在那本书是定义一个网格,将所有对象与之相交的所有单元格,并沿着网格单元相交的线走,从前到后,与此网格相关联的每个对象相交。请一个对象可能与多个网格单元相关的头脑,所以计算的交叉点实际上可能不会在当前单元格,但实际上后来。

One easy approach covered in that book would be to define a grid, assign all objects to all cells it intersects, and walk along the grid cells intersecting the line, front to back, intersecting with each object associated with that grid cell. Keep in mind that an object might be associated with more grid-cells, so the intersection point computed might actually not be in the current cell, but actually later on.

接下来的问题是如何定义的网格。遗憾的是,没有一个很好的答案,你需要考虑什么方法可能最适合您的方案。

The next question would be how you define that grid. Unfortunately, there's no one good answer, and you need to consider what approach might fit your scenario best.

地区其他分区方案是不同的树形结构,如 kd- ,< A HREF =htt​​p://en.wikipedia.org/wiki/Octree相对=nofollow>辛和的 BSP树的。你甚至可以考虑使用树相结合的网格。

Other partitioning schemes of interest are different tree structures, such as kd-, Oct- and BSP-trees. You could even consider using trees combined with a grid.

修改
正如指出的那样,如果你的设置实际上是这三样东西,你肯定更好只是相交的每一个,只是挑了最早的之一。如果你正在寻找光球,光筒等,相交测试,这些都不是真的很难和一个快速谷歌应该提供所有你有可能需要数学。 :)

EDIT
As pointed out, if your set is actually these three objects, you're definately better of just intersecting each one, and just pick the earliest one. If you're looking for ray-sphere, ray-cylinder, etc, intersection tests, these are not really hard and a quick google should supply all the math you might possibly need. :)

这篇关于什么是有效的计算观察光线和一组对象之间的第一个十字路口的最佳方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆