//pipe 직경, 중심점 계산
        private void button10_Click(object sender, EventArgs e)
        {
            try
            {
                Point3d p1 = null;
                Point3d p2 = null;
                Point3d p3 = null;


                p1 = Get_Point_from_Textbox(tbPoint1);
                p2 = Get_Point_from_Textbox(tbPoint2);
                p3 = Get_Point_from_Textbox(tbPoint3);


                if ((p1 != null) && (p2 != null) && (p3 != null))
                {
                    pipe1 = new Pipe(p1, p2, p3);
                    pipe1.Set_Info_To_TextBox(tbCenter_P1, tbDiameter);
                    //텍스트박스에 중점의 좌표와 직경을 표시해준다.
                }

                Console.WriteLine();
                Console.WriteLine("pipe1's center point(Laser Origin)");
                SHOW_N_S_W_E(pipe1._center_point);

                Console.WriteLine("pipe1's normal vector");
                SHOW_N_S_W_E(pipe1._normal_vector);
                //********************************

                double[] vec1 = { 1, 0, 0, pipe1._center_point.X };
                double[] vec2 = { 0, 1, 0, pipe1._center_point.Y };
                double[] vec3 = { 0, 0, 1, pipe1._center_point.Z };
                double[] vec4 = { 0, 0, 0, 1 };

                Matrix4d translation = new Matrix4d(vec1, vec2, vec3, vec4, (int)MyEnum.row_type);
                Console.WriteLine("translation to pipe1's center point");
                Console.WriteLine(translation);
                Console.WriteLine();
                Console.WriteLine("Inverse of translation");
                Console.WriteLine(translation.Inverse());
                inv_H = translation.Inverse();
            }
            catch (Exception ex)
            {
                MessageBox.Show("세 개의 점 데이터가 필요합니다.");
                Console.WriteLine(ex.Message);
            }
        }
Exemple #2
0
        public void Matrix4DInversionTest()
        {
            double[] data   = new double[] { 1, -2, 3, 4, 1, 2, -3, 4, 1, 2, 3, -4, 1, 2, 3, 4 };
            Matrix4d m      = new Matrix4d(data);
            var      inv    = m.Inverse();
            var      result = inv * m;

            Assert.IsTrue(result.IsIdentity());
        }
    public Matrix5d Inverse()
    {
        Matrix4d inv = Transformation.Inverse();

        return(new Matrix5d(inv, -(inv * Translation)));
    }