git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@283 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
parent
e05ff5627c
commit
6e87a16e00
|
@ -79,6 +79,27 @@ Matrix::Matrix(const Matrix& matrix)
|
|||
}
|
||||
}
|
||||
|
||||
// Conversion from Matrix3x3
|
||||
Matrix::Matrix(const Matrix3x3& matrix)
|
||||
:nbRow(3), nbColumn(3) {
|
||||
|
||||
// Create the two dimensional dynamic array
|
||||
array = new double*[nbRow];
|
||||
|
||||
assert(array != 0); // Array pointer musn't be null
|
||||
|
||||
for(int i=0; i<nbRow; ++i) {
|
||||
array[i] = new double[nbColumn];
|
||||
}
|
||||
|
||||
// Copy the matrix
|
||||
for (int i=0; i<nbRow; ++i) {
|
||||
for(int j=0; j<nbColumn; ++j) {
|
||||
setValue(i,j, matrix.getValue(i,j));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Destructor of the class Matrix
|
||||
Matrix::~Matrix() {
|
||||
// Destruction of the dynamic array
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
// Libraries
|
||||
#include "exceptions.h"
|
||||
#include "Matrix3x3.h"
|
||||
#include <stdexcept>
|
||||
#include <iostream>
|
||||
|
||||
|
@ -45,6 +46,7 @@ class Matrix {
|
|||
Matrix(); // Constructor without argument
|
||||
Matrix(int nbRow, int nbColum) throw(std::invalid_argument); // Constructor of the class Matrix
|
||||
Matrix(const Matrix& matrix); // Copy constructor of the class Matrix
|
||||
Matrix(const Matrix3x3& matrix); // Conversion from Matrix3x3
|
||||
virtual ~Matrix(); // Destructor of the class Matrix
|
||||
double getValue(int i, int j) const throw(std::invalid_argument); // Return a value in the matrix
|
||||
void setValue(int i, int j, double value) throw(std::invalid_argument); // Set a value in the matrix
|
||||
|
|
Loading…
Reference in New Issue
Block a user