山东农业大学大地测量学课程设计C++

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

《大地测量基础》课程设计报告1一、通过四参数进行平面坐标转换#includeiostream#includemath.husingnamespacestd;intmain(){doublex1,y1,x2,y2,x3,y3,x4,y4,z,k,x0,y0,x,y,X,Y,Z,c,a,b;cout请输入原坐标系两点坐标:endl;coutA;cinx1y1;coutB;cinx2y2;cout请输入转换后两点坐标:endl;coutA';cinx3y3;coutB';cinx4y4;z=atan((y2-y1)/(x2-x1))-atan((y4-y3)/(x4-x3));if(z/3.1415926*18090)z=3.1415926-z;k=(sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)))/(sqrt((x4-x3)*(x4-x3)+(y4-y3)*(y4-y3)));x0=x3-k*cos(z)*x1+k*sin(z)*y1;y0=y3-k*sin(z)*x1-k*cos(z)*y1;a=int(z/3.1415926*180);b=int((z/3.1415926*180-a)*60);c=int(((z/3.1415926*180-a)*60-b)*60);cout转换角:a°b′c″缩放比例:k平移参数X:x0平移参数Y:y0endl;cout请输入待求点原坐标:;cinxy;X=x0+k*cos(z)*x-k*sin(z)*y;Y=y0+k*cos(z)*y+k*sin(z)*x;cout转换后坐标:X=X、Y=Yendl;return0;}图1、四参数坐标变换此例子是老师上课讲的例题,程序中没有控制小数位数,都是两位。《大地测量基础》课程设计报告2二、大地坐标与空间直角坐标的转换#includeiostream#includecmath#includeiomanip#includemath.h#defineE0.006693422#defineA6378245#definePAI3.141592654usingnamespacestd;intmain(){voidkd();voiddk();intm;cout空间直角坐标换算到大地坐标输入1;大地坐标换算到空间直角坐标输入2endl;cinm;if(m==1)kd();elseif(m==2)dk();elsecout输入错误,重新输入endl;return0;}voidkd(){doublex,y,z,b1,b2,b,l,h,d,f,m,D,F,M;cout输入空间直角坐标X,Y,Zendl;cinx;ciny;cinz;b1=atan(z/sqrt(x*x+y*y));b2=atan(((A*E*sin(b1))/sqrt(1-E*pow(sin(b1),2))+z)/(sqrt(x*x+y*y)));while(fabs(b2-b1)0.000001){b1=b2;b2=atan(((A*E*sin(b1))/sqrt(1-E*pow(sin(b1),2))+z)/(sqrt(x*x+y*y)));}b=b2;l=atan(y/x);h=sqrt(x*x+y*y)/cos(b)-A/sqrt(1-E*pow(sin(b),2));b=b*180/PAI;l=l*180/PAI;d=int(b);f=int((b-d)*60);m=((b-d)*60-f)*60;D=int(l);F=int((l-D)*60);M=((l-D)*60-F)*60;cout大地纬度B=d°f′fixedsetprecision(4)m″endl;cout大地经度L=D°F′fixedsetprecision(4)M″endl;cout大地高H=fixedsetprecision(3)hendl;}voiddk(){doubleB,L,H,x,y,z,d,f,m,D,F,M;cout输入大地坐标B,L,Hendl;cout°′″endl;《大地测量基础》课程设计报告3cindfm;cinDFM;cinH;B=(d+f/60+m/3600)*PAI/180;L=(D+F/60+M/3600)*PAI/180;cout弧度制B=Bendl;cout弧度制L=Lendl;x=(A/sqrt(1-E*pow(sin(B),2))+H)*cos(B)*cos(L);y=(A/sqrt(1-E*pow(sin(B),2))+H)*cos(B)*sin(L);z=(A*(1-E)/sqrt(1-E*pow(sin(B),2))+H)*sin(B);cout空间坐标系X=fixedsetprecision(3)xendl;cout空间坐标系Y=yendl;cout空间坐标系Z=zendl;}图2、XYZ-BHL图3、BHL-XYZ此程序是依照《大地测量学基础》补充作业和辅助材料中作业四来完成,实例是作业四中的实例,此程序中没有提供椭球参数的选择,固定的给出了a=6378245,e方=0.006693422.程序不够完善。《大地测量基础》课程设计报告4三、高斯投影正反算#includeiostream#includecmath#includeiomanip#includemath.h#includestdio.h#includestdlib.h#includemalloc.h#definePAI3.141592654usingnamespacestd;intmain(){voidzs();voidfs();intm,h;cout高斯投影正算,请按1;高斯投影反算,请按2endl;cinm;if(m==1)zs();elseif(m==2)fs();elsecout输入错误,重新输入endl;return0;}voidzs(){cout请选择坐标系:endl;cout选择北京-54坐标系,请按1endl;cout选择西安-80坐标系,请按2endl;inth;doubled,f,m,D,F,M,N,a0,a4,a6,a3,a5,x,y,l,bm,rm,B,L,L0;cinh;if(h==1){coutB=°′″endl;cindfm;coutL=°′″endl;cinDFM;B=(d+f/60+m/3600)*PAI/180;L=(D+F/60+M/3600);bm=d*3600+f*60+m;rm=206264.8063;if(((int(L/6)+1)*6-3)L)L0=((int(L/6))*6-3);elseL0=((int(L/6)+1)*6-3);l=(L-L0)*3600/rm;N=6399698.902-(21562.267-(108.973-0.612*pow(cos(B),2))*pow(cos(B),2))*pow(cos(B),2);a0=32140.404-(135.3302-(0.7092-0.0040*pow(cos(B),2))*pow(cos(B),2))*pow(cos(B),2);《大地测量基础》课程设计报告5a4=(0.25+0.00252*pow(cos(B),2))*pow(cos(B),2)-0.04166;a6=(0.166*pow(cos(B),2)-0.084)*pow(cos(B),2);a3=(0.3333333+0.001123*pow(cos(B),2))*pow(cos(B),2)-0.1666667;a5=0.0083-(0.1667-(0.1968+0.0040*pow(cos(B),2))*pow(cos(B),2))*pow(cos(B),2);x=6367558.4969*bm/rm-(a0-(0.5+(a4+a6*l*l)*l*l)*l*l*N)*sin(B)*cos(B);y=(1+(a3+a5*l*l)*l*l)*l*N*cos(B);cout采用北京-54坐标系、endl;cout高斯投影正算后x=:fixedsetprecision(4)x高斯投影正算后y=:fixedsetprecision(4)yendl;}if(h==2){coutB=°′″endl;cindfm;coutL=°′″endl;cinDFM;B=(d+f/60+m/3600)*PAI/180;L=(D+F/60+M/3600);bm=d*3600+f*60+m;rm=206264.8063;L0=((int(L/6)+1)*6-3);if(((int(L/6)+1)*6-3)L)L0=((int(L/6))*6-3);elseL0=((int(L/6)+1)*6-3);l=(L-L0)*3600/rm;N=6399596.652-(21565.045-(108.9996-0.603*pow(cos(B),2))*pow(cos(B),2))*pow(cos(B),2);a0=32144.5189-(135.3646-(0.7034-0.0041*pow(cos(B),2))*pow(cos(B),2))*pow(cos(B),2);a4=(0.25+0.00253*pow(cos(B),2))*pow(cos(B),2)-0.04167;a6=(0.167*pow(cos(B),2)-0.083)*pow(cos(B),2);a3=(0.3333333+0.001123*pow(cos(B),2))*pow(cos(B),2)-0.1666667;a5=0.00878-(0.1702-0.20382*pow(cos(B),2))*pow(cos(B),2);x=6367452.1328*bm/rm-(a0-(0.5+(a4+a6*l*l)*l*l)*l*l*N)*sin(B)*cos(B);y=(1+(a3+a5*l*l)*l*l)*l*N*cos(B);cout采用西安-80坐标系、endl;cout高斯投影正算后x=:fixedsetprecision(4)x高斯投影正算后y=:fixedsetprecision(4)yendl;}}voidfs(){cout请选择坐标系:endl;cout选择北京-54坐标系,请按1endl;cout选择西安-80坐标系,请按2endl;inth;doublex,y,rm,b,bf,B,l,nf,b2,b3,b4,b5,z,d,f,m,L,L0,D,M;cinh;《大地测量基础》课程设计报告6if(h==1){cout请输入X:endl;cinx;cout请输入Y:endl;ciny;cout请输入LO(中央经度):endl;cinL0;rm=206264.8063;b=x/6367558.4969;bf=b+(50221746+(293622+(2350+22*pow(cos(b),2))*pow(cos(b),2))*pow(cos(b),2))*0.0000000001*sin(b)*cos(b);nf=6399698.902-(21562.267-(108.973-0.612*pow(cos(bf),2))*pow(

1 / 10
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功