mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-13 13:20:07 +00:00
no need to save the reduced mass matrix because it's always diagonal
This commit is contained in:
parent
18f81dcaea
commit
2d08d4047a
@ -263,10 +263,10 @@ void btReducedSoftBody::updateReducedVelocity(btScalar solverdt)
|
|||||||
// update reduced velocity
|
// update reduced velocity
|
||||||
for (int r = 0; r < m_nReduced; ++r)
|
for (int r = 0; r < m_nReduced; ++r)
|
||||||
{
|
{
|
||||||
btScalar mass_inv = (m_Mr[r] == 0) ? 0 : 1.0 / m_Mr[r]; // TODO: this might be redundant, because Mr is identity
|
// the reduced mass is always identity!
|
||||||
btScalar delta_v = 0;
|
btScalar delta_v = 0;
|
||||||
delta_v = solverdt * mass_inv * (m_reducedForceElastic[r] + m_reducedForceDamping[r]);
|
delta_v = solverdt * (m_reducedForceElastic[r] + m_reducedForceDamping[r]);
|
||||||
// delta_v = solverdt * mass_inv * (m_reducedForceElastic[r] + m_reducedForceDamping[r] + m_reducedForceExternal[r]);
|
// delta_v = solverdt * (m_reducedForceElastic[r] + m_reducedForceDamping[r] + m_reducedForceExternal[r]);
|
||||||
m_reducedVelocity[r] = m_reducedVelocityBuffer[r] + delta_v;
|
m_reducedVelocity[r] = m_reducedVelocityBuffer[r] + delta_v;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -669,8 +669,8 @@ void btReducedSoftBody::internalApplyFullSpaceImpulse(const btVector3& impulse,
|
|||||||
// delta reduced velocity
|
// delta reduced velocity
|
||||||
for (int r = 0; r < m_nReduced; ++r)
|
for (int r = 0; r < m_nReduced; ++r)
|
||||||
{
|
{
|
||||||
btScalar mass_inv = (m_Mr[r] == 0) ? 0 : 1.0 / m_Mr[r]; // TODO: this might be redundant, because Mr is identity
|
// The reduced mass is always identity!
|
||||||
m_internalDeltaReducedVelocity[r] += dt * mass_inv * (m_reducedForceDamping[r] + m_reducedForceExternal[r]);
|
m_internalDeltaReducedVelocity[r] += dt * (m_reducedForceDamping[r] + m_reducedForceExternal[r]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@ class btReducedSoftBody : public btSoftBody
|
|||||||
tDenseArray m_reducedForceDamping; // reduced internal damping force
|
tDenseArray m_reducedForceDamping; // reduced internal damping force
|
||||||
tDenseArray m_eigenvalues; // eigenvalues of the reduce deformable model
|
tDenseArray m_eigenvalues; // eigenvalues of the reduce deformable model
|
||||||
tDenseArray m_Kr; // reduced stiffness matrix
|
tDenseArray m_Kr; // reduced stiffness matrix
|
||||||
tDenseArray m_Mr; // reduced mass matrix //TODO: do we need this?
|
|
||||||
|
|
||||||
// full space
|
// full space
|
||||||
TVStack m_x0; // Rest position
|
TVStack m_x0; // Rest position
|
||||||
|
@ -160,8 +160,8 @@ void btReducedSoftBodyHelpers::readReducedDeformableInfoFromFiles(btReducedSoftB
|
|||||||
std::string Kr_file = std::string(file_path) + "K_r_diag_mat.bin";
|
std::string Kr_file = std::string(file_path) + "K_r_diag_mat.bin";
|
||||||
btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Kr, rsb->m_nReduced, Kr_file.c_str());
|
btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Kr, rsb->m_nReduced, Kr_file.c_str());
|
||||||
|
|
||||||
std::string Mr_file = std::string(file_path) + "M_r_diag_mat.bin";
|
// std::string Mr_file = std::string(file_path) + "M_r_diag_mat.bin";
|
||||||
btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Mr, rsb->m_nReduced, Mr_file.c_str());
|
// btReducedSoftBodyHelpers::readBinaryVec(rsb->m_Mr, rsb->m_nReduced, Mr_file.c_str());
|
||||||
|
|
||||||
std::string modes_file = std::string(file_path) + "modes.bin";
|
std::string modes_file = std::string(file_path) + "modes.bin";
|
||||||
btReducedSoftBodyHelpers::readBinaryMat(rsb->m_modes, rsb->m_nReduced, 3 * rsb->m_nFull, modes_file.c_str());
|
btReducedSoftBodyHelpers::readBinaryMat(rsb->m_modes, rsb->m_nReduced, 3 * rsb->m_nFull, modes_file.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user