单位球面上的均匀随机 (Monte-Carlo) 分布 [英] Uniform random (Monte-Carlo) distribution on unit sphere
问题描述
我需要澄清一下为我的宠物光线追踪器生成随机值的算法.
我从一点发出光线.我有这些光线分布的问题:我需要分布均匀,但它不是......
I need a clarification with algorithm generating random values for my pet ray-tracer.
I emit rays from one point. And I have the problem with distribution of these rays: I need the distribution to be uniform, but it isn't...
我现在面临的问题是,在我对结果空间进行扭曲之后,最初均匀的分布并不均匀.
The problem I face now is that the distribution being uniform initially is not uniform after my distortions of the space of results.
例如,如果是极坐标系,我会生成 r 和 t 角.分布是不均匀的,也不能是均匀的:靠近每个极点的空间比靠近赤道的空间具有更多的结果密度.原因很明显:我将均匀分布的点从圆柱空间转换为球面.我扭曲了结果.同样的问题是,如果我对立方体中随机生成的点进行归一化.
So for example, I generate r and t angles if the polar coordinate system. The distribution is not uniform and it cannot be uniform: space close to each pole has much more density of results than, say, close to equator. The reason is pretty clear: I convert uniformly distributed points from cylindrical space to the spherical. And I distort results. The same problem is if I normalize points generated randomly in the cube.
我现在的想法是:我想创建一个四面体,标准化它的顶点,用中间的点分割每个面(三角形),标准化它并递归重复,直到我有足够的点.然后我稍微扭曲"这些点.然后我再次将它们标准化.就是这样.
My idea now is this: I want to create a tetrahedron, normalize its vertexes, split each face (triangle) with the point in the middle, normalize it and repeat recursively until I have enough points. Then I "distort" these points a little bit. Then I normalize them again. That's it.
我知道这个方法本身并不是纯数学的蒙特卡罗方法,因为除了最后一步之外,我没有在任何步骤中使用随机分布.我不喜欢这种复杂性的解决方案.
I understand that this method is not pure mathematical Monte-Carlo method itself, because I do not use random distribution in any step except for the last one. And I do not like this solution for this complexity.
谁能建议更简单的东西
- 随机
- 统一
- 快
- 简单
谢谢!
我需要一种快速的方法,而不仅仅是正确的方法.这就是为什么我要问蒙特卡洛.提供的答案是正确的,但速度不快.四面体的方法很快,但不是很随机"=> 不正确.
我真的需要更合适的东西.
I need a fast method, not just the correct one. That's why I'm asking about Monte-Carlo. Answers provided are correct, but not fast. The method with tetrahedron is fast, but not very "random" => incorrect.
I really need something more suitable.
推荐答案
这是一个算法允许您生成随机分布在单位球面上的点.
Here's an algorithm that allows you to generate points randomly distributed on the unit sphere.
这篇关于单位球面上的均匀随机 (Monte-Carlo) 分布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!