Add the conversion from Vector3D to Vector

git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@317 92aac97c-a6ce-11dd-a772-7fcde58d38e6
This commit is contained in:
chappuis.daniel 2010-05-17 21:44:38 +00:00
parent 96786c2f9e
commit 870223ba87
2 changed files with 12 additions and 0 deletions

View File

@ -60,6 +60,16 @@ Vector::Vector(const Vector& vector) {
}
}
// Conversion from Vector3D to Vector
Vector::Vector(const Vector3D& vector3d) {
nbComponent = 3;
tab = new double[3];
tab[0] = vector3d.getX();
tab[1] = vector3d.getY();
tab[2] = vector3d.getZ();
}
// Destructor of the class Vector
Vector::~Vector() {
// Erase the array with the values of the vector

View File

@ -21,6 +21,7 @@
#define VECTOR_H
// Libraries
#include "Vector3D.h"
#include "../typeDefinitions.h"
#include "mathematics_functions.h"
#include "exceptions.h"
@ -46,6 +47,7 @@ class Vector {
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 Vector3D& vector3d); // Conversion from Vector3D to 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