21 : m_softBodies(softBodies), m_projection(softBodies), m_backupVelocity(backup_v), m_implicit(false)
45 for (
int i = 0; i <
m_lf.
size(); ++i)
47 m_lf[i]->reinitialize(nodeUpdated);
57 psb->
m_nodes[j].m_effectiveMass = I * (1.0 / psb->
m_nodes[j].m_im);
85 for (
int i = 0; i <
m_lf.
size(); ++i)
88 m_lf[i]->addScaledDampingForceDifferential(-
m_dt, x, b);
92 m_lf[i]->addScaledElasticForceDifferential(-
m_dt *
m_dt, x, b);
96 for (
int i = offset; i < b.
size(); ++i)
154 psb->
m_nodes[j].m_v += psb->
m_nodes[j].m_effectiveMass_inv * force[counter++];
163 psb->
m_nodes[j].m_v += one_over_mass * force[counter++];
169 for (
int i = 0; i < force.
size(); ++i)
178 for (
int i = 0; i <
m_lf.
size(); ++i)
183 m_lf[i]->addScaledForces(dt, residual);
187 m_lf[i]->addScaledDampingForce(dt, residual);
196 for (
int i = 0; i < residual.
size(); ++i)
198 mag += residual[i].length2();
200 return std::sqrt(mag);
206 for (
int i = 0; i <
m_lf.
size(); ++i)
208 e +=
m_lf[i]->totalEnergy(dt);
223 for (
int i = 0; i <
m_lf.
size(); ++i)
231 m_lf[i]->addScaledForces(
m_dt, force);
234 for (
int i = 0; i <
m_lf.
size(); ++i)
253 for (
int i = 0; i <
m_lf.
size(); ++i)
255 m_lf[i]->addScaledExplicitForce(
m_dt, force);
268 psb->
m_nodes[j].m_effectiveMass_inv = psb->
m_nodes[j].m_effectiveMass.inverse();
284 dv[counter] = psb->
m_nodes[j].m_im * residual[counter];
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
int size() const
return the number of elements in the array
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
void setIdentity()
Set the matrix to the identity.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
btVector3 can be used to represent 3D points and vectors.