Exemple #1
0
        /// <summary>
        /// Using the cross prduct(returns a matrix)
        /// it gets the dot product of
        /// ( ROW 1 of matrix A by COLUMN 1 of matris B, ROW 1 of matrix A by COLUMN 2 of matris B, ROW 1 of matrix A by COLUMN 3 of matris B )
        /// ( ROW 2 of matrix A by COLUMN 1 of matris B, ROW 1 of matrix A by COLUMN 2 of matris B, ROW 1 of matrix A by COLUMN 3 of matris B )
        /// ( ROW 3 of matrix A by COLUMN 1 of matris B, ROW 1 of matrix A by COLUMN 2 of matris B, ROW 1 of matrix A by COLUMN 3 of matris B )
        /// </summary>
        /// <param name="M1"></param>
        /// <param name="M2"></param>
        /// <returns></returns>
        public static Matrix3 operator *(Matrix3 M1, Matrix3 M2)
        {// An overloaded operator * to return the  product of two matrix
            Matrix3 answer = new Matrix3(M1.Row(0).DotProduct(M2.Column(0)), M1.Row(0).DotProduct(M2.Column(1)), M1.Row(0).DotProduct(M2.Column(3)),
                                         M1.Row(1).DotProduct(M2.Column(0)), M1.Row(1).DotProduct(M2.Column(1)), M1.Row(1).DotProduct(M2.Column(3)),
                                         M1.Row(2).DotProduct(M2.Column(0)), M1.Row(2).DotProduct(M2.Column(1)), M1.Row(2).DotProduct(M2.Column(3)));

            return(answer);
        }
Exemple #2
0
        public static Matrix3 operator *(Matrix3 M1, Matrix3 M2)
        {// An overloaded operator * to return the  product of two matrix
            Matrix3 answer = new Matrix3();

            answer.A11 = M1.Row(0) * M2.Column(0);
            answer.A12 = M1.Row(0) * M2.Column(1);
            answer.A13 = M1.Row(0) * M2.Column(2);

            answer.A21 = M1.Row(1) * M2.Column(0);
            answer.A22 = M1.Row(1) * M2.Column(1);
            answer.A23 = M1.Row(1) * M2.Column(2);

            answer.A31 = M1.Row(2) * M2.Column(0);
            answer.A32 = M1.Row(2) * M2.Column(1);
            answer.A33 = M1.Row(2) * M2.Column(2);


            return(answer);
        }