Exemple #1
0
        public static Matriz Escala(float x, float y, float z)
        {
            Matriz retorno = Matriz.Nula4x4;

            retorno.matrix[0, 0] = x;
            retorno.matrix[1, 1] = y;
            retorno.matrix[2, 2] = z;
            return(retorno);
        }
Exemple #2
0
        public static Matriz Traslacion(float x, float y, float z)
        {
            Matriz retorno = Matriz.Identidad4x4;

            retorno.matrix[3, 0] = x;
            retorno.matrix[3, 1] = y;
            retorno.matrix[3, 2] = z;
            return(retorno);
        }
Exemple #3
0
 public override bool Equals(object obj)
 {
     try
     {
         Matriz objeto = obj as Matriz;
         return(EsIgual(this, objeto));
     }
     catch (Exception e)
     {
         Console.WriteLine(e.Message);
         return(false);
     }
 }
Exemple #4
0
        public Matriz Transpuesta()
        {
            Matriz matrizResultado = new Matriz(cantColumna, cantFila);

            for (int fil = 0; fil < cantFila; fil++)
            {
                for (int col = 0; col < cantColumna; col++)
                {
                    matrizResultado.matrix[col, fil] = matrix[fil, col];
                }
            }
            return(matrizResultado);
        }
Exemple #5
0
        public static Matriz Multiplicacion(Matriz m, float escalar)
        {
            Matriz matrizResultado = new Matriz(m.cantFila, m.cantColumna);

            for (int fil = 0; fil < m.cantFila; fil++)
            {
                for (int col = 0; col < m.cantColumna; col++)
                {
                    matrizResultado.matrix[fil, col] = m.matrix[fil, col] * escalar;
                }
            }
            return(matrizResultado);
        }
Exemple #6
0
        public static void Copiar(float[,] origen, ref Matriz destino)
        {
            if (origen.GetLength(0) != destino.cantColumna || origen.GetLength(1) != destino.cantFila)
            {
                throw new MatrizException(MatrizException.SizeError);
            }

            for (int fil = 0; fil < destino.cantFila; fil++)
            {
                for (int col = 0; col < destino.cantColumna; col++)
                {
                    origen[fil, col] = destino.matrix[fil, col];
                }
            }
        }
Exemple #7
0
        public static void Copiar(Matriz origen, ref Matriz destino)
        {
            if (origen.cantColumna != destino.cantColumna || origen.cantFila != destino.cantFila)
            {
                throw new MatrizException(MatrizException.SizeError);
            }

            for (int fil = 0; fil < origen.cantFila; fil++)
            {
                for (int col = 0; col < origen.cantColumna; col++)
                {
                    origen.matrix[fil, col] = destino.matrix[fil, col];
                }
            }
        }
Exemple #8
0
        public static Matriz Resta(Matriz m1, Matriz m2)
        {
            if (m1.cantColumna != m2.cantColumna || m1.cantFila != m2.cantFila)
            {
                throw new MatrizException(MatrizException.SizeError);
            }

            Matriz matrizResultado = new Matriz(m1.cantFila, m1.cantColumna);

            for (int fil = 0; fil < m1.cantFila; fil++)
            {
                for (int col = 0; col < m1.cantColumna; col++)
                {
                    matrizResultado.matrix[fil, col] = m1.matrix[fil, col] - m2.matrix[fil, col];
                }
            }
            return(matrizResultado);
        }
Exemple #9
0
        public static Matriz Multiplicacion(Matriz m1, Matriz m2)
        {
            if (m1.cantColumna != m2.cantFila)
            {
                throw new MatrizException(MatrizException.SizeError);
            }

            Matriz matrizResultado = new Matriz(m1.cantFila, m2.cantColumna);
            float  auxValor;

            for (int filM1 = 0; filM1 < m1.cantFila; filM1++)
            {
                for (int colM2 = 0; colM2 < m2.cantColumna; colM2++)
                {
                    auxValor = 0;
                    for (int mix = 0; mix < m2.cantFila; mix++)
                    {
                        auxValor += m1.matrix[filM1, mix] * m2.matrix[mix, colM2];
                    }
                    matrizResultado.matrix[filM1, colM2] = auxValor;
                }
            }
            return(matrizResultado);
        }
Exemple #10
0
 public static bool EsRectangulo(Matriz m1)
 {
     return(m1.cantColumna != m1.cantFila);
 }
Exemple #11
0
 public static bool EsCuadrada(Matriz m1)
 {
     return(m1.cantColumna == m1.cantFila);
 }
Exemple #12
0
 public static bool EsTranspuesta(Matriz m1, Matriz m2)
 {
     return(EsIgual(m1, m2.Transpuesta()));
 }