资源描述:
《WGS84与BJ54坐标系转换代码》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、publicclassCoordTrans7Param{publicdouble[,]values=newdouble[7,1];//{{dx},{dy},{dz},{rx},{ry},{rz},{k}};//publicdoubledx,dy,dz,rx,ry,rz,k;publicvoidSet4Param(doubledx,doubledy,doubledz,doublek){this.dx=dx;this.dy=dy;this.dz=dz;this.k=k;this.rx=this.ry=this.rz=0;}publicvoi
2、dSetRotationParamRad(doublerx,doublery,doublerz){this.rx=rx;this.ry=ry;this.rz=rz;}publicvoidSetRotationParamMM(doublerx,doublery,doublerz){SetRotationParamRad(rx*Math.PI/648000,ry*Math.PI/648000,rz*Math.PI/648000);}privatedouble[,]GetMx(){double[,]Mx=newdouble[,]{{1,0,0
3、},{0,Math.Cos(rx),Math.Sin(rx)},{0,-Math.Sin(rx),Math.Cos(rx)}};returnMx;}privatedouble[,]GetMy(){double[,]My=newdouble[,]{{Math.Cos(ry),0,-Math.Sin(ry)},{0,1,0},{Math.Sin(ry),0,Math.Cos(ry)}};returnMy;}privatedouble[,]GetMz(){double[,]Mz=newdouble[,]{{Math.Cos(rz),Math.
4、Sin(rz),0},{-Math.Sin(rz),Math.Cos(rz),0},{0,0,1}};returnMz;}privatedouble[,]GetM()//M=Mx*My*Mz?orM=Mz*My*Mx?{double[,]M=newdouble[3,3];MatrixTool.Multi(GetMz(),GetMy(),refM);MatrixTool.Multi(M,GetMx(),refM);returnM;}privatedouble[,]GetMdx(){double[,]mt={{0,0,0},{0,-Math
5、.Sin(rx),Math.Cos(rx)},{0,-Math.Cos(rx),-Math.Sin(rx)}};double[,]m=newdouble[3,3];MatrixTool.Multi(GetMz(),GetMy(),refm);MatrixTool.Multi(m,mt,refm);returnm;}privatedouble[,]GetMdy(){double[,]mt={{-Math.Sin(ry),0,-Math.Cos(ry)},{0,0,0},{Math.Cos(ry),0,-Math.Sin(ry)}};dou
6、ble[,]m=newdouble[3,3];MatrixTool.Multi(GetMz(),mt,refm);MatrixTool.Multi(m,GetMx(),refm);returnm;}privatedouble[,]GetMdz(){double[,]mt={{-Math.Sin(rz),Math.Cos(rz),0},{-Math.Cos(rz),-Math.Sin(rz),0},{0,0,0}};double[,]m=newdouble[3,3];MatrixTool.Multi(mt,GetMy(),refm);Ma
7、trixTool.Multi(m,GetMx(),refm);returnm;}privatedouble[,]specialMulti(double[,]m,double[,]X){introwNumM=m.GetLength(0);intcolNumM=m.GetLength(1);introwNumX=X.GetLength(0);intcolNumX=X.GetLength(1);intlines=rowNumX/colNumM;double[,]mt=MatrixTool.Init(rowNumM,colNumX);doubl
8、e[,]subX=MatrixTool.Init(colNumM,colNumX);double[,]res=MatrixTool.Init(rowNumM*lines,colNumX);for(inti=