16 #ifndef BT_LINEAR_ELASTICITY_H
17 #define BT_LINEAR_ELASTICITY_H
73 size_t id0 = node0->
index;
74 size_t id1 = node1->
index;
75 size_t id2 = node2->
index;
76 size_t id3 = node3->
index;
87 force[id0] -= scale1 * df_on_node0;
88 force[id1] -= scale1 * df_on_node123.getColumn(0);
89 force[id2] -= scale1 * df_on_node123.getColumn(1);
90 force[id3] -= scale1 * df_on_node123.getColumn(2);
133 dampingForce.
resize(sz+1);
134 for (
int i = 0; i < dampingForce.
size(); ++i)
135 dampingForce[i].setZero();
143 energy -= dampingForce[node.
index].dot(node.
m_v) / dt;
153 btScalar trace = epsilon[0][0] + epsilon[1][1] + epsilon[2][2];
154 density +=
m_mu * (epsilon[0].length2() + epsilon[1].length2() + epsilon[2].length2());
155 density +=
m_lambda * trace * trace * 0.5;
182 btScalar trPTP = (P[0].length2() + P[1].length2() + P[2].length2());
183 if (trPTP > max_p * max_p)
188 sigma[0] =
btMin(sigma[0], max_p);
189 sigma[1] =
btMin(sigma[1], max_p);
190 sigma[2] =
btMin(sigma[2], max_p);
191 sigma[0] =
btMax(sigma[0], -max_p);
192 sigma[1] =
btMax(sigma[1], -max_p);
193 sigma[2] =
btMax(sigma[2], -max_p);
196 Sigma[0][0] = sigma[0];
197 Sigma[1][1] = sigma[1];
198 Sigma[2][2] = sigma[2];
205 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
211 size_t id0 = node0->
index;
212 size_t id1 = node1->
index;
213 size_t id2 = node2->
index;
214 size_t id3 = node3->
index;
218 force[id0] -= scale1 * force_on_node0;
219 force[id1] -= scale1 * force_on_node123.
getColumn(0);
220 force[id2] -= scale1 * force_on_node123.
getColumn(1);
221 force[id3] -= scale1 * force_on_node123.
getColumn(2);
248 size_t id0 = node0->
index;
249 size_t id1 = node1->
index;
250 size_t id2 = node2->
index;
251 size_t id3 = node3->
index;
259 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
263 df[id0] -= scale1 * df_on_node0;
264 df[id1] -= scale1 * df_on_node123.
getColumn(0);
265 df[id2] -= scale1 * df_on_node123.
getColumn(1);
266 df[id3] -= scale1 * df_on_node123.
getColumn(2);
290 size_t id0 = node0->
index;
291 size_t id1 = node1->
index;
292 size_t id2 = node2->
index;
293 size_t id3 = node3->
index;
299 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
303 df[id0] -= scale1 * df_on_node0;
304 df[id1] -= scale1 * df_on_node123.
getColumn(0);
305 df[id2] -= scale1 * df_on_node123.
getColumn(1);
306 df[id3] -= scale1 * df_on_node123.
getColumn(2);
314 btScalar trace = epsilon[0][0] + epsilon[1][1] + epsilon[2][2];
322 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
330 btScalar trace = (dF[0][0] + dF[1][1] + dF[2][2]);
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...
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.
btScalar m_element_measure