Skip to content

Commit 1b06319

Browse files
committed
- bugix in XPBD FEM code
1 parent 00db2e0 commit 1b06319

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2.2.1
2+
- bugfix in XPBD FEM code
13
- updated GenericParameters
24
- fixed meshes
35

PositionBasedDynamics/XPBD.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -275,19 +275,20 @@ bool XPBD::solve_FEMTetraConstraint(
275275
invMass3 * gradU_[3].squaredNorm();
276276

277277
Real alpha = static_cast<Real>(1.0) / (youngsModulus * dt * dt);
278-
// Note that grad C = 1/C grad U'
278+
// Note that grad C = 1/C grad U', by multiplying C^2 to alpha, we now can add the factor C^2 to the nominator
279279
sum_normGradU_ += C * C * alpha;
280280

281281
if (sum_normGradU_ < eps)
282282
return false;
283283

284284
// compute scaling factor
285-
const Real s = (C * C + C * alpha * multiplier) / sum_normGradU_;
285+
const Real lambda = -C * (C + alpha * multiplier) / sum_normGradU_; // since in the next step we use gradU instead of gradC, we only add the factor C instead of C^2
286+
multiplier += lambda;
286287

287-
corr0 = -s * invMass0 * gradU_[0];
288-
corr1 = -s * invMass1 * gradU_[1];
289-
corr2 = -s * invMass2 * gradU_[2];
290-
corr3 = -s * invMass3 * gradU_[3];
288+
corr0 = lambda * invMass0 * gradU_[0];
289+
corr1 = lambda * invMass1 * gradU_[1];
290+
corr2 = lambda * invMass2 * gradU_[2];
291+
corr3 = lambda * invMass3 * gradU_[3];
291292

292293
return true;
293294
}

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.2.0
1+
2.2.1

0 commit comments

Comments
 (0)