From 903e5436953e858bdcbaff870dcc633e2a9559a0 Mon Sep 17 00:00:00 2001 From: "chappuis.daniel" Date: Tue, 8 Jun 2010 21:02:11 +0000 Subject: [PATCH] git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@327 92aac97c-a6ce-11dd-a772-7fcde58d38e6 --- sources/reactphysics3d/constraint/Contact.cpp | 7 ++++++ .../reactphysics3d/engine/PhysicsEngine.cpp | 2 -- sources/reactphysics3d/mathematics/Matrix.cpp | 24 ++++++++++++++++++- sources/reactphysics3d/mathematics/Matrix.h | 1 + sources/reactphysics3d/mathematics/Vector.cpp | 16 ++++++++++++- sources/reactphysics3d/mathematics/Vector.h | 11 --------- .../mathematics/lcp/LCPSolver.h | 2 +- 7 files changed, 47 insertions(+), 16 deletions(-) diff --git a/sources/reactphysics3d/constraint/Contact.cpp b/sources/reactphysics3d/constraint/Contact.cpp index 1477d5dc..903f47e7 100644 --- a/sources/reactphysics3d/constraint/Contact.cpp +++ b/sources/reactphysics3d/constraint/Contact.cpp @@ -29,6 +29,13 @@ using namespace reactphysics3d; // Constructor Contact::Contact(Body* const body1, Body* const body2, const Vector3D& normal, double penetrationDepth, const Vector3D& point) :Constraint(body1, body2, 2, true), normal(normal), penetrationDepth(penetrationDepth), point(point) { + body1Jacobian.changeSize(1,6); + body2Jacobian.changeSize(1,6); + auxJacobian.changeSize(nbAuxConstraints, 12); + auxLowerBounds.changeSize(nbAuxConstraints); + auxUpperBounds.changeSize(nbAuxConstraints); + auxErrorValues.changeSize(nbAuxConstraints); + body1Jacobian = Matrix(1, 6); body2Jacobian = Matrix(1, 6); auxJacobian = Matrix(nbAuxConstraints, 12); diff --git a/sources/reactphysics3d/engine/PhysicsEngine.cpp b/sources/reactphysics3d/engine/PhysicsEngine.cpp index c87b4682..22445aec 100644 --- a/sources/reactphysics3d/engine/PhysicsEngine.cpp +++ b/sources/reactphysics3d/engine/PhysicsEngine.cpp @@ -86,10 +86,8 @@ void PhysicsEngine::updateCollision() { // While the time accumulator is not empty while(timer.getAccumulator() >= timer.getTimeStep().getValue()) { - // Compute the collision detection if (collisionDetection.computeCollisionDetection()) { - // TODO : Delete this ---------------------------------------------------------- for (std::vector::iterator it = world->getConstraintsBeginIterator(); it != world->getConstraintsEndIterator(); ++it) { RigidBody* rigidBody1 = dynamic_cast((*it)->getBody1()); diff --git a/sources/reactphysics3d/mathematics/Matrix.cpp b/sources/reactphysics3d/mathematics/Matrix.cpp index 61219923..bb0e4938 100644 --- a/sources/reactphysics3d/mathematics/Matrix.cpp +++ b/sources/reactphysics3d/mathematics/Matrix.cpp @@ -27,7 +27,7 @@ using namespace reactphysics3d; // Constructor without argument Matrix::Matrix() :nbRow(0), nbColumn(0) { - + array = 0; } // Constructor of the class Matrix @@ -123,6 +123,28 @@ Matrix::~Matrix() { delete this->array; } +void Matrix::changeSize(uint newNbRows, uint newNbColumns) { + if (array) { + // Destruction of the dynamic array + for(int i=0; iarray; + } + + // Create the two dimensional dynamic array + array = new double*[newNbRows]; + + assert(array != 0); // Array pointer musn't be null + + for(int i=0; i 0); this->maxIterations = maxIterations; }