diff --git a/sources/reactphysics3d/Matrix.cpp b/sources/reactphysics3d/Matrix.cpp deleted file mode 100644 index cf48744c..00000000 --- a/sources/reactphysics3d/Matrix.cpp +++ /dev/null @@ -1,415 +0,0 @@ -/**************************************************************************** - * Copyright (C) 2009 Daniel Chappuis * - **************************************************************************** - * This file is part of ReactPhysics3D. * - * * - * ReactPhysics3D is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * ReactPhysics3D is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with ReactPhysics3D. If not, see . * - ***************************************************************************/ - -// Libraries -#include -#include "Matrix.h" - -// Namespaces -using namespace reactphysics3d; - -// Constructor of the class Matrix -Matrix::Matrix(int nbRow, int nbColumn) throw(std::invalid_argument) - :nbRow(nbRow),nbColumn(nbColumn) { - // Check the arguments - if (nbRow>0 && nbColumn>0) { - - // Create the two dimensional dynamic array - array = new double*[nbRow]; - - assert(array != 0); // Array pointer musn't be null - - for(int i=0; iarray; -} - - -// Function that return the cofactor matrix by removing row i and column j -Matrix Matrix::getCofactor(int i, int j) const throw(std::invalid_argument) { - // If i and j are in the matrix - if (0<= i && i < nbRow && 0<= j && j 0) { - // Create a new matrix - Matrix identityMatrix(dimension,dimension); - - // Fill in the identity matrix - for(int i=0; igetValue(i,j) + matrix2.getValue(i,j)); - } - } - - // Return the sum matrix - return sumMatrix; - } - else { - // We throw an MathematicsException - throw MathematicsException("MathematicsException : Addition of the matrices isn't possible beacause the size of the matrices aren't the same"); - } -} - -// Definition of the operator - for the substraction of two matrices with references -Matrix Matrix::operator-(const Matrix& matrix2) const throw(MathematicsException) { - if (nbRow == matrix2.nbRow && nbColumn == matrix2.nbColumn) { - // Create a new matrix - Matrix sumMatrix(nbRow, nbColumn); - - // Substract the two matrices - for(int i=0; inbColumn; ++j) { - sumMatrix.setValue(i, j, this->getValue(i,j) - matrix2.getValue(i,j)); - } - } - - // Return the sum matrix - return sumMatrix; - } - else { - // We throw a MathematicsException - throw MathematicsException("MathematicsException : Substraction of the matrices isn't possible beacause the size of the matrices aren't the same"); - } -} - -// Overloaded operator * for the multiplication of the matrix with a number -Matrix Matrix::operator*(double nb) const { - // Creation of the result matrix - Matrix result(nbRow,nbColumn); - - // Multiplication of the matrix with the number - for(int i=0; isetValue(i,j, matrix2.getValue(i,j)); - } - } - } - - // Return a reference to the matrix - return *this; - } - else { - // Throw a MathematicsException - throw MathematicsException("MathematicsException : Assignment impossible because the size of the matrices aren't the same !"); - } -} - -// Overloaded operator for equality condition -bool Matrix::operator==(const Matrix& matrix2) const throw(MathematicsException) { - // Check if the matrices dimensions are compatible - if (nbRow == matrix2.nbRow && nbColumn == matrix2.nbColumn) { - for (int i=0; i