2015-11-02 153 views

回答

1

良好的公式生成兩個均勻隨機值rFi在範圍0..1
計算距離作爲d = Radius * Sqrt(r)description here for plane circle
軸承計算作爲Theta=2 * Pi * Fi
查找給定中心點的緯度/經度座標和在單元計算出d和Theta作爲described hereDestination point given distance and bearing from start point

JavaScript: 
(all angles 
in radians) 
var φ2 = Math.asin(Math.sin(φ1)*Math.cos(d/R) + 
        Math.cos(φ1)*Math.sin(d/R)*Math.cos(θ)); 
var λ2 = λ1 + Math.atan2(Math.sin(θ)*Math.sin(d/R)*Math.cos(φ1), 
         Math.cos(d/R)-Math.sin(φ1)*Math.sin(φ2)); 

where φ is latitude, λ is longitude, 
θ is the bearing (clockwise from north), d being the distance travelled, 
R the earth’s radius