Fast uniformly distributed random points on the surface of a unit hemisphere

前端 未结 7 1076
天涯浪人
天涯浪人 2020-12-15 18:26

I am trying to generate uniform random points on the surface of a unit sphere for a Monte Carlo ray tracing program. When I say uniform I mean the points are uniformly distr

7条回答
  •  太阳男子
    2020-12-15 18:39

    The second and third methods do in fact produce uniformly distributed random points on the surface of a sphere with the second method (Marsaglia 1972) producing the fastest run times at around twice the speed on an Intel Xeon 2.8 GHz Quad-Core.

    As noted by Alexandre C there is an additional method using the normal distribution which expands to n-spheres better than the methods I have presented.

    This link will give you further information on selecting uniformly distributed random points on the surface of a sphere.

    My initial method as pointed out by TonyK does not produce uniformly distributed points and rather bias's the poles when generating the random points. This is required by the problem I am trying to solve however I simply assumed it would generate uniformly random points. As suggested by Pablo this method can be optimised by removing the asin() call to reduce run time by around 20%.

提交回复
热议问题