示例#1
0
        public double[,] CreateTransformationMatrix()
        {
            // создаем единичную матрицу 2х2
            double[,] matrix = Matrices.CreateIdentityMatrix(2);

            matrix[0, 0] += HorizontalStretch;
            matrix[1, 1] += VerticalStretch;

            return(matrix);
        }
        ///
        /// Объединяет преобразования в единую матрицу трансформации
        ///
        private static double[,] CreateTransformationMatrix
            (IImageTransformation[] vectorTransformations, int dimensions)
        {
            double[,] vectorTransMatrix =
                Matrices.CreateIdentityMatrix(dimensions);

            // перемножает матрицы трансформации
            foreach (var trans in vectorTransformations)
            {
                vectorTransMatrix =
                    Matrices.Multiply(vectorTransMatrix, trans.CreateTransformationMatrix());
            }

            return(vectorTransMatrix);
        }
示例#3
0
        public double[,] CreateTransformationMatrix()
        {
            // создаем единичную матрицу 2х2
            double[,] matrix = Matrices.CreateIdentityMatrix(2);

            if (FlipHorizontally)
            {
                matrix[0, 0] *= -1;
            }
            if (FlipVertically)
            {
                matrix[1, 1] *= -1;
            }

            return(matrix);
        }