As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center提供指导。




9年前关闭。




前几天,我在读有关kd树的文章。我一直在寻找这样一种数据结构可能有用的具体而简单的情况。有人有这样的例子吗?

最佳答案

我使用kd树来模拟通过波浪产生的喷雾的光传输。这样就可以渲染不仅被灯照亮的喷雾液滴,而且还可以产生来自其他液滴的间接照明。

我将喷雾点存储在kd树中,然后使用kd树快速找到哪些点彼此靠近,从而找出哪些水滴彼此照亮。 (实际上,它稍微复杂一些,但结构仍然是kd树。)这使得通过喷雾渲染出漂亮的光彩成为可能。

这是正在使用的方法的图片。

请注意,灯光周围的喷雾是如何随着散射光发光的。

关于algorithm - 什么时候应该使用KD树? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9488411/

10-10 04:08