资源描述:
《C语言版测绘程序.doc》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、测量平差程序设计实习报告中国地质大学(武汉)郑杨琳测量平差程序设计1.角度(度分秒)到弧度AngleToRadian#definePI3.14159265doubleAngleToRadian(doubleangle){intD,M;doubleS,radian,degree,angle,MS;D=int(angle+0.3);MS=angle-D;M=int((MS)*100+0.3);S=(MS*100-M)*100;degree=D+M/60.0+S/3600.0;radian=degree*PI/180.0;ret
2、urnradian;}注意:防止数据溢出,要加个微小量,例如0.3.2.弧度换角度(度分秒)RadianToAngle#definePI3.14159265doubleRadianToAngle(doubleradian){intD,M;doubleS,radian,degree,MS,angle;degree=radian*180/PI;D=int(degree);MS=degree-D;M=int(MS*60);S=(MS*60-M)*60;angle=D+M/100.0+S/10000.0;returnangle;}
3、3.已知两点求坐标方位角Azimuth#includedoubleAzimuth(doublexi,doubleyi,doublexj,doubleyj){doubleDx,Dy,S,T;Dx=xj-xi;Dy=yj-yi;S=sqrt(Dx*Dx+Dy*Dy);if(S<1e-10)return0;T=asin(Dy/S);if(Dx<0)T=PI-T;if(Dx>0&&(Dy<0)
4、
5、T<0)T=2*PI+T;-11-测量平差程序设计实习报告中国地质大学(武汉)郑杨琳returnT;}4.开辟二维数组的
6、动态空间的宏#include#defineNewArray2D(type,A,i,n,m){A=(type**)malloc(n*sizeof(type*));for(i=0;i7、formmatrixvoidtransformmatrix(double**A,double**B,inti,intj){intm,n;for(m=0;m<=i;m++)for(n=0;n<=j;n++){B[n][m]=A[m][n]:}}7.矩阵相乘(mulmatrix)voidmulmatrix(double**A,double**B,double**C,inti,intj,intk){intm,n,p;for(m=0;m
8、+){C[m][n]+=A[m][p]*B[p][n]:}}}8.矩阵求逆(countermatrix)-11-测量平差程序设计实习报告中国地质大学(武汉)郑杨琳#includevoidcountermatrix(double**T,double**s,double**r,double**Q,double**N,double**rt,intn){for(i=0;i9、(j=i+1;j=0;i++){r[i][i]=1/T[i][i];for(j=i+1;j10、or(j=0;j