git-svn-id: https://reactphysics3d.googlecode.com/svn/trunk@322 92aac97c-a6ce-11dd-a772-7fcde58d38e6

This commit is contained in:
chappuis.daniel 2010-05-21 16:36:00 +00:00
parent 2f6cde24ee
commit 09b82aa42a

View File

@ -43,7 +43,7 @@ void LCPProjectedGaussSeidel::solve(const Matrix** const J_sp, const Matrix** co
Body* indexBody1, indexBody2; Body* indexBody1, indexBody2;
double deltaLambda; double deltaLambda;
uint i, iter; uint i, iter;
Vector a(6*nbBodies); Vector* a = new Vector(6)[nbBodies]; // Array that contains nbBodies vector of dimension 6x1
// For each constraint // For each constraint
for (i=0; i<nbConstraints; i++) { for (i=0; i<nbConstraints; i++) {
@ -62,12 +62,14 @@ void LCPProjectedGaussSeidel::solve(const Matrix** const J_sp, const Matrix** co
// Clean // Clean
delete[] d; delete[] d;
delete[] a;
} }
// Compute the vector a used in the solve() method // Compute the vector a used in the solve() method
// Note that a = B * lambda // Note that a = B * lambda
void LCPProjectedGaussSeidel::computeVectorA(const Vector& lambda, uint nbConstraints, const Body*** const bodyMapping, void LCPProjectedGaussSeidel::computeVectorA(const Vector& lambda, uint nbConstraints, const Body*** const bodyMapping,
const Matrix** const B_sp, std::map<Body*, uint> bodyNumberMappingVector& a) { const Matrix** const B_sp, std::map<Body*, uint> bodyNumberMapping,
Vector* const a) {
uint i; uint i;
Body* indexBody1, indexBody2; Body* indexBody1, indexBody2;
@ -77,7 +79,8 @@ void LCPProjectedGaussSeidel::computeVectorA(const Vector& lambda, uint nbConstr
for(i=0; i<nbConstraints; i++) { for(i=0; i<nbConstraints; i++) {
indexBody1 = bodyNumberMapping[bodyMapping[i][0]]; indexBody1 = bodyNumberMapping[bodyMapping[i][0]];
indexBody2 = bodyNumberMapping[bodyMapping[i][1]]; indexBody2 = bodyNumberMapping[bodyMapping[i][1]];
// TODO : Implement this ... a[indexBody1] = a[indexBody1] + B_sp[0][i] * lambda(i);
a[indexBody2] = a[indexBody2] + B_sp[1][i] * lambda(i);
} }
} }