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);
        }
Beispiel #2
0
        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);
        }
Beispiel #3
0
        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);
        }
        public static kPoint ParaSwi(kPoint kp, double X, double Y, double xita, double k)
        {
            kPoint kp1 = new kPoint();
            Ang    a;

            a.val = xita;
            xita  = AngelTransformation.AngtoRad(a);
            kp1.X = X + k * kp.X * Math.Cos(xita) - k * kp.Y * Math.Sin(xita);
            kp1.Y = Y + k * kp.Y * Math.Cos(xita) + k * kp.X * Math.Sin(xita);
            return(kp1);
        }
Beispiel #5
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (textBox10.Text == "" || textBox11.Text == "" || textBox12.Text == "")
     {
         MessageBox.Show("必需数据不足!");
     }
     else
     {
         dPoint dp = new dPoint();
         kPoint kp = new kPoint();
         double L0;
         L0            = double.Parse(textBox12.Text);
         kp.X          = double.Parse(textBox10.Text);
         kp.Y          = double.Parse(textBox11.Text);
         dp            = Gauss.BackCal(kp, comboBox1.SelectedIndex);
         textBox1.Text = dp.B.ToString("F8");
         textBox8.Text = (dp.L + L0).ToString("F8");
     }
 }
Beispiel #6
0
 private void button4_Click(object sender, EventArgs e)
 {
     if ((textBox7.Text == "") || (textBox8.Text == ""))
     {
         MessageBox.Show("必需数据不足!");
     }
     else
     {
         dPoint dp = new dPoint();
         kPoint kp = new kPoint();
         dp.L = double.Parse(textBox1.Text);
         dp.B = double.Parse(textBox8.Text);
         int what = comboBox1.SelectedIndex;
         kp             = Gauss.Forsol(dp, what);
         textBox10.Text = kp.X.ToString("F6");
         textBox11.Text = kp.Y.ToString("F6");
         double L0;
         L0             = 6 * ((int)(dp.L / 6) + 1) - 3;
         textBox12.Text = L0.ToString();
     }
 }
Beispiel #7
0
 private void button7_Click(object sender, EventArgs e)
 {
     if (textBox16.Text == "" || textBox17.Text == "" || textBox18.Text == "" || textBox19.Text == "")
     {
         MessageBox.Show("必需数据不足!");
     }
     else
     {
         double X    = double.Parse(textBox16.Text);
         double Y    = double.Parse(textBox17.Text);
         double xita = double.Parse(textBox18.Text);
         double k    = double.Parse(textBox19.Text);
         kPoint kp   = new kPoint();
         kp.X = double.Parse(textBox10.Text);
         kp.Y = double.Parse(textBox11.Text);
         kPoint kp1 = new kPoint();
         kp1 = CoordinateTransforming.ParaSwi(kp, X, Y, xita, k);
         ListViewItem b = new ListViewItem(new string[] { Form1.select.s1[0], Form1.select.s1[1],
                                                          kp.X.ToString(), kp1.X.ToString(), kp.Y.ToString(), kp1.Y.ToString() });
         listView2.Items.Add(b);
     }
 }
        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);
        }