示例#1
0
        public static double[] CrossProduct(double[] vector1, double[] vector2)
        {
            int length = 3;

            if (length != vector1.Length || length != vector2.Length)
            {
                throw new InvalidOperationException(Properties.Resources.Exception_3DRequired);
            }

            double[,] matrix = new double[length, length];
            for (int row = 0; row < length; row++)
            {
                for (int col = 0; col < length; col++)
                {
                    if (row == 0)
                    {
                        matrix[row, col] = 1;
                    }
                    else if (row == 1)
                    {
                        matrix[row, col] = vector1[col];
                    }
                    else if (row == 2)
                    {
                        matrix[row, col] = vector2[col];
                    }
                }
            }


            return(MatrixFunctions.CrossProduct(matrix));
        }