uniform generation of points on 3D box

六月ゝ 毕业季﹏ 提交于 2019-12-24 01:55:09

问题


I would like to generate random points on a 3D box defined by its (minx, miny, minz) and (maxx, maxy, maxz) corners. I was thinking of generating a random point inside of the box and then somehow projecting it onto one of the box sides. However, I don't have explicit plane information for the box sides and this seems like it will not produce a uniform distribution of points since if some sides of the box are bigger than others, those sides should have more points generated on them.

Any suggestions are appreciated.

Thanks.


回答1:


  1. Select a side at random weighted by it's area (spare link or this one ...)
  2. Place a point randomly selected from a uniform distribution on that side
  3. Lather, rinse, repeat.

or alternately

  1. Decide on the density of points
  2. Populate each side in turn with a random set of points having that density

which is more uniform (i.e. less random) but will look fine as long as the density is high enough for each side to have more than a handful of points



来源:https://stackoverflow.com/questions/2671415/uniform-generation-of-points-on-3d-box

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!