diff --git a/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp b/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp index 852fae11..d16bef68 100644 --- a/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp +++ b/sources/reactphysics3d/mathematics/lcp/LCPProjectedGaussSeidel.cpp @@ -40,9 +40,8 @@ void LCPProjectedGaussSeidel::solve(Matrix** J_sp, Matrix** B_sp, uint nbConstra uint nbBodies, Body*** const bodyMapping, std::map
bodyNumberMapping, const Vector& b, const Vector& lowLimits, const Vector& highLimits, Vector& lambda) const { - int size1 = lambda.getNbComponent(); - int size2 = lambdaInit.getNbComponent(); lambda = lambdaInit; + double* d = new double[nbConstraints]; // TODO : Avoid those kind of memory allocation here for optimization (allocate once in the object) uint indexBody1, indexBody2; double deltaLambda; @@ -53,6 +52,9 @@ void LCPProjectedGaussSeidel::solve(Matrix** J_sp, Matrix** B_sp, uint nbConstra a[i].changeSize(6); } + // Compute the vector a + computeVectorA(lambda, nbConstraints, bodyMapping, B_sp, bodyNumberMapping, a, nbBodies); + // For each constraint for (i=0; i