diff --git a/sources/reactphysics3d/mathematics/Matrix.cpp b/sources/reactphysics3d/mathematics/Matrix.cpp index ff85812e..e85020f2 100644 --- a/sources/reactphysics3d/mathematics/Matrix.cpp +++ b/sources/reactphysics3d/mathematics/Matrix.cpp @@ -101,6 +101,19 @@ Matrix::Matrix(const Matrix3x3& matrix) } } + +// Conversion from Vector to Matrix +Matrix::Matrix(const Vector& vector) { + // Create the two dimensional dynamic array + array = new double*[vector.getNbComponent()]; + assert(array != 0); + + for(int i=0; i #include @@ -47,6 +48,7 @@ class Matrix { 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 + Matrix(const Vector& vector); // Conversion from Vector to Matrix 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 diff --git a/sources/reactphysics3d/mathematics/Vector.h b/sources/reactphysics3d/mathematics/Vector.h index 91394d69..90c9a130 100644 --- a/sources/reactphysics3d/mathematics/Vector.h +++ b/sources/reactphysics3d/mathematics/Vector.h @@ -45,7 +45,7 @@ class Vector { public : Vector(); // Constructor without argument Vector(int n) throw(std::invalid_argument); // Constructor of the class Vector - Vector(const Vector& vector); // Copy-constructor of the class Vector + Vector(const Vector& vector); // Copy-constructor of the class Vector virtual ~Vector(); // Destructor of the class Vector double getValue(int n) const throw(std::invalid_argument); // Get a component of the vector void setValue(int n, double value) throw(std::invalid_argument); // Set the value of a component of the vector