?? 坐標轉換.cpp
字號:
#include "iostream.h"
#include "math.h"
#include "stdio.h"
#define pi 3.1415926
#define a 6378137.00000 //WGS84橢球體的長半軸
#define e2 0.0066943799013 //WGS84橢球體的偏心率的平方
double huahu(double b)
{
double b1,b2,b3;
b1=(int)b;
b2=(int)((b-b1)*100);
b3=((b-b1)*100-b2)*100;
b=(b1+b2/60+b3/3600)*pi/180;
return b;
}
int main()
{
double B,L,H,N;
double X,Y,Z;
cout<<"請輸入大地坐標B,L,H,角度輸入方式如下:"<<endl;
cout<<"若輸入的角度為30度30分30秒,對應的代碼為:30.3030"<<endl;
cin>>B>>L>>H;
L=huahu(L);
N=a/sqrt(1-e2*sin(B)*sin(B));
X=(N+H)*cos(B)*cos(L);
Y=(N+H)*cos(B)*sin(L);
Z=(N*(1-e2)+H)*sin(B);
cout<<"對應的空間直角坐標系中的坐標為:"<<endl;
printf("X=%10.6f,Y=%10.6f,Z=%10.6f\n",X,Y,Z);
cin>>X;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -