大地坐標(biāo)系和空間直角坐標(biāo)系轉(zhuǎn)換_第1頁
大地坐標(biāo)系和空間直角坐標(biāo)系轉(zhuǎn)換_第2頁
大地坐標(biāo)系和空間直角坐標(biāo)系轉(zhuǎn)換_第3頁
大地坐標(biāo)系和空間直角坐標(biāo)系轉(zhuǎn)換_第4頁
大地坐標(biāo)系和空間直角坐標(biāo)系轉(zhuǎn)換_第5頁
已閱讀5頁,還剩3頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、#include#include#include#include#define MAX 100#define PI 3.1415926/結(jié)構(gòu)體存放 B, L, Hstruct BLH(char namel20;char name220;double B;char name320;double L;char name420;double H;lllllllllllllllllllllllllllllll結(jié)構(gòu)體存放 X,Y,Zstruct XYZ (char namel20; char name220; double X;char name320;double Y;char name420;dou

2、ble Z;lllllllllllllllllllllllllllllllll文件輸入 B,L,Hdouble FILEIN(BLH &b,char *fname) (ifstream in(fname,ios:nocreate); /建立文件流,并與輸入文件名建立關(guān)聯(lián) if(!in) coutfname error: file does not exist! endl;cout請手動(dòng)輸入數(shù)據(jù) nMendl;return 0;l;2;inb.B;3;inb.L;4;inb.H;in.close();return 1;lllllll

3、lllllllllllllllllllllllllllllllllllllllll文件輸入 X,YZdouble FILEIN1(XYZ &b,char *fname) (ifstream in(fname,ios:nocreate); /建立文件流,并與輸入文件名建立關(guān)聯(lián) if(!in) coutfname error: file does not exist! endl;cout請手動(dòng)輸入數(shù)據(jù)nHendl;return 0;l;2;inb.X;3;inb.Y;4;inb.Z;in.close();return 1;llllll

4、lllllllllllllllllllllllllllllllllllllllllllllllllldouble d_h(double angle)角度化弧度(double a,b;angle=modf(angle,&a);angle=modf(angle*100.0,&b);return (a+b/60.0+angle/36.0)*(PI+3.0E-16)/180.0;llllllllllllllllllllllllllllllllllllllllllllllllllllllllllldouble h_d(double angle)弧度化角度(double a,b,c;angle=modf(

5、angle*180.0/(PI-3.0E-16),&a);angle=modf(angle*60.0,&b);angle=modf(angle*60.0,&c);return a+b*0.01+c*0.0001+angle*0.0001;lllllllllllllllllllllllllllllllllllllllllll鍵盤輸入 B,L,Hjianpan(BLH &a)(cout請輸入大地坐標(biāo)B endl;cina.B;coutiW輸入大地坐標(biāo)L Hendl;cina.L;coutiW輸入大地坐標(biāo)H endl;cina.H;jianpanl(XYZ &a)(coutn請輸入空間直角坐標(biāo)X e

6、ndl;cina.X;coutn請輸入空間直角坐標(biāo)Y endl;cina.Y;coutn請輸入空間直角坐標(biāo)Z endl;cina.Z;llllllllllllllllllllllllllllllllllllllllllllllllllllll 標(biāo)系double B_X(BLH &a)(double aaMAXMAX;double al,bl,N,El,X,YZ;int kznzm;char outfilename20/fname20;cout請選擇:endl;coutHl:文件輸入endl;cout,2:鍵盤輸入endl;cinm;if(m=l)(coutniW 輸入文件名 Hendl;cin

7、fname;if(FILEIN(a,fname);else(if(jianpan(a);else鍵盤輸入xxz大地坐標(biāo)系換算到空間直角坐選擇數(shù)據(jù)輸入方式cout”輸入有誤,程序中止,請重新運(yùn)行Hendl;return false;else if(m=2)jianpan(a);elsecout “輸入代碼有誤,程序中止,請重新運(yùn)行” endl;return false;if(a.B90)cout“輸入B有誤,程序中止,請重新運(yùn)行Hendl;克拉索夫斯基橢球體Hendl;1975年國際橢球體endl;WGS-84 橢球體endl;2000中國大地坐標(biāo)系Mendl;選擇橢球體return false

8、;if(a.L360)cout“輸入L有誤,程序中止, return false;if(a.H0)cout“輸入H有誤,程序中止, return false;aa 0 0=6378245.0000000000;aal0=6378140.0000000000;aa20=6378137.0000000000;aa30=6378137.000;cout請選擇橢球體endl;coutH0:coutl:coutn2:coutH3:cink;請重新運(yùn)行” endl;請重新運(yùn)行Hendl;aa0l=6356863.0187730473;aall=6356755.2881575287;aa2l=6356752

9、.3142;aa3l=6356752.314;屏幕輸出結(jié)文件輸出結(jié)if(k!=0&k!=l&k!=2&k!=3)cout“輸入代碼有誤,程序中止,請重新運(yùn)行”endl;return false;couta.Bendl;al=aak0;bl=aakl;El=(al*al-bl*bl)/(al*al);a.B=d_h(a.B);a.L=d_h(a.L);N=al/sqrt(l-El*sin(a.B)*sin(a.B);X=(N+a.H)*cos(a.B)*cos(a.L);Y=(N+a.H)*cos(a.B)*sin(a.L);Z=(N*(l-El)+a.H)*sin(a.B);coutH轉(zhuǎn)換后的

10、空間直角坐標(biāo)是:” endl;果coutHX nXendl;coutY Yendl;coutHZ nZendl;cout要保存數(shù)據(jù)嗎? endl;coutl:保存endl;coutH2 不保存endl;cinn;if(n=l)(coutn請輸入保存的文件名endl;果cinoutfilename;ofstream out(outfilename); out.precision(lO);if(!out) coutHcan not open save file!Nendl; outH空間直角坐標(biāo)endl; outX,endl; outXendl; out,Y,endl; outYendl; out

11、Z,endl; outZendl; out.close(); else if(n=2); else(cout輸入代碼有誤,程序中止,請重新運(yùn)行endl; return false; cout 謝謝您使用龔曉鵬編的程序,所有任務(wù)均巳完成,歡迎下次使用,祝生活愉快 endl;IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII空間直角坐標(biāo)系換算到大地坐標(biāo)系 double X_B(XYZ &a) double al,bl,N,E1,B,L,H,BO,aaMAXMAX; double tanBMAXl; int i=0,n,k,m;cha

12、r outfilename20zfname20;選擇數(shù)據(jù)輸入方式 coutiW選擇:endl; coutHl:文件輸入endl; cout2:鍵盤輸入endl; cinm; if(m=l) (coutniW 輸入文件名 Hendl; cinfname; if(FILEINl(a,fname); else (if(jianpanl(a); else(cout輸入有誤,程序中止,請重新運(yùn)行endl; return false; else if(m=2)jianpanl(a);elsecout“輸入代碼有誤,程序中止,請重新運(yùn)行Hendl; return false;aa 0 0=6378245.0

13、000000000;aal0=6378140.0000000000;aa20=6378137.0000000000;aa30=6378137.000;aa0l=6356863.0187730473;aall=6356755.2881575287;aa2l=6356752.3142;aa3l=6356752.314;cout0.000000000000001);coutiendl;N=al/sqrt(l-El*sin(B)*sin(B);H=sqrt(a.X*a.X+a.Y*a.Y)/cos(B)-N;B=h_d(B);L=h_d(L);if(a.X0&a.Y0)L=180+L;else if(

14、a.X0)L=180+L;else if(a.X0&a.Y0)L=360+L;cout“轉(zhuǎn)換后的大地坐標(biāo)是:Nendl;屏幕輸 出結(jié)果coutHB Bendl;coutHL Lendl; coutH NHendl;cout要保存數(shù)據(jù)嗎? endl;coutl:保存endl;cout2 不保存Mendl;cinn;if(n=l)cout“請輸入保存的文件名”endl;將結(jié)果保存到文件cinoutfilename;ofstream out(outfilename);out.precision(15);if(!out) coutMcan not open save file!Nendl;outH空間直角坐標(biāo)endl;out,B,endl;outBendl;outL,endl;outLendl;outH,endl;outHendl;out.close();else if(n=2);else(cout輸入代碼有誤,程序中止,請重新運(yùn)行,endl;return fa

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論