60 likes | 177 Views
综合练习. 编写一个控制台应用程序; P17 例 2 假如你从 30°N , 114°E 的位置出发,以 885km/h 的地面速度在 10km 的高度飞行 8 小时,航行与北成恒定 45° 。你会到哪里?(假设地球为球形,半径为 6371km ). 知识回顾. static void Main(string[] args) { double lat0 = 30, lon0 = 114; double speed = 885, travelTime = 8.0; double earthRadius = 6371,height = 10;
E N D
综合练习 • 编写一个控制台应用程序; • P17例2 • 假如你从30°N,114°E的位置出发,以885km/h的地面速度在10km的高度飞行8小时,航行与北成恒定45°。你会到哪里?(假设地球为球形,半径为6371km)
知识回顾 static void Main(string[] args) {double lat0 = 30, lon0 = 114; double speed = 885, travelTime = 8.0; double earthRadius = 6371,height = 10; double deg2rad = 3.14159265 / 180; double azimuth = 45 * deg2rad; double distance = speed * travelTime; double theta = distance / (earthRadius + height); double deltaLat = theta * Math.Cos(azimuth); double deltaLon = theta * Math.Sin(azimuth); double lat = lat0 + deltaLat / deg2rad; double lon = lon0 + deltaLon / deg2rad; Console.WriteLine("当前的纬度为:{0},经度为:{1}", lat, lon); Console.ReadLine(); }
练习(2) 调试P21页例2.1 调试P25页例2.3 调试P34页 “案例实训” 综合练习: 坐标转换 其中,
内容回顾 classCoorTrans { double FlatRate(double a, double b) { double f = (a - b) / b; return f; } publicdouble EccentricitySquare(double a, double b) { double f = FlatRate(a, b); double e2 = 2 * f - f * f;return e2; } publicdouble GetN(double a, double b, double B) { double e2 = EccentricitySquare(a, b); double sinB = Math.Sin(B); double n = a / Math.Cos(1 - e2 * sinB * sinB); return n; } }
综合练习 classProgram { staticvoid Main(string[] args) { double a = 6378137; double b = 6356752.3142; double deg2rad = 3.14159265 / 180; double B = 30 * deg2rad; double L = 114 * deg2rad; double H = 30; CoorTrans coor = newCoorTrans(); double n = coor.GetN(a, b, B); double e2 = coor.EccentricitySquare(a, b); double X = (n + H) * Math.Cos(B) * Math.Cos(L); double Y = (n + H) * Math.Cos(B) * Math.Sin(L); double Z = (n * (1 - e2) + H) * Math.Sin(B); } }
练习(3) • P41 例3.3 • 3.4 案例实训 • 坐标转换(迭代法) • (选作)兔子从出生要一个月,从出生到成熟要过一个月,一对兔子每个月生出一对兔子来,如果一年后可以繁殖多少对兔子?(Fibonacci) Z P X