diff --git a/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp b/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp index 3e57f895..b2914539 100644 --- a/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp +++ b/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp @@ -19,6 +19,7 @@ // Libraries #include "LCPProjectedGaussSeidel.h" +#include using namespace reactphysics3d; @@ -39,9 +40,10 @@ void LCPProjectedGaussSeidel::solve(const Matrix** const J_sp, const Matrix** co uint nbBodies, const Body*** const bodyMapping, std::map bodyNumberMapping, const Vector& b, const Vector& lowLimits, const Vector& highLimits, Vector& lambda) const { lambda = lambdaInit; - double d[] = new double[nbConstraints]; + double d[] = new double[nbConstraints]; // TODO : Avoid those kind of memory allocation here for optimization (allocate once in the object) Body* indexBody1, indexBody2; double deltaLambda; + double lambdaTemp; uint i, iter; Vector* a = new Vector(6)[nbBodies]; // Array that contains nbBodies vector of dimension 6x1 @@ -54,12 +56,15 @@ void LCPProjectedGaussSeidel::solve(const Matrix** const J_sp, const Matrix** co for (i=0; i bodyNumberMapping, - Vector* const a) { + Vector* const a, uint nbBodies) const { uint i; Body* indexBody1, indexBody2; // Init the vector a with zero values - a.initWithValue(0.0); + for (i=0; i bodyNumberMapping, + Vector* const a, uint nbBodies) const ; // Compute the vector a used in the solve() method + public: LCPProjectedGaussSeidel(uint maxIterations); // Constructor virtual ~LCPProjectedGaussSeidel(); // Destructor