public int XY2BL(PointXYL0 xyl0, Ellispoid E, ref PointBLL0 bll0) { bll0.L0 = xyl0.L0; double error = 0; double x = xyl0.X + error; double y = xyl0.Y + error; CalculateEllispoid(ref E); double Ac, Bc, Cc, Dc, Ec, Fc, alpha, beta, gamma, delta, epsilon, zeta, X, B0, Bf; double b0, b1, b2, b3, b4, b5, b6; Ac = 1 + 3.0 / 4.0 * Math.Pow(E.e1, 2) + 45.0 / 64.0 * Math.Pow(E.e1, 4) + 175.0 / 256.0 * Math.Pow(E.e1, 6) + 11025.0 / 16384.0 * Math.Pow(E.e1, 8) + 43659.0 / 65536.0 * Math.Pow(E.e1, 10); Bc = 3.0 / 4.0 * Math.Pow(E.e1, 2) + 15.0 / 16.0 * Math.Pow(E.e1, 4) + 525.0 / 512.0 * Math.Pow(E.e1, 6) + 2205.0 / 2048.0 * Math.Pow(E.e1, 8) + 72765.0 / 65536.0 * Math.Pow(E.e1, 10); Cc = 15.0 / 64.0 * Math.Pow(E.e1, 4) + 105.0 / 256.0 * Math.Pow(E.e1, 6) + 2205.0 / 4096.0 * Math.Pow(E.e1, 8) + 10395.0 / 16384.0 * Math.Pow(E.e1, 10); Dc = 35.0 / 512.0 * Math.Pow(E.e1, 6) + 315.0 / 2048.0 * Math.Pow(E.e1, 8) + 31185.0 / 131072.0 * Math.Pow(E.e1, 10); Ec = 315.0 / 16384.0 * Math.Pow(E.e1, 8) + 3465.0 / 65536.0 * Math.Pow(E.e1, 10); Fc = 693.0 / 131072.0 * Math.Pow(E.e1, 10); alpha = Ac * E.M0; beta = -1.0 / 2.0 * Bc * E.M0; gamma = 1.0 / 4.0 * Cc * E.M0; delta = -1.0 / 6.0 * Dc * E.M0; epsilon = 1.0 / 8.0 * Ec * E.M0; zeta = -1.0 / 10.0 * Fc * E.M0; X = x; B0 = X / alpha; while (true) { double triangle = beta * Math.Sin(2 * B0) + gamma * Math.Sin(4 * B0) + delta * Math.Sin(6 * B0) + epsilon * Math.Sin(8 * B0) + zeta * Math.Sin(10 * B0); Bf = (X - triangle) / alpha; if (Math.Abs(Bf - B0) <= Math.Pow(10.0, -15.0)) { break; } else { B0 = Bf; } } CalculateEllispoid(ref E, Bf); b0 = Bf; b1 = 1 / (E.N * Math.Cos(Bf)); b2 = -E.t / (2 * E.M * E.N); b3 = -(1 + 2 * Math.Pow(E.t, 2) + Math.Pow(E.n, 2)) / (6 * Math.Pow(E.N, 2)) * b1; b4 = -(5 + 3 * Math.Pow(E.t, 2) + Math.Pow(E.n, 2) - 9 * Math.Pow(E.n, 2) * Math.Pow(E.t, 2)) / (12 * Math.Pow(E.N, 2)) * b2; b5 = -(5 + 28 * Math.Pow(E.t, 2) + 24 * Math.Pow(E.t, 4) + 6 * Math.Pow(E.n, 2) + 8 * Math.Pow(E.n, 2) * Math.Pow(E.t, 2)) / (120 * Math.Pow(E.N, 4)) * b1; b6 = (61 + 90 * Math.Pow(E.t, 2) + 45 * Math.Pow(E.t, 4)) / (360 * Math.Pow(E.N, 4)) * b2; bll0.Name = xyl0.Name; bll0.B = b0 * Math.Pow(y, 0) + b2 * Math.Pow(y, 2) + b4 * Math.Pow(y, 4) + b6 * Math.Pow(y, 6); bll0.L = b1 * Math.Pow(y, 1) + b3 * Math.Pow(y, 3) + b5 * Math.Pow(y, 5) + bll0.L0; return(0); }
private void 高斯投影反算ToolStripMenuItem_Click(object sender, EventArgs e) { if (sign == 1) { if (sign2 == 1) { LpBLL0.Clear(); Conversion convert = new Conversion(); int count = LpXYL0.Count; for (int i = 0; i < count; i++) { PointBLL0 bll0 = new PointBLL0(); convert.XY2BL(LpXYL0[i], E, ref bll0); LpBLL0.Add(bll0); } int style = 2; writeListView(style); pictureBox1.Refresh(); style = 22; writeFile(style); } else { MessageBox.Show("错误:请先进行 “高斯投影正算(B,L)转(X,Y)” 操作!"); } } }
public int BL2XY(PointBLL0 bll0, Ellispoid E, ref PointXYL0 xyl0) { xyl0.L0 = bll0.L0; double error = 0; CalculateEllispoid(ref E, bll0.B); double Ac, Bc, Cc, Dc, Ec, Fc, alpha, beta, gamma, delta, epsilon, zeta, X, l; double a0, a1, a2, a3, a4, a5, a6; Ac = 1 + 3.0 / 4.0 * Math.Pow(E.e1, 2) + 45.0 / 64.0 * Math.Pow(E.e1, 4) + 175.0 / 256.0 * Math.Pow(E.e1, 6) + 11025.0 / 16384.0 * Math.Pow(E.e1, 8) + 43659.0 / 65536.0 * Math.Pow(E.e1, 10); Bc = 3.0 / 4.0 * Math.Pow(E.e1, 2) + 15.0 / 16.0 * Math.Pow(E.e1, 4) + 525.0 / 512.0 * Math.Pow(E.e1, 6) + 2205.0 / 2048.0 * Math.Pow(E.e1, 8) + 72765.0 / 65536.0 * Math.Pow(E.e1, 10); Cc = 15.0 / 64.0 * Math.Pow(E.e1, 4) + 105.0 / 256.0 * Math.Pow(E.e1, 6) + 2205.0 / 4096.0 * Math.Pow(E.e1, 8) + 10395.0 / 16384.0 * Math.Pow(E.e1, 10); Dc = 35.0 / 512.0 * Math.Pow(E.e1, 6) + 315.0 / 2048.0 * Math.Pow(E.e1, 8) + 31185.0 / 131072.0 * Math.Pow(E.e1, 10); Ec = 315.0 / 16384.0 * Math.Pow(E.e1, 8) + 3465.0 / 65536.0 * Math.Pow(E.e1, 10); Fc = 693.0 / 131072.0 * Math.Pow(E.e1, 10); alpha = Ac * E.M0; beta = -1.0 / 2.0 * Bc * E.M0; gamma = 1.0 / 4.0 * Cc * E.M0; delta = -1.0 / 6.0 * Dc * E.M0; epsilon = 1.0 / 8.0 * Ec * E.M0; zeta = -1.0 / 10.0 * Fc * E.M0; X = alpha * bll0.B + beta * Math.Sin(2 * bll0.B) + gamma * Math.Sin(4 * bll0.B) + delta * Math.Sin(6 * bll0.B) + epsilon * Math.Sin(8 * bll0.B) + zeta * Math.Sin(10 * bll0.B); l = bll0.L - bll0.L0; a0 = X; a1 = E.N * Math.Cos(bll0.B); a2 = 1.0 / 2.0 * E.N * Math.Pow(Math.Cos(bll0.B), 2) * E.t; a3 = 1.0 / 6.0 * E.N * Math.Pow(Math.Cos(bll0.B), 3) * (1 - Math.Pow(E.t, 2) + Math.Pow(E.n, 2)); a4 = 1.0 / 24.0 * E.N * Math.Pow(Math.Cos(bll0.B), 4) * (5 - Math.Pow(E.t, 2) + 9 * Math.Pow(E.n, 2) + 4 * Math.Pow(E.n, 4)) * E.t; a5 = 1.0 / 120.0 * E.N * Math.Pow(Math.Cos(bll0.B), 5) * (5 - 18 * Math.Pow(E.t, 2) + Math.Pow(E.t, 4) + 14 * Math.Pow(E.n, 2) - 58 * Math.Pow(E.n, 2) * Math.Pow(E.t, 2)); a6 = 1.0 / 720.0 * E.N * Math.Pow(Math.Cos(bll0.B), 6) * (61 - 58 * Math.Pow(E.t, 2) + Math.Pow(E.t, 4) + 270 * Math.Pow(E.n, 2) - 330 * Math.Pow(E.n, 2) * Math.Pow(E.t, 2)) * E.t; xyl0.Name = bll0.Name; xyl0.X = a0 * Math.Pow(l, 0) + a2 * Math.Pow(l, 2) + a4 * Math.Pow(l, 4) + a6 * Math.Pow(l, 6); xyl0.Y = a1 * Math.Pow(l, 1) + a3 * Math.Pow(l, 3) + a5 * Math.Pow(l, 5) + error; return(0); }
private int boxToList() { string s1 = richTextBox1.Text; s1 = s1.Trim(); s1 = s1.Replace(" ", ""); s1 = s1.Replace("\t", ""); string[] s2 = s1.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); List <string[]> s3 = new List <string[]>(); foreach (string tmp in s2) { s3.Add(tmp.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)); } string[][] s4 = s3.ToArray(); E.a = double.Parse(s4[0][1]); E.f = 1 / double.Parse(s4[1][1]); double L0 = double.Parse(s4[2][1]); int row = s4.GetLength(0); for (int i = 3; i < row; i++) { Conversion convert = new Conversion(); PointBLH p = new PointBLH(); PointBLL0 p0 = new PointBLL0(); p.Name = s4[i][0]; p.B = convert.Angle2Radian(double.Parse(s4[i][1])); p.L = convert.Angle2Radian(double.Parse(s4[i][2])); p.H = double.Parse(s4[i][3]); p0.Name = s4[i][0]; p0.B = convert.Angle2Radian(double.Parse(s4[i][1])); p0.L = convert.Angle2Radian(double.Parse(s4[i][2])); p0.L0 = convert.Angle2Radian(L0); LpBLH.Add(p); LpBLL0.Add(p0); } return(0); }