16#ifndef BT_LINEAR_ELASTICITY_H
17#define BT_LINEAR_ELASTICITY_H
22#define TETRA_FLAT_THRESHOLD 0.01
117 size_t id0 = node0->
index;
118 size_t id1 = node1->
index;
119 size_t id2 = node2->
index;
120 size_t id3 = node3->
index;
128 btMatrix3x3 dP = (dF + dF.
transpose()) * mu_damp + I * ((dF[0][0] + dF[1][1] + dF[2][2]) * lambda_damp);
134 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
137 force[id0] -= scale1 * df_on_node0;
138 force[id1] -= scale1 * df_on_node123.
getColumn(0);
139 force[id2] -= scale1 * df_on_node123.
getColumn(1);
140 force[id3] -= scale1 * df_on_node123.
getColumn(2);
145 size_t id = node.
index;
192 dampingForce.
resize(sz + 1);
193 for (
int i = 0; i < dampingForce.
size(); ++i)
194 dampingForce[i].setZero();
202 energy -= dampingForce[node.
index].dot(node.
m_v) / dt;
212 btScalar trace = epsilon[0][0] + epsilon[1][1] + epsilon[2][2];
213 density +=
m_mu * (epsilon[0].length2() + epsilon[1].length2() + epsilon[2].length2());
214 density +=
m_lambda * trace * trace * 0.5;
241 btScalar trPTP = (P[0].length2() + P[1].length2() + P[2].length2());
242 if (trPTP > max_p * max_p)
247 sigma[0] =
btMin(sigma[0], max_p);
248 sigma[1] =
btMin(sigma[1], max_p);
249 sigma[2] =
btMin(sigma[2], max_p);
250 sigma[0] =
btMax(sigma[0], -max_p);
251 sigma[1] =
btMax(sigma[1], -max_p);
252 sigma[2] =
btMax(sigma[2], -max_p);
255 Sigma[0][0] = sigma[0];
256 Sigma[1][1] = sigma[1];
257 Sigma[2][2] = sigma[2];
264 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
270 size_t id0 = node0->
index;
271 size_t id1 = node1->
index;
272 size_t id2 = node2->
index;
273 size_t id3 = node3->
index;
277 force[id0] -= scale1 * force_on_node0;
278 force[id1] -= scale1 * force_on_node123.
getColumn(0);
279 force[id2] -= scale1 * force_on_node123.
getColumn(1);
280 force[id3] -= scale1 * force_on_node123.
getColumn(2);
312 size_t id0 = node0->
index;
313 size_t id1 = node1->
index;
314 size_t id2 = node2->
index;
315 size_t id3 = node3->
index;
323 btMatrix3x3 dP = (dF + dF.
transpose()) * mu_damp + I * ((dF[0][0] + dF[1][1] + dF[2][2]) * lambda_damp);
329 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
333 df[id0] -= scale1 * df_on_node0;
334 df[id1] -= scale1 * df_on_node123.
getColumn(0);
335 df[id2] -= scale1 * df_on_node123.
getColumn(1);
336 df[id3] -= scale1 * df_on_node123.
getColumn(2);
341 size_t id = node.
index;
369 size_t id0 = node0->
index;
370 size_t id1 = node1->
index;
371 size_t id2 = node2->
index;
372 size_t id3 = node3->
index;
378 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
382 df[id0] -= scale1 * df_on_node0;
383 df[id1] -= scale1 * df_on_node123.
getColumn(0);
384 df[id2] -= scale1 * df_on_node123.
getColumn(1);
385 df[id3] -= scale1 * df_on_node123.
getColumn(2);
395 btScalar trace = epsilon[0][0] + epsilon[1][1] + epsilon[2][2];
403 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
413 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
433 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
void singularValueDecomposition(const btMatrix2x2 &A, GivensRotation &U, const btMatrix2x2 &Sigma, GivensRotation &V, const btScalar tol=64 *std::numeric_limits< btScalar >::epsilon())
2x2 SVD (singular value decomposition) A=USV'
const T & btMax(const T &a, const T &b)
const T & btMin(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
static btMatrix3x3 OuterProduct(const btScalar *v1, const btScalar *v2, const btScalar *v3, const btScalar *u1, const btScalar *u2, const btScalar *u3, int ndof)
int size() const
return the number of elements in the array
void resize(int newsize, const T &fillData=T())
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 transpose() const
Return the transpose of the matrix.
static const btMatrix3x3 & getIdentity()
void setIdentity()
Set the matrix to the identity.
btVector3 getColumn(int i) const
Get a column of the matrix as a vector.
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
btAlignedObjectArray< TetraScratch > m_tetraScratches
btVector3 can be used to represent 3D points and vectors.
btMatrix3x3 m_effectiveMass
btScalar m_element_measure