public static double ConvergenceAngle(dPoint dp, int what) { int a; double B, l, L, L0, t, n, r; Elliptse ell = new Elliptse(); Ellipses.SetEllipse(what); B = dp.B; L = dp.L; a = (int)(L / 6) + 1; L0 = 6 * (double)a - 3; Ang A1, A2, b; A1.val = L; A2.val = L0; b.val = B; L = AngelTransformation.AngtoRad(A1); L0 = AngelTransformation.AngtoRad(A2); l = L - L0; B = AngelTransformation.AngtoRad(b); t = Math.Tan(B); n = Math.Sqrt(ell.e2) * Math.Cos(B); r = Math.Sin(B) * l + Math.Sin(B) * Math.Pow(Math.Cos(B), 2) * l * l * l * (1 + 3 * n * n + 2 * Math.Pow(n, 4)) / 3 + Math.Sin(B) * Math.Pow(Math.Cos(B), 4) * Math.Pow(l, 5) * (2 - t * t) / 15; Rad r1; r1.val = r; r = AngelTransformation.RadtoAng(r1); return(r); }
public static dPoint KToD(kPoint kp, int what) { Elliptse ell = new Elliptse(); ell = Ellipses.SetEllipse(what); double X, Y, Z, N; X = kp.X; Y = kp.Y; Z = kp.Z; dPoint dp = new dPoint(); Rad b, l; l.val = Math.Acos(X / Math.Sqrt(Math.Pow(X, 2.0) + Math.Pow(Y, 2.0))); dp.L = AngelTransformation.RadtoAng(l); double[] B1 = new double[99999]; B1[0] = Math.Atan(Z / Math.Sqrt(X * X + Y * Y)); int i = 0; for (i = 0; i < 99999; i++) { B1[i + 1] = Math.Atan((1 / Math.Sqrt(Math.Pow(X, 2.0) + Math.Pow(Y, 2.0))) * (Z + (ell.c * ell.e1 * Math.Tan(B1[i])) / Math.Sqrt(1 + ell.e2 + Math.Pow(Math.Tan(B1[i]), 2.0)))); if (Math.Abs(B1[i + 1] - B1[i]) <= 0.001 / (648000 / Math.PI)) { break; } } b.val = B1[i]; dp.B = AngelTransformation.RadtoAng(b); N = ell.c / Math.Sqrt(1.0 + ell.e2 * Math.Pow(Math.Cos(b.val), 2.0)); dp.H = Z / Math.Sin(b.val) - N * (1 - ell.e1); return(dp); }
public static kPoint Forsol(dPoint dp, int what) { int a; double B, L, N, l, t, n, e, X, x, y, a0, a1, a2, a3, a4, a5, a6, a7, L0; Elliptse ell = new Elliptse(); ell = Ellipses.SetEllipse(what); B = dp.B; L = dp.L; a = (int)(L / 6) + 1; L0 = 6 * (double)a - 3; Ang A1, A2, b; A1.val = L; A2.val = L0; b.val = B; L = AngelTransformation.AngtoRad(A1); L0 = AngelTransformation.AngtoRad(A2); l = L - L0; B = AngelTransformation.AngtoRad(b); N = ell.a / Math.Sqrt(1 - ell.e1 * Math.Pow(Math.Sin(B), 2.0)); t = Math.Tan(B); n = Math.Sqrt(ell.e2) * Math.Cos(B); e = ell.e1; a0 = 1 + 3 * e / 4 + 45 * e * e / 64 + 175 * e * e * e / 256 + 11025 * e * e * e * e / 16384 + 43659 * e * e * e * e * e / 65336 + 693693 * Math.Pow(e, 6) / 1048576 + 2760615 * Math.Pow(e, 7) / 41944304 + 703956835 * Math.Pow(e, 8) / 1073741824; a1 = 3 * e / 4 + 15 * e * e / 16 + 525 * e * e * e / 512 + 2205 * e * e * e * e / 2048 + 72765 * e * e * e * e * e / 65536 + 297297 * Math.Pow(e, 6) / 262144 + 19324305 * Math.Pow(e, 7) / 16777216; a2 = 15 * e * e / 64 + 105 * e * e * e / 256 + 2205 * e * e * e * e / 4096 + 10395 * e * e * e * e * e / 16384 + 1486485 * Math.Pow(e, 6) / 2097152 + 6441435 * Math.Pow(e, 7) / 8388608; a3 = 35 * e * e * e / 512 + 315 * e * e * e * e / 2048 + 31185 * e * e * e * e * e / 131072 + 165165 * Math.Pow(e, 6) / 524288 + 6441435 * Math.Pow(e, 7) / 16777216; a4 = 315 * e * e * e * e / 16348 + 3465 * e * e * e * e * e / 65536 + 90999 * Math.Pow(e, 6) / 1048576 + 585585 * Math.Pow(e, 7) / 4194304; a5 = 693 * Math.Pow(e, 5) / 131072 + 9009 * Math.Pow(e, 6) / 524288 + 585585 * Math.Pow(e, 7) / 16777216; a6 = 3003 * Math.Pow(e, 6) / 2097152 + 45045 * Math.Pow(e, 7) / 8388608; a7 = 6435 * Math.Pow(e, 7) / 16777216; X = ell.a * (1 - e) * (a0 * B - 0.5 * a1 * Math.Sin(2 * B) + 0.25 * a2 * Math.Sin(4 * B) - a3 * Math.Sin(6 * B) / 6 + a4 * Math.Sin(8 * B) / 8 - a5 * Math.Sin(10 * B) / 10 + a6 * Math.Sin(12 * B) / 12 - a7 * Math.Sin(14 * B) / 14); x = X + N * Math.Sin(B) * Math.Cos(B) * l * l / 2 + N * Math.Sin(B) * Math.Pow(Math.Cos(B), 3) * (5 - t + 9 * n * n + 4 * Math.Pow(n, 4)) * Math.Pow(l, 4) / 24 + N * Math.Sin(B) * Math.Pow(Math.Cos(B), 5) * (61 - 58 * t * t + Math.Pow(t, 4)) * Math.Pow(l, 6) / 720; y = N * Math.Cos(B) * l + N * Math.Pow(Math.Cos(B), 3) * (1 - t * t + n * n) * Math.Pow(l, 3) / 6 + N * Math.Pow(Math.Cos(B), 5) * (5 - 18 * t * t + Math.Pow(t, 4) + 14 * n * n - 58 * t * t * n * n) * Math.Pow(l, 5); kPoint kp = new kPoint(); kp.X = x; kp.Y = y; return(kp); }
public static dPoint BackCal(kPoint kp, int what) { double B, l, nf, Bf, B0, tf, Nf, Mf, X, C1, C2, C3, C4, a0, a1, a2, a3, a4, a5, a6, a7, e, y; Elliptse ell = new Elliptse(); e = ell.e1; a0 = 1 + 3 * e / 4 + 45 * e * e / 64 + 175 * e * e * e / 256 + 11025 * e * e * e * e / 16384 + 43659 * e * e * e * e * e / 65336 + 693693 * Math.Pow(e, 6) / 1048576 + 2760615 * Math.Pow(e, 7) / 41944304 + 703956835 * Math.Pow(e, 8) / 1073741824; B0 = kp.X / a0; a1 = 3 * e / 4 + 15 * e * e / 16 + 525 * e * e * e / 512 + 2205 * e * e * e * e / 2048 + 72765 * e * e * e * e * e / 65536 + 297297 * Math.Pow(e, 6) / 262144 + 19324305 * Math.Pow(e, 7) / 16777216; a2 = 15 * e * e / 64 + 105 * e * e * e / 256 + 2205 * e * e * e * e / 4096 + 10395 * e * e * e * e * e / 16384 + 1486485 * Math.Pow(e, 6) / 2097152 + 6441435 * Math.Pow(e, 7) / 8388608; a3 = 35 * e * e * e / 512 + 315 * e * e * e * e / 2048 + 31185 * e * e * e * e * e / 131072 + 165165 * Math.Pow(e, 6) / 524288 + 6441435 * Math.Pow(e, 7) / 16777216; a4 = 315 * e * e * e * e / 16348 + 3465 * e * e * e * e * e / 65536 + 90999 * Math.Pow(e, 6) / 1048576 + 585585 * Math.Pow(e, 7) / 4194304; a5 = 693 * Math.Pow(e, 5) / 131072 + 9009 * Math.Pow(e, 6) / 524288 + 585585 * Math.Pow(e, 7) / 16777216; a6 = 3003 * Math.Pow(e, 6) / 2097152 + 45045 * Math.Pow(e, 7) / 8388608; a7 = 6435 * Math.Pow(e, 7) / 16777216; X = ell.a * (1 - e) * (a0 * B0 - 0.5 * a1 * Math.Sin(2 * B0) + 0.25 * a2 * Math.Sin(4 * B0) - a3 * Math.Sin(6 * B0) / 6 + a4 * Math.Sin(8 * B0) / 8 - a5 * Math.Sin(10 * B0) / 10 + a6 * Math.Sin(12 * B0) / 12 - a7 * Math.Sin(14 * B0) / 14); C1 = 3 * e / 8 + 3 * e * e / 16 + 213 * e * e * e / 2048 + 255 * Math.Pow(e, 4) / 4096; C2 = 21 * e * e / 256 + 21 * e * e * e / 256 + 533 * Math.Pow(e, 4) / 8192; C3 = 151 * e * e * e / 6144 + 151 * Math.Pow(e, 4) / 4096; C4 = 1097 * Math.Pow(e, 4) / 131072; Bf = B0 + C1 * Math.Sin(2 * B0) + C2 * Math.Sin(4 * B0) + C3 * Math.Sin(6 * B0) + C4 * Math.Sin(8 * B0); Nf = ell.a / Math.Sqrt(1 - e * Math.Pow(Math.Sin(Bf), 2)); tf = Math.Tan(Bf); nf = Math.Sqrt(ell.e2) * Math.Cos(Bf); Mf = ell.a * (1 - e) / Math.Pow(Math.Sqrt(1 - e * Math.Pow(Math.Sin(Bf), 2)), 3); y = kp.Y; l = y / (Nf * Math.Cos(Bf)) - ((1 + 2 * tf * tf + nf * nf) * Math.Pow(y, 3)) / (6 * Nf * Nf * Nf * Math.Cos(Bf)) + ((5 + 28 * tf * tf + 6 * nf * nf + 24 * Math.Pow(tf, 4) + 8 * tf * tf * nf * nf) * Math.Pow(y, 5)) / (120 * Math.Pow(Nf, 5) * Math.Cos(Bf)); B = Bf - (tf * y * y) / (2 * Mf * Nf) + (5 + 3 * tf * tf + nf * nf - 9 * nf * nf * tf * tf) / (24 * Mf * Math.Pow(Nf, 3)) + ((61 + 90 * tf * tf + 65 * Math.Pow(tf, 4)) * Math.Pow(y, 6)) / (720 * Mf * Math.Pow(Nf, 5)); dPoint dp = new dPoint(); Rad r1, r2; r1.val = B; r2.val = l; dp.B = AngelTransformation.RadtoAng(r1); dp.L = AngelTransformation.RadtoAng(r2); return(dp); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { Elliptse _elsp = Ellipses.SetEllipse(comboBox1.SelectedIndex); //获得当前椭球索引 textBox20.Text = _elsp.name; textBox2.Text = _elsp.a.ToString("F4"); textBox3.Text = _elsp.b.ToString("F6"); textBox4.Text = Math.Sqrt(_elsp.e1).ToString("F12"); textBox5.Text = Math.Sqrt(_elsp.e2).ToString("F9"); textBox6.Text = _elsp.f.ToString("F9"); _elsp.f = 1 / _elsp.f; string f = "(1/" + _elsp.f.ToString("F2") + ")"; textBox6.Text += f; textBox7.Text = _elsp.c.ToString("F12"); }
public static kPoint DToK(dPoint dp, int what) { Elliptse ell = new Elliptse(); ell = Ellipses.SetEllipse(what); double W, N, B, L, H; Ang b, l; b.val = dp.B; l.val = dp.L; B = AngelTransformation.AngtoRad(b); L = AngelTransformation.AngtoRad(l); H = dp.H; W = Math.Sqrt(1 - ell.e1 * Math.Pow(Math.Sin(B), 2.0)); N = ell.a / W; kPoint kp = new kPoint(); kp.X = (N + H) * Math.Cos(B) * Math.Cos(L); kp.Y = (N + H) * Math.Cos(B) * Math.Sin(L); kp.Z = (N * (1 - ell.e1) + H) * Math.Sin(B); return(kp); }
public static Elliptse SetEllipse(int what) { Elliptse el = new Elliptse(); switch (what) { case 0: { el.name = "克拉索夫斯基椭球"; el.a = 6378245.0000; el.b = 6356863.0187730473; el.f = (el.a - el.b) / el.b; el.e1 = (el.a * el.a - el.b * el.b) / (el.a * el.a); el.e2 = (el.a * el.a - el.b * el.b) / (el.b * el.b); el.c = (el.a * el.a) / el.b; break; } case 1: { el.name = "Bessel椭球"; el.a = 6377397.1550; el.b = 6356078.9630; el.f = (el.a - el.b) / el.b; el.e1 = (el.a * el.a - el.b * el.b) / (el.a * el.a); el.e2 = (el.a * el.a - el.b * el.b) / (el.b * el.b); el.c = (el.a * el.a) / el.b; break; } case 2: { el.name = "WGS-84椭球"; el.a = 6378137.0000; el.b = 6356752.3142; el.f = (el.a - el.b) / el.b; el.e1 = (el.a * el.a - el.b * el.b) / (el.a * el.a); el.e2 = (el.a * el.a - el.b * el.b) / (el.b * el.b); el.c = (el.a * el.a) / el.b; break; } case 3: { el.name = "西安80/国际1975年椭球"; el.a = 6378140.0000; el.b = 6356755.2881575287; el.f = (el.a - el.b) / el.b; el.e1 = (el.a * el.a - el.b * el.b) / (el.a * el.a); el.e2 = (el.a * el.a - el.b * el.b) / (el.b * el.b); el.c = (el.a * el.a) / el.b; break; } case 4: { el.name = "2000年中国大地椭球"; el.a = 6378137.0000; el.b = 6356752.3141; el.f = (el.a - el.b) / el.b; el.e1 = (el.a * el.a - el.b * el.b) / (el.a * el.a); el.e2 = (el.a * el.a - el.b * el.b) / (el.b * el.b); el.c = (el.a * el.a) / el.b; break; } } return(el); }