计算圆的坐标提供半径和中心
Calculating Coordinates of Circle provided radius and center
我想计算一个圆形的纬度和经度点,提供一个中心点和半径。我目前拥有的代码如下,结果始终是椭圆形而不是圆形。
double val = 2 * Math.PI / points;
for (int i = 0; i < points; i++)
{
double angle = val * i;
double newX = (dCenterX + radius * Math.Cos(angle));
double newY = (dCenterY + radius * Math.Sin(angle));
}
您可以使用 Destination 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(brng) );
var λ2 = λ1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(φ1),
Math.cos(d/R)-Math.sin(φ1)*Math.sin(φ2));
其中φ为纬度,λ为经度,θ为方位(从北顺时针方向),δ为angular距离d/R; d是行进的距离,R是地球的半径
我想计算一个圆形的纬度和经度点,提供一个中心点和半径。我目前拥有的代码如下,结果始终是椭圆形而不是圆形。
double val = 2 * Math.PI / points;
for (int i = 0; i < points; i++)
{
double angle = val * i;
double newX = (dCenterX + radius * Math.Cos(angle));
double newY = (dCenterY + radius * Math.Sin(angle));
}
您可以使用 Destination 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(brng) );
var λ2 = λ1 + Math.atan2(Math.sin(brng)*Math.sin(d/R)*Math.cos(φ1),
Math.cos(d/R)-Math.sin(φ1)*Math.sin(φ2));
其中φ为纬度,λ为经度,θ为方位(从北顺时针方向),δ为angular距离d/R; d是行进的距离,R是地球的半径