Skip to content

Commit

Permalink
Update btSoftBody to handle close to degenerate triangles.
Browse files Browse the repository at this point in the history
  • Loading branch information
crewmatt committed Aug 11, 2022
1 parent a1d9664 commit c7a67d5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/BulletSoftBody/btSoftBody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2816,6 +2816,16 @@ static void getBarycentric(const btVector3& p, btVector3& a, btVector3& b, btVec
btScalar d20 = v2.dot(v0);
btScalar d21 = v2.dot(v1);
btScalar denom = d00 * d11 - d01 * d01;
if (denom == btScalar(0.0))
{
bary.setY(btScalar(0.0));
bary.setZ(btScalar(0.0));
}
else
{
bary.setY((d11 * d20 - d01 * d21) / denom);
bary.setZ((d00 * d21 - d01 * d20) / denom);
}
bary.setY((d11 * d20 - d01 * d21) / denom);
bary.setZ((d00 * d21 - d01 * d20) / denom);
bary.setX(btScalar(1) - bary.getY() - bary.getZ());
Expand Down

0 comments on commit c7a67d5

Please sign in to comment.