Exemple #1
0
        private void BT_Apply_Click(object sender, EventArgs e)
        {
            double[] data = new double[]   {
                (double)(SE_1.Value), (double)(SE_2.Value), (double)(SE_3.Value),
                (double)(SE_4.Value), (double)(SE_5.Value), (double)(SE_6.Value)
            };
            data = Val3.TrsfTrsf(data, Val3.InverseTrsf(new double[] { 0, 0, (double)(SE_Z.Value), 0, 0, 0 }));
            if (data == null)
            {
                MessageBox.Show("错误");
                return;
            }

            double[] databuff = new double[7];

            for (int i = 0; i < 6; i++)
            {
                databuff[i + 1] = Math.Round(data[i], 3);
            }

            databuff[0] = CBE_IO.SelectedIndex + 1;


            db.EditPresetList(PresetName, databuff, TE_Remark.Text);
        }
Exemple #2
0
        public static bool MatalData()
        {
            try
            {
                if (PolishTxt.PointData == null || PolishTxt.SpeedData == null || PolishTxt.PointData.GetLength(0) != PolishTxt.SpeedData.Length || PolishTxt.PointData.GetLength(1) != 6)
                {
                    return(false);
                }


                for (int k = 0; k < PolishTxt.PointData.GetLength(0); k++)
                {
                    double[] tt = new double[6];

                    for (int i = 3; i < 6; i++)
                    {
                        tt[i] = PolishTxt.PointData[k, i];
                    }
                    tt[3] = -tt[3];
                    double[] buffver = Val3.TrsfTrsf(new double[] { 0, 0, 0, 180, 0, 180 }, tt);



                    if (buffver == null)
                    {
                        return(false);
                    }

                    for (int i = 3; i < 6; i++)
                    {
                        PolishTxt.PointData[k, i] = buffver[i];
                    }
                }


                for (int k = 0; k < PolishTxt.BeforePointData.GetLength(0); k++)
                {
                    double[] tt = new double[6];

                    for (int i = 3; i < 6; i++)
                    {
                        tt[i] = PolishTxt.BeforePointData[k, i];
                    }
                    tt[3] = -tt[3];


                    double[] buffver = Val3.TrsfTrsf(new double[] { 0, 0, 0, 180, 0, 180 }, tt);



                    if (buffver == null)
                    {
                        return(false);
                    }

                    for (int i = 3; i < 6; i++)
                    {
                        PolishTxt.BeforePointData[k, i] = buffver[i];
                    }
                }



                double[] buff = new double[6];
                for (int i = 0; i < 6; i++)
                {
                    buff[i] = PolishTxt.PointData[PolishTxt.PointData.GetLength(0) - 1, i];
                }
                buff = Val3.TrsfTrsf(buff, new double[] { 0, 0, -50, 0, 0, 0 });
                if (buff == null)
                {
                    return(false);
                }
                PolishTxt.AfterPointData = new double[1, 6];

                for (int i = 0; i < 6; i++)
                {
                    PolishTxt.AfterPointData[0, i] = buff[i];
                }



                return(true);
            }
            catch
            {
                return(false);
            }
        }