git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@306 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
5293491b3b
commit
8b1ef8a5fc
|
@ -45,6 +45,7 @@ Matrix::Matrix(int nbRow, int nbColumn) throw(std::invalid_argument)
|
||||||
array[i] = new double[nbColumn];
|
array[i] = new double[nbColumn];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO : This initialization loop must be removed carefully
|
||||||
// Fill the matrix with zero's
|
// Fill the matrix with zero's
|
||||||
for (int i=0; i<nbRow; ++i) {
|
for (int i=0; i<nbRow; ++i) {
|
||||||
for(int j=0; j<nbColumn; ++j) {
|
for(int j=0; j<nbColumn; ++j) {
|
||||||
|
@ -309,6 +310,15 @@ void Matrix::fillInSubMatrix(unsigned int rowIndex, unsigned int colIndex, const
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Initialize all the matrix with the given value
|
||||||
|
void Matrix::initWithValue(double value) {
|
||||||
|
for (unsigned int i=0; i<nbRow; ++i) {
|
||||||
|
for(unsigned int j=0; j<nbColumn; ++j) {
|
||||||
|
array[i][j] = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Definition of the operator + for the sum of two matrices with references
|
// Definition of the operator + for the sum of two matrices with references
|
||||||
Matrix Matrix::operator+(const Matrix& matrix2) const throw(MathematicsException) {
|
Matrix Matrix::operator+(const Matrix& matrix2) const throw(MathematicsException) {
|
||||||
if (nbRow == matrix2.nbRow && nbColumn == matrix2.nbColumn) {
|
if (nbRow == matrix2.nbRow && nbColumn == matrix2.nbColumn) {
|
||||||
|
|
|
@ -59,7 +59,7 @@ class Matrix {
|
||||||
double getTrace() const throw(MathematicsException); // Return the trace of a square matrix
|
double getTrace() const throw(MathematicsException); // Return the trace of a square matrix
|
||||||
static Matrix identity(int dimension) throw(std::invalid_argument); // Return the identity matrix I of the given dimension
|
static Matrix identity(int dimension) throw(std::invalid_argument); // Return the identity matrix I of the given dimension
|
||||||
void fillInSubMatrix(unsigned int i, unsigned int j, const Matrix& subMatrix); // Fill in a sub-matrix of the current matrix with another matrix
|
void fillInSubMatrix(unsigned int i, unsigned int j, const Matrix& subMatrix); // Fill in a sub-matrix of the current matrix with another matrix
|
||||||
|
void initWithValue(double value); // Initialize all the matrix with the given value
|
||||||
void display() const; // TO DELETE
|
void display() const; // TO DELETE
|
||||||
|
|
||||||
// --- Overloaded operators --- //
|
// --- Overloaded operators --- //
|
||||||
|
|
Loading…
Reference in New Issue
Block a user