资源描述:
《测绘常用程序c语言》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
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;returnradian;}注意:防止数据溢出,要加个微小量,例如
2、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.已知两点求坐标方位角Azimuth#include
3、doubleAzimuth(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.开辟二维数组的动态空间的宏#include#defineNewArray2D(type,A,i,n,m){A=(type**
6、)malloc(n*sizeof(type*));for(i=0;i7、r(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;mvoi
8、dcountermatrix(double**T,double**s,double**r,double**Q,double**N,double**rt,intn){for(i=0;i9、0;j=0;i++){r[i][i]=1/T[i][i];for(j=i+1;j10、harname[8];doublex,y;inttype;}POINT;typedefstructREADVALUE{POINT*begin;POINT*end;doublevalue;}READVALUE;POINT*GETPOIN