常用測繪C程序設(shè)計源代碼_第1頁
常用測繪C程序設(shè)計源代碼_第2頁
常用測繪C程序設(shè)計源代碼_第3頁
常用測繪C程序設(shè)計源代碼_第4頁
常用測繪C程序設(shè)計源代碼_第5頁
已閱讀5頁,還剩27頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

1、常用測量程序設(shè)計(1)用全站儀在a點觀測了b點斜邊和垂直角,求a到b的高差。(提示:,d-斜邊,-垂直角,-儀器高,-反光鏡高,-大氣折光系數(shù))using system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) console.write(請輸入斜邊=); double d = double.parse(console.readline(); console.write(請輸入垂直

2、角ddd.mmss=); double a = deg(double.parse(console.readline(); console.write(請輸入儀器高=); double i = double.parse(console.readline(); console.write(請輸入反光鏡高=); double v = double.parse(console.readline(); double h = d * math.sin(a) + (1 - 0.13) * d / 6371000.0 * d / 6371000.0 * math.cos(a) * math.cos(a) /

3、2.0 + i - v; console.writeline(高差為0,h); /將ddd.mmss轉(zhuǎn)為弧度 static public double deg(double ang) int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang); int d = (int)ang; int m = (int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 10000; return (d + m / 60.0 + s / 3600.0) * fuhao) / 18

4、0.0 * math.pi; (2)如圖所示,已知a點的坐標(biāo)及a點到b點的邊長及方位角,計算b點的坐標(biāo)。using system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) console.write(請輸入a點的x坐標(biāo)=); double xa = double.parse(console.readline(); console.write(請輸入a點的y坐標(biāo)=); double

5、ya = double.parse(console.readline(); console.write(請輸入a到b的方位角ddd.mmss=); double a = deg(double.parse(console.readline(); console.write(請輸入a到b的水平距離=); double s = double.parse(console.readline(); double xb = xa + s*math.cos(a); double yb = ya + s*math.sin(a); console.writeline(b點的坐標(biāo)(0,1),xb,yb); /將dd

6、d.mmss轉(zhuǎn)為弧度 static public double deg(double ang) int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang); int d = (int)ang; int m = (int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 10000; return (d + m / 60.0 + s / 3600.0) * fuhao) / 180.0 * math.pi; (3)如圖所示,已知a點和b點的坐標(biāo),計算a點到的邊長及方

7、位角。using system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) console.write(請輸入a點的x坐標(biāo)=); double xa = double.parse(console.readline(); console.write(請輸入a點的y坐標(biāo)=); double ya = double.parse(console.readline(); console.wri

8、te(請輸入b點的x坐標(biāo)=); double xb = double.parse(console.readline(); console.write(請輸入b點的y坐標(biāo)=); double yb = double.parse(console.readline(); double s = 距離(xa, ya, xb, yb); double a = 方位角(xa, ya, xb, yb); console.writeline(ab間的距離=0,從a到b的方位角=1,s,dms(a); /將弧度轉(zhuǎn)為ddd.mmss static public double dms(double ang) ang

9、+= 1.0e-15;/加上一個小量,以保證進(jìn)位 int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang) * 180.0 / math.pi; int d = (int)ang; ang = (ang - d) * 60.0; int m = (int)ang; double s = (ang - m) * 60.0; return (d + m / 100.0 + s / 10000.0) * fuhao; /計算方位角,返回弧度值 public static double 方位角(double x1, double y1, do

10、uble x2, double y2) double deltax = x2 - x1; double deltay = y2 - y1; double angle = math.pi * 0.5; if (math.abs(deltax) 0.000000001) angle = math.atan2(deltay, deltax); if (angle 0) angle += math.pi; if (deltay 2 * math.pi) a0 -= 2 * math.pi; list 導(dǎo)線轉(zhuǎn)角集合 = new list(); int i = 1; do console.write(請輸

11、入第0個轉(zhuǎn)角的水平角左角為正,右角為負(fù) =,i+); string str = console.readline(); if (str != ) 導(dǎo)線轉(zhuǎn)角集合.add(deg(double.parse(str); else break; while (true); i = 1; foreach (double a in 導(dǎo)線轉(zhuǎn)角集合) a0 += a + math.pi; if (a0 2 * math.pi) a0 -= 2 * math.pi; else if (a0 0.0) a0 += 2 * math.pi; console.writeline(第0條邊的方位角為1,i+,dms(a

12、0); /將弧度轉(zhuǎn)為ddd.mmss static public double dms(double ang) ang += 1.0e-15;/加上一個小量,以保證進(jìn)位 int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang) * 180.0 / math.pi; int d = (int)ang; ang = (ang - d) * 60.0; int m = (int)ang; double s = (ang - m) * 60.0; return (d + m / 100.0 + s / 10000.0) * fuhao; /將

13、ddd.mmss轉(zhuǎn)為弧度 static public double deg(double ang) int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang); int d = (int)ang; int m = (int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 10000; return (d + m / 60.0 + s / 3600.0) * fuhao) / 180.0 * math.pi; (5)在如圖所示的支中導(dǎo)線,已知a點和m點的坐標(biāo)及每個

14、左角和每條邊長,求每個點的坐標(biāo)。using system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) console.write(請輸入m點的x坐標(biāo)=); double mx = double.parse(console.readline(); console.write(請輸入m點的y坐標(biāo)=); double my = double.parse(console.readline()

15、; console.write(請輸入a點的x坐標(biāo)=); double ax = double.parse(console.readline(); console.write(請輸入a點的y坐標(biāo)=); double ay = double.parse(console.readline(); list 導(dǎo)線轉(zhuǎn)角集合 = new list(); list 導(dǎo)線邊長集合 = new list(); int i = 1; do console.write(請輸入第0個轉(zhuǎn)角的水平角左角為正,右角為負(fù)=,i); string str = console.readline(); if (str != ) 導(dǎo)

16、線轉(zhuǎn)角集合.add(deg(double.parse(str); else break; console.write(請輸入第0條邊長值=, i+); 導(dǎo)線邊長集合.add( double.parse(console.readline(); while (true); /計算m到a的坐標(biāo)方位角 double a0 = 方位角(mx, my, ax, ay); /計算每個點的坐標(biāo) double x0 = ax; double y0 = ay; for (int j = 0; j 2 * math.pi) a0 -= 2 * math.pi; x0 = x0 + 導(dǎo)線邊長集合j * math.co

17、s(a0); y0 = y0 + 導(dǎo)線邊長集合j * math.sin(a0); console.writeline(p0點的坐標(biāo)是:1,2,j+2,x0,y0); /將ddd.mmss轉(zhuǎn)為弧度 static public double deg(double ang) int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang); int d = (int)ang; int m = (int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 10000; retur

18、n (d + m / 60.0 + s / 3600.0) * fuhao) / 180.0 * math.pi; /計算方位角,返回弧度值 public static double 方位角(double x1, double y1, double x2, double y2) double deltax = x2 - x1; double deltay = y2 - y1; double angle = math.pi * 0.5; if (math.abs(deltax) 0.000000001) angle = math.atan2(deltay, deltax); if (angle

19、0) angle += math.pi; if (deltay 0.0) angle += math.pi; return angle; (6)在如圖所示的單一附合水準(zhǔn)路線中,已知a點和b點的高程及每段的長度和高差,求每個點的高程。using system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) console.write(請輸入a點的高程=); double ha = doub

20、le.parse(console.readline(); console.write(請輸入b點的高程=); double hb = double.parse(console.readline(); list 路線段長度集合 = new list(); list 路線段高差集合 = new list(); int i = 1; do console.write(請輸入第0段長度公里為單位=,i); string str = console.readline(); if (str != ) 路線段長度集合.add(double.parse(str); else break; console.wr

21、ite(請輸入第0段高差=, i+); 路線段高差集合.add(double.parse(console.readline(); while (true); /計算水準(zhǔn)路線閉合差 double w = 0; double 總長度 = 0; for (int j = 0; j 路線段長度集合.count; j+) w += 路線段高差集合j; 總長度 += 路線段長度集合j; w = w - (hb - ha); /閉合差 double v = -w / 總長度; /每公里改正數(shù) /計算每個點的高程 double h = ha; for (int j = 0; j 0.000000001) an

22、gle = math.atan2(deltay, deltax); if (angle 0) angle += math.pi; if (deltay 0.0) angle += math.pi; return angle; /計算距離 public static double 距離(double x1, double y1, double x2, double y2) return math.sqrt(x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1); (8)在如圖所示的單個多邊形中,已知每個點的坐標(biāo),求多邊形的面積。提示面積的計算公式為:using

23、system;using system.collections.generic;using system.text;namespace consoleapplication1 class application static void main(string args) list 多邊形x坐標(biāo)集 = new list(); list 多邊形y坐標(biāo)集 = new list(); int i = 1; do console.write(請輸入第0點的x坐標(biāo)=,i); string str = console.readline(); if (str != ) 多邊形x坐標(biāo)集.add(double.p

24、arse(str); else break; console.write(請輸入第0點的y坐標(biāo)=,i+); 多邊形y坐標(biāo)集.add( double.parse(console.readline(); while (true); /計算面積 double area = 0; /點的個數(shù) int count = 多邊形x坐標(biāo)集.count; for (int j = 0; j count-1; j+) area += 多邊形x坐標(biāo)集j * 多邊形y坐標(biāo)集j + 1 - 多邊形x坐標(biāo)集j + 1 * 多邊形y坐標(biāo)集j; /計算最后一點到起點的項 area += 多邊形x坐標(biāo)集count - 1 *

25、多邊形y坐標(biāo)集0 - 多邊形x坐標(biāo)集0 * 多邊形y坐標(biāo)集count - 1; console.writeline(多邊形的面積=0,math.abs(area * 0.5); (9)在如圖所示的僅有一個連接角的附合導(dǎo)線中,已知a點和b點的高程及每條邊的斜邊、垂直角、儀器高和反光鏡高,求每個點的高程。(提示:,d-斜邊,-垂直角,-儀器高,-反光鏡高,-大氣折光系數(shù))using system;using system.collections.generic;using system.linq;using system.text;namespace 導(dǎo)線 class program static

26、 void main(string args) console.write(請輸入a點的高程=); double ha = double.parse(console.readline(); console.write(請輸入b點的高程=); double hb = double.parse(console.readline(); list 高差集合 = new list(); list 水平距離平方集合 = new list(); int i = 1; double 高差和 = 0; double 水平距離平方和 = 0; do console.write(請輸入0點到1點的斜距d=,i,i+

27、1); string str = console.readline(); if (str = ) break; double d = double.parse(str); console.write(請輸入0點到1點的垂直角=, i, i + 1); double = 導(dǎo)線.deg(double.parse(console.readline();/并化為弧度 console.write(請輸入0的儀器高=, i); double 儀器高 = double.parse(console.readline(); console.write(請輸入0的反光鏡高=, i+1); double 反光鏡高

28、= double.parse(console.readline(); i+; double 水平距離; double h = 導(dǎo)線.高差(d, , 儀器高, 反光鏡高, out 水平距離); 水平距離平方集合.add(水平距離 * 水平距離); 高差集合.add(h); 水平距離平方和 += 水平距離 * 水平距離; 高差和 += h; while (true); /計算高差閉合差 double 高差閉合差 = ha + 高差和 - hb; /計算單位長度改正數(shù),三角高程的權(quán)與距離的平方成反比 double 單位長度改正數(shù) = -高差閉合差 / 水平距離平方和; /計算每點高程 double

29、h = ha; for (int j = 0; j 高差集合.count; j+) h += 高差集合j + 單位長度改正數(shù) * 水平距離平方集合j; console.writeline(第0點的高程h=1,j+2,h); console.writeline(最后一個點的高程應(yīng)該與b點的高程相同!); class 導(dǎo)線 /將ddd.mmss轉(zhuǎn)為弧度 static public double deg(double ang) int fuhao = (int)(ang / math.abs(ang); ang = math.abs(ang); int d = (int)ang; int m = (

30、int)(ang * 100) - d * 100; double s = ang * 10000 - m * 100 - d * 10000; return (d + m / 60.0 + s / 3600.0) * fuhao) / 180.0 * math.pi; /高差計算,返回高差 public static double 高差(double 斜距,double 垂直角,double 儀器高,double 反光鏡高,out double 水平距離) double h = 斜距 * math.sin(垂直角) + 斜距 * math.cos(垂直角) / 6371000.0 * 斜距 * math.cos(垂直角) * (1 - 0.13) + 儀器高 - 反光鏡高; 水平距離 = 斜距*math.cos(垂直角); return h; (10)在如圖所示的僅有一個連接角的附合導(dǎo)線中,已知m點、a點和b點的坐標(biāo),每個點的左角及每條邊的水平距離,求每個點的坐標(biāo)。using system;using system.collections.generic;using system.text;namespace 導(dǎo)線 class program static void main(string args) console.write(請輸入m點的x坐標(biāo)=);

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論