factor out force; now btDeformableLagrangianceForce can be specified at configuration time and to specific softbody

This commit is contained in:
Xuchen Han
2019-07-25 13:51:44 -07:00
parent 233a381e7c
commit ec403f790d
18 changed files with 150 additions and 204 deletions

View File

@@ -28,6 +28,7 @@ public:
Preconditioner* m_preconditioner;
btDeformableContactProjection projection;
const TVStack& m_backupVelocity;
std::unordered_map<btSoftBody::Node *, size_t> m_indices;
btDeformableBackwardEulerObjective(btAlignedObjectArray<btSoftBody *>& softBodies, const TVStack& backup_v);
@@ -95,6 +96,24 @@ public:
m_world = world;
projection.setWorld(world);
}
virtual void updateId()
{
size_t index = 0;
for (int i = 0; i < m_softBodies.size(); ++i)
{
btSoftBody* psb = m_softBodies[i];
for (int j = 0; j < psb->m_nodes.size(); ++j)
{
m_indices[&(psb->m_nodes[j])] = index++;
}
}
}
std::unordered_map<btSoftBody::Node *, size_t>* getIndices()
{
return &m_indices;
}
};
#endif /* btBackwardEulerObjective_h */