16 #ifndef BT_NEOHOOKEAN_H
17 #define BT_NEOHOOKEAN_H
108 if (!psb->isActive())
119 size_t id0 = node0->
index;
120 size_t id1 = node1->
index;
121 size_t id2 = node2->
index;
122 size_t id3 = node3->
index;
133 force[id0] -= scale1 * df_on_node0;
134 force[id1] -= scale1 * df_on_node123.getColumn(0);
135 force[id2] -= scale1 * df_on_node123.getColumn(1);
136 force[id3] -= scale1 * df_on_node123.getColumn(2);
147 if (!psb->isActive())
169 if (!psb->isActive())
179 dampingForce.
resize(sz + 1);
180 for (
int i = 0; i < dampingForce.
size(); ++i)
189 energy -= dampingForce[
node.index].dot(
node.m_v) / dt;
212 if (!psb->isActive())
227 btScalar trPTP = (
P[0].length2() +
P[1].length2() +
P[2].length2());
228 if (trPTP > max_p * max_p)
233 sigma[0] =
btMin(sigma[0], max_p);
234 sigma[1] =
btMin(sigma[1], max_p);
235 sigma[2] =
btMin(sigma[2], max_p);
236 sigma[0] =
btMax(sigma[0], -max_p);
237 sigma[1] =
btMax(sigma[1], -max_p);
238 sigma[2] =
btMax(sigma[2], -max_p);
241 Sigma[0][0] = sigma[0];
242 Sigma[1][1] = sigma[1];
243 Sigma[2][2] = sigma[2];
244 P =
U * Sigma *
V.transpose();
250 btVector3 force_on_node0 = force_on_node123 * grad_N_hat_1st_col;
256 size_t id0 = node0->
index;
257 size_t id1 = node1->
index;
258 size_t id2 = node2->
index;
259 size_t id3 = node3->
index;
263 force[id0] -= scale1 * force_on_node0;
264 force[id1] -= scale1 * force_on_node123.getColumn(0);
265 force[id2] -= scale1 * force_on_node123.getColumn(1);
266 force[id3] -= scale1 * force_on_node123.getColumn(2);
282 if (!psb->isActive())
293 size_t id0 = node0->
index;
294 size_t id1 = node1->
index;
295 size_t id2 = node2->
index;
296 size_t id3 = node3->
index;
304 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
308 df[id0] -= scale1 * df_on_node0;
309 df[id1] -= scale1 * df_on_node123.getColumn(0);
310 df[id2] -= scale1 * df_on_node123.getColumn(1);
311 df[id3] -= scale1 * df_on_node123.getColumn(2);
326 if (!psb->isActive())
337 size_t id0 = node0->
index;
338 size_t id1 = node1->
index;
339 size_t id2 = node2->
index;
340 size_t id3 = node3->
index;
346 btVector3 df_on_node0 = df_on_node123 * grad_N_hat_1st_col;
350 df[id0] -= scale1 * df_on_node0;
351 df[id1] -= scale1 * df_on_node123.getColumn(0);
352 df[id2] -= scale1 * df_on_node123.getColumn(1);
353 df[id3] -= scale1 * df_on_node123.getColumn(2);
372 dP = dF * c1 + s.
m_F * c2;
384 dP = dF * c1 + s.
m_F * c2;
392 for (
int i = 0; i < 3; ++i)
394 ans +=
A[i].dot(
B[i]);
404 M[0][0] += scale * (dF[1][1] *
F[2][2] +
F[1][1] * dF[2][2] - dF[2][1] *
F[1][2] -
F[2][1] * dF[1][2]);
405 M[1][0] += scale * (dF[2][1] *
F[0][2] +
F[2][1] * dF[0][2] - dF[0][1] *
F[2][2] -
F[0][1] * dF[2][2]);
406 M[2][0] += scale * (dF[0][1] *
F[1][2] +
F[0][1] * dF[1][2] - dF[1][1] *
F[0][2] -
F[1][1] * dF[0][2]);
407 M[0][1] += scale * (dF[2][0] *
F[1][2] +
F[2][0] * dF[1][2] - dF[1][0] *
F[2][2] -
F[1][0] * dF[2][2]);
408 M[1][1] += scale * (dF[0][0] *
F[2][2] +
F[0][0] * dF[2][2] - dF[2][0] *
F[0][2] -
F[2][0] * dF[0][2]);
409 M[2][1] += scale * (dF[1][0] *
F[0][2] +
F[1][0] * dF[0][2] - dF[0][0] *
F[1][2] -
F[0][0] * dF[1][2]);
410 M[0][2] += scale * (dF[1][0] *
F[2][1] +
F[1][0] * dF[2][1] - dF[2][0] *
F[1][1] -
F[2][0] * dF[1][1]);
411 M[1][2] += scale * (dF[2][0] *
F[0][1] +
F[2][0] * dF[0][1] - dF[0][0] *
F[2][1] -
F[0][0] * dF[2][1]);
412 M[2][2] += scale * (dF[0][0] *
F[1][1] +
F[0][0] * dF[1][1] - dF[1][0] *
F[0][1] -
F[1][0] * dF[0][1]);
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'
void setZero()
Set the matrix to the identity.
btMatrix3x3
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
SIMD_FORCE_INLINE const T & btMin(const T &a, const T &b)
SIMD_FORCE_INLINE const T & btMax(const T &a, const T &b)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btVector3
btVector3 can be used to represent 3D points and vectors. It has an un-used w component to suit 16-by...
SIMD_FORCE_INLINE int size() const
return the number of elements in the array
SIMD_FORCE_INLINE void resize(int newsize, const T &fillData=T())
btAlignedObjectArray< TetraScratch > m_tetraScratches
ccl_device_inline float3 log(float3 v)
static const pxr::TfToken density("density", pxr::TfToken::Immortal)
btScalar m_element_measure
CCL_NAMESPACE_BEGIN struct Window V