已知圆心(x0,y0),半径radius = 1000米,求出每隔1度一个的圆边上的坐标。
constdouble _LONG_DISTANCE= 39940.67;//地球子午线长,单位:km
constdouble _LATI_DISTANCE= 40075.36;//赤道长,单位:km
void test(){
doublex0 = 116.202038,y0 = 39.937639;
doubleradius = 1000;
doubleangleSpan = 1;
for(intangle = 0; angle < 360; angle += angleSpan) {
doubletempAngle = angle*PI/180;
doublexi = x0 + radius *cos(tempAngle) * 360 /_LONG_DISTANCE/ 1000;
doubleyi = y0 + radius *sin(tempAngle) * 360 /_LATI_DISTANCE/ 1000;
printf("%d,%f,%f\r\n",angle,xi,yi);
}
}
网友评论