资源简介
武汉大学测绘学院大地测量学编程--大地主题解算-高斯正反算C++源码
代码片段和文件信息
// Gauss_Average_YinShu.cpp : Defines the entry point for the console application.
//
#include “stdafx.h“
#include
#include
#include
#include //setprecision()函数的头文件 用于控制小数的位数
#define NN 8
#define PI 3.141592653589793
#define P 206265
void OuDegree(double ); //声明格式输出控制函数
double A12 B0 L0 A0 Bm Am deltaB deltaL deltaA B2 L2 A21;
double M N Nm Vm tm gm;
double a=6378245.0;
double e2=0.006693421622966;
double e12=0.006738525414683;
double c=6399698.9017827110;
int k; //算法选择参数
void main(void)
{
cout<<“ 请选择你要进行的算法:\n【高斯大地平均引数正算 1】【高斯大地平均引数反算 2】“< cin>>k;
if(k==1)
{
cout<<“您选择了【高斯大地平均引数正算】正算的结果为:“<
double degree[NN]={411301}minute[NN]={241049}second[NN]={35.687412.267643.00};//定义3个数组,第一个存放°,第二个存放′,第三个存放″
double B1=(degree[0]+minute[0]/60+second[0]/3600)*PI/180; //将 B1 化成弧度
double L1=(degree[1]+minute[1]/60+second[1]/3600)*PI/180; //将 A1化成弧度
double A1=(degree[2]+minute[2]/60+second[2]/3600)*PI/180; //将 L1 化成弧度
double S=200000.00;
M=(a*(1-e2))/sqrt(pow((1-e2*pow(sin(B1)2))3));
N=a/sqrt(1-e2*pow(sin(B1)2));
deltaB=B0=S*cos(A1)/M;
deltaL=L0=S*sin(A1)/(cos(B1)*N);
deltaA=A0=L0*sin(B1);
do
{
B0=deltaB;
A0=deltaA;
L0=deltaL;
Bm=B1+B0/2;
Am=A1+A0/2;
tm=tan(Bm);
gm=sqrt(e12)*cos(Bm);
Nm=a/sqrt(1-e2*pow(sin(Bm)2));
Vm=sqrt(1+e12*pow(cos(Bm)2));
deltaB=Vm*Vm*S*cos(Am)*(1+S*S*(sin(Am)*sin(Am)*(2+3*tm*tm+2*gm*gm)+3*gm*gm*cos(Am)*cos(Am)*(tm*tm-1-gm*gm-4*tm*tm*gm*gm))/(24*Nm*Nm))/Nm;
deltaL=S*sin(Am)*(1+S*S*(sin(Am)*sin(Am)*tm*tm-cos(Am)*cos(Am)*(1+gm*gm-9*tm*tm*gm*gm))/(24*Nm*Nm))/(Nm*cos(Bm));
deltaA=S*sin(Am)*tm*(1+S*S*(cos(Am)*cos(Am)*(2+7*gm*gm+9*tm*tm*gm*gm+5*pow(gm4))+sin(Am)*sin(Am)*(2+tm*tm+2*gm*gm))/(24*Nm*Nm))/Nm;
}while((deltaB-B0)>1e-10&&(deltaL-L0)>1e-10&&(deltaA-A0)>1e-10);
B2=B1+deltaB;
L2=L1+deltaL;
A21=A1+deltaA+PI;
cout<<“B2的值为:“< OuDegree(B2);
cout<<“L2的值为:“< OuDegree(L2);
cout<<“A21的值为:“< OuDegree(A21);
}
else if(k==2)
{
cout<<“您选择了【高斯大地平均引数反算】反算的结果为:“< double degree[NN]={4113043130}minute[NN]={24101214}second[NN]={35.687412.267634.18540755.200552};//定义3个数组,第一个存放°,第二个存放′,第三个存放″
double B1=(degree[0]+minute[0]/60+second[0]/3600)*PI/180; //将 B1 化成弧度
double L1=(degree[1]+minute[1]/60+second[1]/3600)*PI/180; //将 A1化成弧度
double B2=(degree[2]+minute[2]/60+second[2]/3600)*PI/180; //将 L1 化成弧度
double L2=(degree[3]+minute[3]/60+second[3]/3600)*PI/180; //将 L1 化成弧度
double UVr01r21r03s10s12s30t01t21t03TS;
Bm=(B1+B2)/2;
deltaB=B2-B1;
deltaL=L2-L1;
tm=tan(Bm);
gm=sqrt(e12)*cos(Bm);
Nm=a/sqrt(1-e2*pow(sin(Bm)2));
Vm=sqrt(1+e12*pow(cos(Bm)2));
r01=Nm*cos(Bm);
r21=Nm*cos(Bm)*(1-gm*gm-9*gm*gm*tm*tm)/24;
r03=Nm*pow(cos(Bm)3)*tm*tm/24;
s10=Nm/(Vm*Vm);
s12=Nm*cos(Bm)*cos(Bm)*(-2-3*tm*tm+3*tm*tm*gm*gm)/24;
s30=Nm*(gm*gm-tm*
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 769 2008-10-19 00:39 Gauss_Average_YinShu\StdAfx.h
文件 307 2008-10-19 00:39 Gauss_Average_YinShu\StdAfx.cpp
文件 1292 2008-10-19 00:39 Gauss_Average_YinShu\ReadMe.txt
文件 4704 2008-10-19 00:39 Gauss_Average_YinShu\Gauss_Average_YinShu.dsp
文件 41984 2008-10-20 08:33 Gauss_Average_YinShu\Gauss_Average_YinShu.ncb
文件 50176 2008-10-20 08:33 Gauss_Average_YinShu\Debug\vc60.idb
文件 203736 2008-10-19 00:40 Gauss_Average_YinShu\Debug\Gauss_Average_YinShu.pch
文件 69632 2008-10-20 08:32 Gauss_Average_YinShu\Debug\vc60.pdb
文件 1919 2008-10-19 00:40 Gauss_Average_YinShu\Debug\StdAfx.obj
文件 293880 2008-10-20 08:33 Gauss_Average_YinShu\Debug\Gauss_Average_YinShu.ilk
文件 241739 2008-10-20 08:33 Gauss_Average_YinShu\Debug\Gauss_Average_YinShu.exe
文件 549888 2008-10-20 08:32 Gauss_Average_YinShu\Debug\Gauss_Average_YinShu.pdb
文件 25686 2008-10-20 08:33 Gauss_Average_YinShu\Debug\Gauss_Average_YinShu.obj
文件 973 2008-10-20 08:33 Gauss_Average_YinShu\Gauss_Average_YinShu.plg
文件 565 2008-10-19 01:09 Gauss_Average_YinShu\Gauss_Average_YinShu.dsw
文件 3976 2008-10-19 12:28 Gauss_Average_YinShu\Gauss_Average_YinShu.cpp
文件 48640 2008-10-20 08:33 Gauss_Average_YinShu\Gauss_Average_YinShu.opt
目录 0 2008-10-19 00:39 Gauss_Average_YinShu\Debug
目录 0 2008-10-19 00:39 Gauss_Average_YinShu
----------- --------- ---------- ----- ----
1539866 19
评论
共有 条评论