角弧度互换
//角度、弧度互化计算类 class jiaodu2hudu { public double dms_rad(double a) //角度转弧度 { double sign = (a < 0) ? -1.0 : 1.0; a = System.Math.Abs(a); int dd = (int)(System.Math.Floor(a)); a = a - dd; int mm = (int)System.Math.Floor(a * 100.0); a = (a * 100.0 - mm) * 100.0; a = sign * (dd * 3600.0 + mm * 60.0 + a) * (Math.PI / (180 * 3600)); return a; } public double rad_dms(double a) //弧度转角度 { double sign = (a < 0) ? -1.0 : 1.0; a = System.Math.Abs(a); a = a * 57.2957795130823; int d = (int)(System.Math.Floor(a)); a = a - d; int m = (int)System.Math.Floor(a * 60.0); a = (a - m / 60.0) * 3600.0; if (a + 0.0001 > 60) { a = 0; m = m + 1; } if (m >= 60) { m = 0; d = d + 1; } a = d + m / 100.0 + a / 10000.0; return a*sign; } }