资源简介
高斯引数大地主题正反算,武汉大学大地测量学基础编程作业。已用教材P139算例验证,误差极小。可手动输入任意点计算。
代码片段和文件信息
//高斯平均引数法正反算
//author:zjl.1905.2019.SGG.WHU
#include
#include
using namespace std;
const double PI=3.141592653589793238462643383279;
void fout(double t)//将小数度数转换为度分秒形式输出
{
cout.precision(10);
double temp[3];
temp[0] = int(t);
temp[1] = int((t-temp[0])*60);
temp[2] = t*3600-temp[0]*3600-temp[1]*60;
cout< if(fabs(temp[1])<10)
cout<<“ 0“< else
cout<<“ “< if(fabs(temp[2])<10)
cout<<“ 0“< else
cout<<“ “< }
void GSys(double e_2double c)
{
cout<<“输入0正算,1反算“< int k;
cin>>k;
if(k==0)
{
double SB1L1A1B2L2A2V0V1DB0DB1DL0DL1DA0DA1BmAm;
double B[3] L[3] A[3];
cout << “请输入距离“ << endl;
cin >> S;
cout << “请输入纬度(度,分,秒)“ << endl;
for (auto i = 0; i < 3; i++)
{
cin >> B[i];
}
cout << “请输入经度(度,分,秒)“ << endl;
for (auto i = 0; i < 3; i++)
{
cin >> L[i];
}
cout << “请输入方位角(度,分,秒)“ << endl;
for (auto i = 0; i < 3; i++)
{
cin >> A[i];
}
B1 = (B[0] + B[1] / 60 + B[2] / 3600) / 180 * PI;
L1 = (L[0] + L[1] / 60 + L[2] / 3600) / 180 * PI;
A1 = (A[0] + A[1] / 60 + A[2] / 3600) / 180 * PI;
V0 = sqrt(1+e_2*cos(B1)*cos(B1));
DB0 = S*cos(A1)/c*pow(V03);
DL0 = S/(c*V0*sin(A1)*cos(B1));
DA0 = DL0*sin(B1);
//初始值
while(1) //迭代
{
Bm = B1 + 0.5*DB0;
Am = A1 + 0.5*DA0;
V1 = sqrt(1+e_2*cos(Bm)*cos(Bm));
DB1 = S/c*pow(V13)*cos(Am)* (1 + S*S/(24*pow(c/V12)) *( sin(Am)*sin(Am)*(2+3*tan(Bm)*tan(Bm)+2*(V1*V1-1)*tan(Bm)*tan(Bm))+
3*(V1*V1-1)*cos(Am)*cos(Am)*(tan(Bm)*tan(Bm)-
V1*V1-4*tan(Bm)*tan(Bm)*(V1*V1-1))));
DL1 = S/c*V1*sin(Am)/cos(Bm)*(1+ S*S/(24*pow(c/V12)) *(sin(Am)*sin(Am)*tan(Bm)*tan(Bm)-
cos(Am)*cos(Am)* (V1*V1-9*tan(Bm)*tan(Bm)*(V1*V1-1))));
DA1 = S/c*V1*sin(Am)*tan(Bm)*(1+S*S/(24*pow(c/V12))*(cos(Am)*cos(Am)*(2+7*(V1*V1-1)+
9*tan(Bm)*tan(Bm)*(V1*V1-1)+5*(V1*V1-1)*(V1*V1-1))+
sin(Am)*sin(Am)*(2+2*(V1*V1-1)+tan(Bm)*tan(Bm))));
if(fabs(DB1-DB0)<0.00000001 && fabs(DL1-DL0)<0.00000001 && fabs(DA1-DA0)<0.0000001)
break;
else
{
DB0 = DB1;
DL0 = DL1;
DA0 = DA1;
}
}
B2=B1+DB1;
L2=L1+DL1;
A2=A1+DA1+
- 上一篇:180912.cpp
- 下一篇:Windows游戏编程大师技巧(CHM)
评论
共有 条评论