如何随机选择的地球表面上的点? [英] How to randomly select a point on the surface of the Earth?
本文介绍了如何随机选择的地球表面上的点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
正如标题所说,如何将随机选择一个坐标在地球表面上不带偏见?做兰特(-90,90),兰特(-180,180)的简单的解决方案将有利于极地地区在赤道地区。
As the title says, how to randomly select a coordinate on the surface of the Earth without bias? The simple solution of doing rand(-90,90),rand(-180,180) will favor polar regions over equatorial regions.
推荐答案
这听起来像你正在寻找一个的均匀随机分布在一个球体。
It sounds like you're looking for a uniform random distribution on a sphere.
在球面坐标:
θ = 2π * rand(0,1)
Φ = arccos(1 - 2*rand(0,1))
这篇关于如何随机选择的地球表面上的点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文