re-compute all the modes using the new python preprocessor. clean up initialization

This commit is contained in:
jingyuc
2021-11-16 17:23:19 -05:00
parent 676221fb3e
commit 18f81dcaea
14 changed files with 4 additions and 16 deletions

View File

@@ -136,7 +136,7 @@ void ModeVisualizer::initPhysics()
// create volumetric soft body
{
btReducedSoftBody* rsb = btReducedSoftBodyHelpers::createReducedBeam(getDeformableDynamicsWorld()->getWorldInfo(), start_mode, num_modes);
btReducedSoftBody* rsb = btReducedSoftBodyHelpers::createReducedCube(getDeformableDynamicsWorld()->getWorldInfo(), start_mode, num_modes);
getDeformableDynamicsWorld()->addSoftBody(rsb);
rsb->getCollisionShape()->setMargin(0.1);

Binary file not shown.

Binary file not shown.

View File

@@ -75,18 +75,10 @@ void btReducedSoftBody::setMassProps(const tDenseArray& mass_array)
m_inverseMass = total_mass > 0 ? 1.0 / total_mass : 0;
}
void btReducedSoftBody::setInertiaProps(const btVector3& inertia)
void btReducedSoftBody::setInertiaProps()
{
// TODO: only support box shape now
// set local inertia
// m_invInertiaLocal.setValue(
// inertia.x() != btScalar(0.0) ? btScalar(1.0) / inertia.x() : btScalar(0.0),
// inertia.y() != btScalar(0.0) ? btScalar(1.0) / inertia.y() : btScalar(0.0),
// inertia.z() != btScalar(0.0) ? btScalar(1.0) / inertia.z() : btScalar(0.0));
updateLocalInertiaTensorFromNodes();
// update world inertia tensor
btMatrix3x3 rotation;
rotation.setIdentity();

View File

@@ -110,7 +110,7 @@ class btReducedSoftBody : public btSoftBody
void setMassProps(const tDenseArray& mass_array);
void setInertiaProps(const btVector3& inertia);
void setInertiaProps();
void setRigidVelocity(const btVector3& v);

View File

@@ -173,11 +173,7 @@ void btReducedSoftBodyHelpers::readReducedDeformableInfoFromFiles(btReducedSoftB
rsb->setMassProps(mass_array);
// calculate the inertia tensor in the local frame
btVector3 inertia(0, 0, 0);
calculateLocalInertia(inertia, rsb->getTotalMass(), half_extents, btVector3(0, 0, 0));
// calculateLocalInertia(inertia, rsb->getTotalMass(), btVector3(0.5, 0.25, 2), btVector3(0, 0, 0));
// calculateLocalInertia(inertia, rsb->getTotalMass(), btVector3(0.5, 0.5, 0.5), btVector3(0, 0, 0));
rsb->setInertiaProps(inertia);
rsb->setInertiaProps();
// other internal initialization
rsb->internalInitialization();