예제 #1
0
        private void btn_ShowQ_Click(object sender, EventArgs e)
        {
            Suface_Equation se1 = new Suface_Equation();//X=0,A=1

            se1.A = 1; se1.B = 0; se1.C = 0; se1.D = 0;
            Suface_Equation se2 = new Suface_Equation();//Y=0,B=1

            se2.A = 0; se2.B = 1; se2.C = 0; se2.D = 0;
            Suface_Equation se3 = new Suface_Equation();//Z=0,C=1

            se3.A = 0; se3.B = 0; se3.C = 1; se3.D = 0;
            Suface_Equation se = new Suface_Equation();//3个高度的平面方程

            listArrayQ[0].Clear();
            listArrayQ[1].Clear();
            listArrayQ[2].Clear();
            for (int i = 0; i < lsheight.Count - 1; i++)//表头不显示
            {
                se = MMS_algorithm.Instance.Calculating_Coefficient(Convert.ToDouble(lsheight[i + 1][1]), Convert.ToDouble(lsheight[i + 1][2]), Convert.ToDouble(lsheight[i + 1][3]));
                listArrayQ[0].Add(Convert.ToDouble(lsheight[i + 1][0]), MMS_algorithm.Instance.Calculating_dihedral(se, se3));
                listArrayQ[1].Add(Convert.ToDouble(lsheight[i + 1][0]), 90 - MMS_algorithm.Instance.Calculating_dihedral(se, se2));
                listArrayQ[2].Add(Convert.ToDouble(lsheight[i + 1][0]), 90 - MMS_algorithm.Instance.Calculating_dihedral(se, se1));
            }
            zedGraphControl2.AxisChange();
            zedGraphControl2.Refresh();
            this.btn_ShowAQ.Enabled = true;
        }
예제 #2
0
        /// <summary>
        /// 三点求面方式
        /// </summary>
        /// <param name="z1"></param>
        /// <param name="z2"></param>
        /// <param name="z3"></param>
        /// <returns></returns>
        public Suface_Equation Calculating_Coefficient(double z1, double z2, double z3)
        {
            double x1 = 17.8;
            double y1 = 50;
            double x2 = 22.8;
            double y2 = 50;
            double x3 = 51.8;
            double y3 = 9.5;
            double a2 = x2 - x1;
            double b2 = y2 - y1;
            double c2 = z2 - z1;

            double a3 = x3 - x1;
            double b3 = y3 - y1;
            double c3 = z3 - z1;

            double          A  = b2 * c3 - b3 * c2;
            double          B  = a3 * c2 - a2 * c3;
            double          C  = a2 * b3 - a3 * b2;
            double          D  = a2 * c3 * y1 + a3 * b2 * z1 + b3 * c2 * x1 - x1 * b2 * c3 - a2 * b3 * z1 - a3 * c2 * y1;
            Suface_Equation se = new Suface_Equation();

            se.A = A; se.B = B; se.C = C; se.D = D;
            return(se);
        }
예제 #3
0
        private void FrmMMS_Calculate_Load(object sender, EventArgs e)
        {
            Suface_Equation se = new Suface_Equation();

            se = MMS_algorithm.Instance.Calculating_Coefficient(0.1429, 0.1282, 0.218);
            Suface_Equation se1 = new Suface_Equation();

            se1.A = 0;
            se1.B = 0;
            se1.C = 1;
            se1.D = 0;
            Suface_Equation se2 = new Suface_Equation();

            se2.A = -1.15385;
            se2.B = 0.692308;
            se2.C = 1;
            se2.D = 2.23077;
            double alfa = MMS_algorithm.Instance.Calculating_dihedral(se, se1);

            this.btn_ShowAQ.Enabled       = false;
            this.btn_ShowQ.Enabled        = false;
            this.btn_SaveAll.Enabled      = false;
            this.btn_Save_Current.Enabled = false;
            lsheight  = Globals.csv.ReadCSV(PVar.BZ_ParameterPath + "manual_Test.csv");
            lsCurrent = Globals.csv.ReadCSV(PVar.BZ_ParameterPath + "current_test.csv");
            LoadHeightPane();
            LoadPaneQ();
            LoadPaneAQ();
            LoadPaneCurrent();
        }
예제 #4
0
        /// <summary>
        /// 已知两个面,求两面角
        /// </summary>
        /// <param name="Coeff1"></param>
        /// <param name="Coeff2"></param>
        /// <returns></returns>
        public double Calculating_dihedral(Suface_Equation Coeff1, Suface_Equation Coeff2)//两面角
        {
            double h    = Math.Sqrt(Coeff1.A * Coeff1.A + Coeff1.B * Coeff1.B + Coeff1.C * Coeff1.C);
            double i    = Math.Sqrt(Coeff2.A * Coeff2.A + Coeff2.B * Coeff2.B + Coeff2.C * Coeff2.C);
            double j    = Math.Abs(Coeff1.A * Coeff2.A + Coeff1.B * Coeff2.B + Coeff1.C * Coeff2.C);
            double CosA = j / (h * i);

            if (CosA == 1)
            {
                return(0);
            }
            else
            {
                return((Math.Acos(CosA)) * (180 / Math.PI));
            }
        }