Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
31 int N = leafNodes.
size();
43 for (
int i = 0; i < N; ++i)
47 for (
int i = 0; i < N; ++i)
52 for (
int j = 0; j < adj[i].size(); ++j)
55 if (!marked[adj[i][j]])
59 node->
childs[0] = leafNodes[i];
60 node->
childs[1] = leafNodes[n];
61 leafNodes[i]->parent = node;
62 leafNodes[n]->parent = node;
73 childIds.
push_back(std::make_pair(i, -1));
79 for (
int i = 0; i < newLeafNodes.
size(); ++i)
81 for (
int j = i + 1; j < newLeafNodes.
size(); ++j)
83 bool neighbor =
false;
85 for (
int k = 0; k < leftChildNeighbors.
size(); ++k)
87 if (leftChildNeighbors[k] == childIds[j].first || leftChildNeighbors[k] == childIds[j].second)
93 if (!neighbor && childIds[i].second != -1)
96 for (
int k = 0; k < rightChildNeighbors.
size(); ++k)
98 if (rightChildNeighbors[k] == childIds[j].first || rightChildNeighbors[k] == childIds[j].second)
112 leafNodes = newLeafNodes;
116 adj.resize(newAdj.
size());
117 for (
int i = 0; i < newAdj.
size(); i++)
119 for (
int j = 0; j < newAdj[i].
size(); j++)
121 adj[i].push_back(newAdj[i][j]);
124 N = leafNodes.
size();
131 : m_softBodySolver(0), m_worldInfo(worldInfo)
147 for (
int i = 0, ni = node_count; i < ni; ++i)
153 n.
m_im = m ? *m++ : 1;
165 : m_worldInfo(worldInfo)
261 const Node* n[] = {node0, node1};
265 if ((l.
m_n[0] == n[0] && l.
m_n[1] == n[1]) ||
266 (l.
m_n[0] == n[1] && l.
m_n[1] == n[0]))
284 for (
int j = 0; j < 3; ++j)
286 if ((f.
m_n[j] == n[0]) ||
287 (f.
m_n[j] == n[1]) ||
293 if (c == 7)
return (
true);
383 n.
m_im = m > 0 ? 1 / m : 0;
417 if ((!bcheckexist) || (!
checkLink(node0, node1)))
504 appendAnchor(node, body, local, disableCollisionBetweenLinkedBodies, influence);
510 if (disableCollisionBetweenLinkedBodies)
552 static const btMatrix3x3 iwiStatic(0, 0, 0, 0, 0, 0, 0, 0, 0);
714 const bool as_lift = kLF > 0;
715 const bool as_drag = kDG > 0;
716 const bool as_aero = as_lift || as_drag;
748 btScalar tri_area = 0.5f * n.m_area;
750 fDrag = 0.5f * kDG * medium.
m_density * rel_v2 * tri_area * n_dot_v * (-rel_v_nrm);
754 if (0 < n_dot_v && n_dot_v < 0.98480f)
755 fLift = 0.5f * kLF * medium.
m_density * rel_v_len * tri_area *
btSqrt(1.0f - n_dot_v * n_dot_v) * (nrm.
cross(rel_v_nrm).
cross(rel_v_nrm));
759 btScalar del_v_by_fDrag_len2 = del_v_by_fDrag.length2();
762 if (del_v_by_fDrag_len2 >= v_len2 && del_v_by_fDrag_len2 > 0)
764 btScalar del_v_by_fDrag_len = del_v_by_fDrag.length();
766 fDrag *=
btScalar(0.8) * (v_len / del_v_by_fDrag_len);
782 const btScalar c0 = n.m_area * dvn * rel_v2 / 2;
784 force += nrm * (-c1 * kLF);
801 const bool as_lift = kLF > 0;
802 const bool as_drag = kDG > 0;
803 const bool as_aero = as_lift || as_drag;
836 fDrag = 0.5f * kDG * medium.
m_density * rel_v2 * tri_area * n_dot_v * (-rel_v_nrm);
840 if (0 < n_dot_v && n_dot_v < 0.98480f)
841 fLift = 0.5f * kLF * medium.
m_density * rel_v_len * tri_area *
btSqrt(1.0f - n_dot_v * n_dot_v) * (nrm.
cross(rel_v_nrm).
cross(rel_v_nrm));
846 for (
int j = 0; j < 3; ++j)
855 if (del_v_by_fDrag_len2 >= v_len2 && del_v_by_fDrag_len2 > 0)
859 fDrag *=
btScalar(0.8) * (v_len / del_v_by_fDrag_len);
879 force += nrm * (-c1 * kLF);
922 m_nodes[node].m_im = mass > 0 ? 1 / mass : 0;
960 for (
int j = 0; j < 3; ++j)
999 for (
int j = 0; j < 4; ++j)
1022 for (
int j = 0; j < 4; ++j)
1037 total_momentum += mass *
m_nodes[i].m_v;
1040 return total_mass == 0 ? total_momentum : total_momentum / total_mass;
1195 if (
m_nodes[i].m_im <= 0) tmass += kmass;
1269 for (
int i = 0, ni = cluster->
m_nodes.size(); i < ni; ++i)
1273 return (com * cluster->
m_imass);
1294 cluster->
m_lv += li;
1296 cluster->
m_av += ai;
1322 cluster->
m_av += ai;
1362 const unsigned inf = (~(unsigned)0) >> 1;
1363 unsigned* adj =
new unsigned[n * n];
1365 #define IDX(_x_, _y_) ((_y_)*n + (_x_))
1366 for (j = 0; j < n; ++j)
1368 for (i = 0; i < n; ++i)
1372 adj[
IDX(i, j)] = adj[
IDX(j, i)] = inf;
1376 adj[
IDX(i, j)] = adj[
IDX(j, i)] = 0;
1384 adj[
IDX(ia, ib)] = 1;
1385 adj[
IDX(ib, ia)] = 1;
1406 for (
int ii = 0; ii < nodeLinks.
size(); ii++)
1410 for (
int jj = 0; jj < nodeLinks[ii].m_links.
size(); jj++)
1412 int k = nodeLinks[ii].m_links[jj];
1413 for (
int kk = 0; kk < nodeLinks[k].m_links.
size(); kk++)
1415 int j = nodeLinks[k].m_links[kk];
1418 const unsigned sum = adj[
IDX(i, k)] + adj[
IDX(k, j)];
1420 if (adj[
IDX(i, j)] >
sum)
1432 for (
int k = 0; k < n; ++k)
1434 for (j = 0; j < n; ++j)
1436 for (i = j + 1; i < n; ++i)
1438 const unsigned sum = adj[
IDX(i, k)] + adj[
IDX(k, j)];
1439 if (adj[
IDX(i, j)] >
sum)
1450 for (j = 0; j < n; ++j)
1452 for (i = j + 1; i < n; ++i)
1454 if (adj[
IDX(i, j)] == (
unsigned)distance)
1471 unsigned long seed = 243703;
1472 #define NEXTRAND (seed = (1664525L * seed + 1013904223L) & 0xffffffff)
1533 const btScalar w = 2 - btMin<btScalar>(1, iterations / slope);
1538 for (i = 0; i < k; ++i)
1548 c = centers[i] + (c - centers[i]) * w;
1549 changed |= ((c - centers[i]).length2() >
SIMD_EPSILON);
1559 for (
int j = 1; j < k; ++j)
1570 }
while (changed && (iterations < maxiterations));
1586 for (
int j = 0; j < 3; ++j)
1588 const int cid = cids[idx[j]];
1589 for (
int q = 1; q < 3; ++q)
1591 const int kid = idx[(j + q) % 3];
1592 if (cids[kid] != cid)
1634 for (
int j = 0; j < 4; j++)
1651 for (
int j = 0; j < 3; ++j)
1672 bool connected =
false;
1675 for (
int i = 0; !connected && i < cla->
m_nodes.size(); i++)
1677 for (
int j = 0; j < clb->
m_nodes.size(); j++)
1722 edges(
int(l.
m_n[0] - nbase),
int(l.
m_n[1] - nbase)) = -1;
1727 edges(
int(f.
m_n[0] - nbase),
int(f.
m_n[1] - nbase)) = -1;
1728 edges(
int(f.
m_n[1] - nbase),
int(f.
m_n[2] - nbase)) = -1;
1729 edges(
int(f.
m_n[2] - nbase),
int(f.
m_n[0] - nbase)) = -1;
1732 for (i = 0; i < ncount; ++i)
1734 for (j = i + 1; j < ncount; ++j)
1736 if (edges(i, j) == -1)
1753 const btScalar f = (ma + mb) / (ma + mb + mc);
1754 a.
m_im = 1 / (ma * f);
1755 b.
m_im = 1 / (mb * f);
1787 const int idx[] = {int(feat.
m_n[0] - nbase),
1788 int(feat.
m_n[1] - nbase)};
1789 if ((idx[0] < ncount) && (idx[1] < ncount))
1791 const int ni = edges(idx[0], idx[1]);
1808 const int idx[] = {int(feat.
m_n[0] - nbase),
1809 int(feat.
m_n[1] - nbase),
1810 int(feat.
m_n[2] - nbase)};
1811 for (j = 2, k = 0; k < 3; j = k++)
1813 if ((idx[j] < ncount) && (idx[k] < ncount))
1815 const int ni = edges(idx[j], idx[k]);
1819 const int l = (k + 1) % 3;
1839 const int pcount = ncount;
1842 cnodes.
resize(ncount, 0);
1844 for (i = 0; i < ncount; ++i)
1847 if ((i >= pcount) || (
btFabs(ifn->
Eval(x)) < accurary))
1865 const int id[] = {int(
m_links[i].m_n[0] - nbase),
1866 int(
m_links[i].m_n[1] - nbase)};
1868 if (cnodes[
id[0]] && cnodes[
id[1]])
1875 if (((ifn->
Eval(
m_nodes[
id[0]].m_x) < accurary) &&
1882 for (
int j = 0; j < 2; ++j)
1884 int cn = cnodes[int(l.
m_n[j] - nbase)];
1893 if ((ifn->
Eval(n[0]->
m_x) < accurary) &&
1894 (ifn->
Eval(n[1]->
m_x) < accurary) &&
1895 (ifn->
Eval(n[2]->
m_x) < accurary))
1897 for (
int j = 0; j < 3; ++j)
1899 int cn = cnodes[int(n[j] - nbase)];
1911 for (
int j = 0; j < 2; ++j) ranks[
int(
m_links[i].m_n[j] - nbase)]++;
1915 for (
int j = 0; j < 3; ++j) ranks[
int(
m_faces[i].m_n[j] - nbase)]++;
1919 const int id[] = {int(
m_links[i].m_n[0] - nbase),
1920 int(
m_links[i].m_n[1] - nbase)};
1921 const bool sg[] = {ranks[
id[0]] == 1,
1933 for(i=nnodes-1;i>=0;--i)
1940 for(
int i=0;i<nnodes;++i) map[i]=i;
1941 PointersToIndices(
this);
1942 for(
int i=0,ni=todelete.
size();i<ni;++i)
1946 int& b=map[--nnodes];
1951 IndicesToPointers(
this,&map[0]);
1989 pft[0]->
m_n[1] = pn[mtch];
1990 pft[1]->
m_n[0] = pn[1 - mtch];
1996 for (
int k = 2, l = 0; l < 3; k = l++)
2003 pft[0]->
m_n[l] = pn[mtch];
2004 pft[1]->
m_n[k] = pn[1 - mtch];
2005 appendLink(pn[0], pft[0]->m_n[(l + 1) % 3], pft[0]->m_material,
true);
2006 appendLink(pn[1], pft[0]->m_n[(l + 1) % 3], pft[0]->m_material,
true);
2028 results.
body =
this;
2048 results.
body =
this;
2115 for (
int c = 0; c < 3; c++)
2117 if (deltaV[c] > clampDeltaV)
2119 deltaV[c] = clampDeltaV;
2121 if (deltaV[c] < -clampDeltaV)
2123 deltaV[c] = -clampDeltaV;
2285 for (
int isolve = 0; isolve < iterations; ++isolve)
2303 const int nb = bodies.
size();
2307 for (i = 0; i < nb; ++i)
2311 for (i = 0; i < nb; ++i)
2313 bodies[i]->prepareClusters(iterations);
2315 for (i = 0; i < iterations; ++i)
2318 for (
int j = 0; j < nb; ++j)
2320 bodies[j]->solveClusters(sor);
2323 for (i = 0; i < nb; ++i)
2325 bodies[i]->cleanupClusters();
2351 const btScalar t = rayFromToTriangle(m_rayFrom, m_rayTo, m_rayNormalizedDirection,
2356 if ((t > 0) && (t < m_mint))
2367 const btVector3& rayNormalizedDirection,
2383 if ((t > teps) && (t < maxt))
2385 const btVector3 hit = rayFrom + rayNormalizedDirection * t;
2400 #define PTR2IDX(_p_, _b_) reinterpret_cast<btSoftBody::Node*>((_p_) - (_b_))
2408 m_nodes[i].m_leaf->data = *(
void**)&i;
2423 m_faces[i].m_leaf->data = *(
void**)&i;
2432 for (
int j = 0; j <
m_notes[i].m_rank; ++j)
2443 #define IDX2PTR(_p_, _b_) map ? (&(_b_)[map[(((char*)_p_) - (char*)0)]]) : (&(_b_)[(((char*)_p_) - (char*)0)])
2475 for (
int j = 0; j <
m_notes[i].m_rank; ++j)
2531 int tetfaces[4][3] = {{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
2532 for (
int f = 0; f < 4; f++)
2534 int index0 = tetfaces[f][0];
2535 int index1 = tetfaces[f][1];
2536 int index2 = tetfaces[f][2];
2619 root->
normal = (n0 + n1).safeNormalize();
2626 BT_PROFILE(
"btSoftBody::initializeFaceTree");
2641 leafNodes[i] = node;
2647 for (
int i = 0; i < adj.
size(); ++i)
2649 for (
int j = i + 1; j < adj.
size(); ++j)
2652 for (
int k = 0; k < 3; ++k)
2654 for (
int l = 0; l < 3; ++l)
2694 leafNodes[i] = node;
2794 btVector3 v0 = b - a, v1 = c - a, v2 = p - a;
2800 btScalar denom = d00 * d11 - d01 * d01;
2801 bary.
setY((d11 * d20 - d01 * d21) / denom);
2802 bary.
setZ((d00 * d21 - d01 * d20) / denom);
2827 #ifdef USE_QUADRATURE
2843 if (local_dst < dst)
2845 if (local_dst < 0 && predict)
2880 for (
int i = 0; i < 3; ++i)
2909 for (
int i = 0; i < 3; ++i)
2992 for (
int d = 0; d < 3; ++d)
2994 if (
m_nodes[i].m_x[d] > maxs[d])
2996 if (
m_nodes[i].m_x[d] < mins[d])
3033 Apq[0] = Apq[1] = Apq[2] =
btVector3(0, 0, 0);
3035 Apq[1].setY(
eps * 2);
3036 Apq[2].setZ(
eps * 3);
3041 Apq[0] += a.
x() * b;
3042 Apq[1] += a.
y() * b;
3043 Apq[2] += a.
z() * b;
3083 for (
int j = 0; j < 3; ++j)
3085 const int index = (int)(f.
m_n[j] - &
m_nodes[0]);
3110 for (
int j = 0; j < 3; ++j)
3118 m_nodes[i].m_area *= 0.3333333f;
3153 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3173 ii[0] = ii[1] = ii[2] =
btVector3(0, 0, 0);
3177 for (i = 0, ni = c.
m_nodes.size(); i < ni; ++i)
3182 ii[0][0] += m * (q[1] + q[2]);
3183 ii[1][1] += m * (q[0] + q[2]);
3184 ii[2][2] += m * (q[0] + q[1]);
3185 ii[0][1] -= m * k[0] * k[1];
3186 ii[0][2] -= m * k[0] * k[2];
3187 ii[1][2] -= m * k[1] * k[2];
3190 ii[1][0] = ii[0][1];
3191 ii[2][0] = ii[0][2];
3192 ii[2][1] = ii[1][2];
3219 const int n = c.
m_nodes.size();
3226 m[0] = m[1] = m[2] =
btVector3(0, 0, 0);
3231 for (
int i = 0; i < c.
m_nodes.size(); ++i)
3253 c.
m_invwi=c.m_xform.getBasis().scaled(iin)*c.m_xform.getBasis().transpose();
3256 for (
int i = 0; i < n; ++i)
3261 c.
m_invwi[0][0] += m * (q[1] + q[2]);
3262 c.
m_invwi[1][1] += m * (q[0] + q[2]);
3263 c.
m_invwi[2][2] += m * (q[0] + q[1]);
3264 c.
m_invwi[0][1] -= m * k[0] * k[1];
3265 c.
m_invwi[0][2] -= m * k[0] * k[2];
3266 c.
m_invwi[1][2] -= m * k[1] * k[2];
3280 for (i = 0; i < n; ++i)
3298 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3310 for (
int j = 1; j < n; ++j)
3390 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3400 for (i = 0; i < deltas.
size(); ++i)
3404 m_nodes[i].m_x += deltas[i] / weights[i];
3419 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3439 m_links[i].Feature::m_material->m_kLST = k;
3456 btScalar unit_simplex_measure = 1. / 6.;
3476 btScalar det = 1 / (a[0] * b[1] * c[2] - a[0] * b[1] * d[2] - a[0] * b[2] * c[1] + a[0] * b[2] * d[1] + a[0] * c[1] * d[2] - a[0] * c[2] * d[1] + a[1] * (-b[0] * c[2] + b[0] * d[2] + b[2] * c[0] - b[2] * d[0] - c[0] * d[2] + c[2] * d[0]) + a[2] * (b[0] * c[1] - b[0] * d[1] + b[1] * (d[0] - c[0]) + c[0] * d[1] - c[1] * d[0]) - b[0] * c[1] * d[2] + b[0] * c[2] * d[1] + b[1] * c[0] * d[2] - b[1] * c[2] * d[0] - b[2] * c[0] * d[1] + b[2] * c[1] * d[0]);
3478 btScalar P11 = -b[2] * c[1] + d[2] * c[1] + b[1] * c[2] + b[2] * d[1] - c[2] * d[1] - b[1] * d[2];
3479 btScalar P12 = b[2] * c[0] - d[2] * c[0] - b[0] * c[2] - b[2] * d[0] + c[2] * d[0] + b[0] * d[2];
3480 btScalar P13 = -b[1] * c[0] + d[1] * c[0] + b[0] * c[1] + b[1] * d[0] - c[1] * d[0] - b[0] * d[1];
3481 btScalar P21 = a[2] * c[1] - d[2] * c[1] - a[1] * c[2] - a[2] * d[1] + c[2] * d[1] + a[1] * d[2];
3482 btScalar P22 = -a[2] * c[0] + d[2] * c[0] + a[0] * c[2] + a[2] * d[0] - c[2] * d[0] - a[0] * d[2];
3483 btScalar P23 = a[1] * c[0] - d[1] * c[0] - a[0] * c[1] - a[1] * d[0] + c[1] * d[0] + a[0] * d[1];
3484 btScalar P31 = -a[2] * b[1] + d[2] * b[1] + a[1] * b[2] + a[2] * d[1] - b[2] * d[1] - a[1] * d[2];
3485 btScalar P32 = a[2] * b[0] - d[2] * b[0] - a[0] * b[2] - a[2] * d[0] + b[2] * d[0] + a[0] * d[2];
3486 btScalar P33 = -a[1] * b[0] + d[1] * b[0] + a[0] * b[1] + a[1] * d[0] - b[1] * d[0] - a[0] * d[1];
3487 btScalar P41 = a[2] * b[1] - c[2] * b[1] - a[1] * b[2] - a[2] * c[1] + b[2] * c[1] + a[1] * c[2];
3488 btScalar P42 = -a[2] * b[0] + c[2] * b[0] + a[0] * b[2] + a[2] * c[0] - b[2] * c[0] - a[0] * c[2];
3489 btScalar P43 = a[1] * b[0] - c[1] * b[0] - a[0] * b[1] - a[1] * c[0] + b[1] * c[0] + a[0] * c[1];
3491 btVector4 p1(P11 * det, P21 * det, P31 * det, P41 * det);
3492 btVector4 p2(P12 * det, P22 * det, P32 * det, P42 * det);
3493 btVector4 p3(P13 * det, P23 * det, P33 * det, P43 * det);
3503 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
3524 s.
m_trace = C[0].getX() + C[1].getY() + C[2].getZ();
3555 m_bodies[0].activate();
3556 m_bodies[1].activate();
3562 static const btScalar maxdrift = 4;
3564 m_rpos[0] = m_bodies[0].xform() * m_refs[0];
3565 m_rpos[1] = m_bodies[1].xform() * m_refs[1];
3566 m_drift =
Clamp(m_rpos[0] - m_rpos[1], maxdrift) * m_erp / dt;
3567 m_rpos[0] -= m_bodies[0].xform().getOrigin();
3568 m_rpos[1] -= m_bodies[1].xform().getOrigin();
3569 m_massmatrix =
ImpulseMatrix(m_bodies[0].invMass(), m_bodies[0].invWorldInertia(), m_rpos[0],
3570 m_bodies[1].invMass(), m_bodies[1].invWorldInertia(), m_rpos[1]);
3573 m_sdrift = m_massmatrix * (m_drift * m_split);
3574 m_drift *= 1 - m_split;
3582 const btVector3 va = m_bodies[0].velocity(m_rpos[0]);
3583 const btVector3 vb = m_bodies[1].velocity(m_rpos[1]);
3587 impulse.
m_velocity = m_massmatrix * (m_drift + vr * m_cfm) * sor;
3588 m_bodies[0].applyImpulse(-impulse, m_rpos[0]);
3589 m_bodies[1].applyImpulse(impulse, m_rpos[1]);
3597 m_bodies[0].applyDImpulse(-m_sdrift, m_rpos[0]);
3598 m_bodies[1].applyDImpulse(m_sdrift, m_rpos[1]);
3606 m_icontrol->Prepare(
this);
3608 m_axis[0] = m_bodies[0].xform().getBasis() * m_refs[0];
3609 m_axis[1] = m_bodies[1].xform().getBasis() * m_refs[1];
3611 m_drift *=
btMin(maxdrift,
btAcos(Clamp<btScalar>(
btDot(m_axis[0], m_axis[1]), -1, +1)));
3612 m_drift *= m_erp / dt;
3613 m_massmatrix =
AngularImpulseMatrix(m_bodies[0].invWorldInertia(), m_bodies[1].invWorldInertia());
3616 m_sdrift = m_massmatrix * (m_drift * m_split);
3617 m_drift *= 1 - m_split;
3625 const btVector3 va = m_bodies[0].angularVelocity();
3626 const btVector3 vb = m_bodies[1].angularVelocity();
3629 const btVector3 vc = vr - m_axis[0] * m_icontrol->Speed(
this, sp);
3632 impulse.
m_velocity = m_massmatrix * (m_drift + vc * m_cfm) * sor;
3633 m_bodies[0].applyAImpulse(-impulse);
3634 m_bodies[1].applyAImpulse(impulse);
3642 m_bodies[0].applyDAImpulse(-m_sdrift);
3643 m_bodies[1].applyDAImpulse(m_sdrift);
3651 const bool dodrift = (m_life == 0);
3652 m_delete = (++m_life) > m_maxlife;
3655 m_drift = m_drift * m_erp / dt;
3658 m_sdrift = m_massmatrix * (m_drift * m_split);
3659 m_drift *= 1 - m_split;
3665 m_drift = m_sdrift =
btVector3(0, 0, 0);
3672 const btVector3 va = m_bodies[0].velocity(m_rpos[0]);
3673 const btVector3 vb = m_bodies[1].velocity(m_rpos[1]);
3687 if (m_bodies[0].m_soft == m_bodies[1].m_soft)
3694 if (impulse.
m_velocity.
length() < m_bodies[0].m_soft->m_maxSelfCollisionImpulse)
3699 m_bodies[0].applyImpulse(-impulse * m_bodies[0].m_soft->m_selfCollisionImpulseFactor, m_rpos[0]);
3700 m_bodies[1].applyImpulse(impulse * m_bodies[0].m_soft->m_selfCollisionImpulseFactor, m_rpos[1]);
3707 m_bodies[0].applyImpulse(-impulse, m_rpos[0]);
3708 m_bodies[1].applyImpulse(impulse, m_rpos[1]);
3717 m_bodies[0].applyDImpulse(-m_sdrift, m_rpos[0]);
3718 m_bodies[1].applyDImpulse(m_sdrift, m_rpos[1]);
3731 const bool as_lift = kLF > 0;
3732 const bool as_drag = kDG > 0;
3733 const bool as_pressure = kPR != 0;
3734 const bool as_volume = kVC > 0;
3735 const bool as_aero = as_lift ||
3741 const bool use_medium = as_aero;
3742 const bool use_volume = as_pressure ||
3751 ivolumetp = 1 /
btFabs(volume) * kPR;
3810 for (
int j = 0; j < 3; ++j)
3814 n.
m_x +=
m_z[i] * unit_normal;
3823 for (
int j = 0; j < 4; ++j)
3836 for (
int i = 0; i <= N; ++i)
3838 for (
int j = 0; i + j <= N; ++j)
3892 if (multibodyLinkCol)
3904 for (
int j = 0; j < ndof; ++j)
3930 if (multibodyLinkCol)
3932 double multiplier = 0.5;
3980 for (
int i = 0, ni = psb->
m_links.
size(); i < ni; ++i)
4003 for (
int i = 0, ni = psb->
m_links.
size(); i < ni; ++i)
4079 volume.Expand(
btVector3(basemargin, basemargin, basemargin));
4080 docollide.
psb =
this;
4084 docollide.
dynmargin = basemargin + timemargin;
4111 volume.Expand(
btVector3(basemargin, basemargin, basemargin));
4115 docollideNode.
psb =
this;
4118 docollideNode.
dynmargin = basemargin + timemargin;
4126 docollideFace.
psb =
this;
4129 docollideFace.
dynmargin = basemargin + timemargin;
4166 docollide.
psb[0] =
this;
4167 docollide.
psb[1] = psb;
4172 docollide.
psb[0] = psb;
4173 docollide.
psb[1] =
this;
4184 if (psb->
isActive() || this->isActive())
4197 docollide.
psb[0] =
this;
4198 docollide.
psb[1] = psb;
4208 docollide.
psb[0] = psb;
4209 docollide.
psb[1] =
this;
4220 docollide.
psb[0] =
this;
4221 docollide.
psb[1] = psb;
4242 if (psb->
isActive() || this->isActive())
4255 docollide.
psb[0] =
this;
4256 docollide.
psb[1] = psb;
4265 docollide.
psb[0] = psb;
4266 docollide.
psb[1] =
this;
4277 docollide.
psb[0] =
this;
4278 docollide.
psb[1] = psb;
4320 if (sbd->m_materials)
4323 int numElem = sbd->m_numMaterials;
4327 for (
int i = 0; i < numElem; i++, memPtr++)
4351 int numElem = sbd->m_numNodes;
4354 for (
int i = 0; i < numElem; i++, memPtr++)
4375 int numElem = sbd->m_numLinks;
4378 for (
int i = 0; i < numElem; i++, memPtr++)
4396 int numElem = sbd->m_numFaces;
4399 for (
int i = 0; i < numElem; i++, memPtr++)
4403 for (
int j = 0; j < 3; j++)
4414 if (sbd->m_tetrahedra)
4417 int numElem = sbd->m_numTetrahedra;
4420 for (
int i = 0; i < numElem; i++, memPtr++)
4422 for (
int j = 0; j < 4; j++)
4440 int numElem = sbd->m_numAnchors;
4443 for (
int i = 0; i < numElem; i++, memPtr++)
4457 sbd->m_config.m_dynamicFriction =
m_cfg.
kDF;
4459 sbd->m_config.m_pressure =
m_cfg.
kPR;
4468 sbd->m_config.m_damping =
m_cfg.
kDP;
4469 sbd->m_config.m_poseMatch =
m_cfg.
kMT;
4471 sbd->m_config.m_volume =
m_cfg.
kVC;
4472 sbd->m_config.m_rigidContactHardness =
m_cfg.
kCHR;
4473 sbd->m_config.m_kineticContactHardness =
m_cfg.
kKHR;
4474 sbd->m_config.m_softContactHardness =
m_cfg.
kSHR;
4475 sbd->m_config.m_anchorHardness =
m_cfg.
kAHR;
4479 sbd->m_config.m_softKineticClusterHardness =
m_cfg.
kSKHR_CL;
4506 for (
int i = 0; i < numElem; i++, memPtr++)
4521 int sz =
sizeof(float);
4523 float* memPtr = (
float*)chunk->
m_oldPtr;
4524 for (
int i = 0; i < numElem; i++, memPtr++)
4538 if (sbd->m_numClusters)
4540 int numElem = sbd->m_numClusters;
4544 for (
int i = 0; i < numElem; i++, memPtr++)
4584 for (
int j = 0; j < numElem; j++, memPtr++)
4586 m_clusters[i]->m_framerefs[j].serializeFloat(*memPtr);
4595 int sz =
sizeof(float);
4597 float* memPtr = (
float*)chunk->
m_oldPtr;
4598 for (
int j = 0; j < numElem; j++, memPtr++)
4609 int sz =
sizeof(int);
4611 int* memPtr = (
int*)chunk->
m_oldPtr;
4612 for (
int j = 0; j < numElem; j++, memPtr++)
4616 *memPtr = *indexPtr;
4634 for (
int i = 0; i < numElem; i++, memPtr++)
4644 for (
int j = 0; j < 4; j++)
4651 if (
m_joints[i]->m_bodies[0].m_soft)
4656 if (
m_joints[i]->m_bodies[0].m_collisionObject)
4661 if (
m_joints[i]->m_bodies[0].m_rigid)
4667 if (
m_joints[i]->m_bodies[1].m_soft)
4672 if (
m_joints[i]->m_bodies[1].m_collisionObject)
4677 if (
m_joints[i]->m_bodies[1].m_rigid)
void optimizeIncremental(int passes)
btVector3FloatData * m_framerefs
virtual int calculateSerializeBufferSize() const
void removeAnchor(int node)
btRigidBody * m_rigidBody
btScalar m_restLengthScale
btMultiBodyJacobianData jacobianData_t2
void updateDeactivation(btScalar timeStep)
void Solve(btScalar dt, btScalar sor)
SoftBodyMaterialData * m_material
void addVelocity(const btVector3 &velocity)
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)=0
void transformTo(const btTransform &trs)
const btTransform & xform() const
btAlignedObjectArray< btVector3 > scratch_v
btCollisionObject can be used to manage collision detection objects.
bool checkLink(int node0, int node1) const
void updateFaceTree(bool use_velocity, bool margin)
@ Default
Enable debug draw.
btVector3FloatData m_relPosition[2]
static void PSolve_Links(btSoftBody *psb, btScalar kst, btScalar ti)
tVSolverArray m_vsequence
static void solveClusters(const btAlignedObjectArray< btSoftBody * > &bodies)
The btRigidBody is the main class for rigid body objects.
@ VF_DD
Cluster soft body self collision.
void(* vsolver_t)(btSoftBody *, btScalar)
DBVT_PREFIX void collideTT(const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
void appendLink(int model=-1, Material *mat=0)
static btMatrix3x3 ImpulseMatrix(btScalar dt, btScalar ima, btScalar imb, const btMatrix3x3 &iwi, const btVector3 &r)
void Terminate(btScalar dt)
#define btAlignedFree(ptr)
btAlignedObjectArray< bool > m_clusterConnectivity
void indicesToPointers(const int *map=0)
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
const btCollisionObjectWrapper * m_colObj1Wrap
#define DISABLE_DEACTIVATION
@ F_OneSided
Face normals are flipped to match velocity and lift and drag forces are applied.
static btMultiBodyLinkCollider * upcast(btCollisionObject *colObj)
tRenderNodeArray m_renderNodes
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
btScalar length() const
Return the length of the vector.
@ VF_SS
Rigid versus soft mask.
void appendFace(int model=-1, Material *mat=0)
void(* psolver_t)(btSoftBody *, btScalar, btScalar)
btAlignedObjectArray< btVector3 > m_quads
void Prepare(btScalar dt, int iterations)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
void refine(ImplicitFn *ifn, btScalar accurary, bool cut)
void prepareClusters(int iterations)
btScalar m_sleepingThreshold
void defaultCollisionHandler(const btCollisionObjectWrapper *pcoWrap)
btVector3FloatData m_dimpulses[2]
bool gDisableDeactivation
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btVector3FloatData m_previousPosition
static void ZeroInitialize(T &value)
@ BT_JOINT_SOFT_BODY_CLUSTER
btMatrix3x3 inverse() const
Return the inverse of the matrix.
void setZ(btScalar _z)
Set the z value.
void setZero()
Set the matrix to the identity.
bool checkDeformableContact(const btCollisionObjectWrapper *colObjWrap, const btVector3 &x, btScalar margin, btSoftBody::sCti &cti, bool predict=false) const
btAlignedObjectArray< btScalar > m_jacobians
@ SDF_RD
Cluster vs convex rigid vs soft.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
@ SContacts
Rigid contacts solver.
btVector3 getCenterOfMass() const
btScalar Evaluate(const btVector3 &x, const btCollisionShape *shape, btVector3 &normal, btScalar margin)
virtual void * getUniquePointer(void *oldPtr)=0
void appendNote(const char *text, const btVector3 &o, const btVector4 &c=btVector4(1, 0, 0, 0), Node *n0=0, Node *n1=0, Node *n2=0, Node *n3=0)
btDispatcher * m_dispatcher
btTransformFloatData m_framexform
int findLinearSearch(const T &key) const
static btMatrix3x3 OuterProduct(const btScalar *v1, const btScalar *v2, const btScalar *v3, const btScalar *u1, const btScalar *u2, const btScalar *u3, int ndof)
#define IDX2PTR(_p_, _b_)
const btCollisionObjectWrapper * m_colObj1Wrap
const btVector3 & getWindVelocity()
Return the wind velocity for interaction with the air.
void Terminate(btScalar dt)
btRigidBodyData * m_rigidBody
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
static btDbvtVolume VolumeOf(const btSoftBody::Face &f, btScalar margin)
static btVector3 ProjectOnPlane(const btVector3 &v, const btVector3 &a)
@ SDF_RS
Rigid versus soft mask.
void extractRotation(btQuaternion &q, btScalar tolerance=1.0e-9, int maxIter=100)
extractRotation is from "A robust method to extract the rotational part of deformations" See http://d...
static bool SameSign(const T &x, const T &y)
void appendAnchor(int node, btRigidBody *body, bool disableCollisionBetweenLinkedBodies=false, btScalar influence=1)
btScalar dot(const btVector3 &v) const
Return the dot product.
void staticSolve(int iterations)
Material * appendMaterial()
#define btSoftBodyData
btSoftBody implementation by Nathanael Presson
static int PolarDecompose(const btMatrix3x3 &m, btMatrix3x3 &q, btMatrix3x3 &s)
int getActivationState() const
btTransform m_worldTransform
bool rayFaceTest(const btVector3 &rayFrom, const btVector3 &rayTo, sRayCast &results)
static void EvaluateMedium(const btSoftBodyWorldInfo *wfi, const btVector3 &x, btSoftBody::sMedium &medium)
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
void resetLinkRestLengths()
btScalar btAngle(const btQuaternion &q1, const btQuaternion &q2)
Return the angle between two quaternions.
#define btAlignedAlloc(size, alignment)
static btVector3 clusterCom(const Cluster *cluster)
const btTransform & getWorldTransform() const
void setVolumeDensity(btScalar density)
void setSelfCollision(bool useSelfCollision)
void setWindVelocity(const btVector3 &velocity)
Set a wind velocity for interaction with the air.
void setCacheBarycenter(bool cacheBarycenter)
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
static btVector3 clusterVelocity(const Cluster *cluster, const btVector3 &rpos)
static void ApplyClampedForce(btSoftBody::Node &n, const btVector3 &f, btScalar dt)
static btMatrix3x3 Diagonal(btScalar x)
void addAeroForceToFace(const btVector3 &windVelocity, int faceIndex)
btMatrix3x3FloatData m_locii
#define btSoftBodyDataName
static btScalar AreaOf(const btVector3 &x0, const btVector3 &x1, const btVector3 &x2)
SoftBodyMaterialData * m_material
btScalar gDeactivationTime
tVector3Array m_framerefs
static btScalar SignedDistance(const btVector3 &position, btScalar margin, const btConvexShape *shape, const btTransform &wtrs, sResults &results)
btScalar m_deactivationTime
btVector3FloatData m_vimpulses[2]
const T & btMin(const T &a, const T &b)
bool checkFace(int node0, int node1, int node2) const
static DBVT_PREFIX void rayTest(const btDbvtNode *root, const btVector3 &rayFrom, const btVector3 &rayTo, DBVT_IPOLICY)
rayTest is a re-entrant ray test, and can be called in parallel as long as the btAlignedAlloc is thre...
void randomizeConstraints()
btScalar btAcos(btScalar x)
tMaterialArray m_materials
void Solve(btScalar dt, btScalar sor)
static btScalar ClusterMetric(const btVector3 &x, const btVector3 &y)
const T & btMax(const T &a, const T &b)
int generateClusters(int k, int maxiterations=8192)
generateClusters with k=0 will create a convex cluster for each tetrahedron or triangle otherwise an ...
btVector3FloatData m_accumulatedForce
@ F_TwoSidedLiftDrag
Face normals are flipped to match velocity.
btAlignedObjectArray< TetraScratch > m_tetraScratches
const btScalar & y() const
Return the y value.
btAlignedObjectArray< btVector4 > m_renderNodesInterpolationWeights
bool isStaticOrKinematicObject() const
static void PSolve_RContacts(btSoftBody *psb, btScalar kst, btScalar ti)
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
float m_selfCollisionImpulseFactor
int m_internalType
m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody,...
const btScalar & getX() const
Return the x value.
btScalar getVolume() const
btAlignedObjectArray< btAlignedObjectArray< const btSoftBody::Node * > > m_renderNodesParents
btTransform & getWorldTransform()
void update(btDbvtNode *leaf, int lookahead=-1)
tSContactArray m_scontacts
btAlignedObjectArray< Node * > m_nodes
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
static btMatrix3x3 Mul(const btMatrix3x3 &a, btScalar b)
The btHashMap template class implements a generic and lightweight hashmap.
btScalar fraction
feature index
const btCollisionObject * m_colObj
btCollisionShape * m_collisionShape
btScalar m_element_measure
virtual btScalar getMargin() const =0
btSoftBodyWorldInfo * m_worldInfo
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
static btDbvntNode * copyToDbvnt(const btDbvtNode *n)
const btCollisionShape * getCollisionShape() const
btVector3FloatData m_normal
btScalar btFabs(btScalar x)
void Process(const btDbvtNode *leaf)
@ CL_SS
Vertex vs face soft vs soft handling.
btVector3FloatData m_refs[2]
RayFromToCaster(const btVector3 &rayFrom, const btVector3 &rayTo, btScalar mxt)
void setX(btScalar _x)
Set the x value.
btScalar m_repulsionStiffness
btMultiBodyJacobianData jacobianData_normal
void activate(bool forceActivation=false) const
static void PSolve_SContacts(btSoftBody *psb, btScalar, btScalar ti)
void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v) const
stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instea...
void Prepare(btScalar dt, int iterations)
void ProcessColObj(btSoftBody *ps, const btCollisionObjectWrapper *colObWrap)
void transform(const btTransform &trs)
virtual btScalar getMargin() const =0
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
const btCollisionShape * getCollisionShape() const
static btMatrix3x3 AngularImpulseMatrix(const btMatrix3x3 &iia, const btMatrix3x3 &iib)
void resize(int newsize, const T &fillData=T())
btAlignedObjectArray< TetraScratch > m_tetraScratchesTn
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
btRigidBody * m_rigidBody
void setLinearVelocity(const btVector3 &linVel)
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 setAngularVelocity(const btVector3 &angVel)
void setSpringStiffness(btScalar k)
void addAeroForceToNode(const btVector3 &windVelocity, int nodeIndex)
tPSolverArray m_psequence
static void clusterAImpulse(Cluster *cluster, const Impulse &impulse)
btMatrix3x3FloatData m_scale
btBroadphaseProxy * getBroadphaseHandle()
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const =0
getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
void setY(btScalar _y)
Set the y value.
static void clusterVAImpulse(Cluster *cluster, const btVector3 &impulse)
btScalar m_maxSpeedSquared
btVector3FloatData m_velocity
SoftBodyMaterialData * m_material
DBVT_PREFIX void collideTV(const btDbvtNode *root, const btDbvtVolume &volume, DBVT_IPOLICY) const
const btTransform & getInterpolationWorldTransform() const
void appendNode(const btVector3 &x, btScalar m)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
void geometricCollisionHandler(btSoftBody *psb)
btScalar determinant() const
Return the determinant of the matrix.
void ProcessSoftSoft(btSoftBody *psa, btSoftBody *psb)
btVector3FloatData m_normal
btMatrix3x3 transpose() const
Return the transpose of the matrix.
static btDbvtNode * buildTreeBottomUp(btAlignedObjectArray< btDbvtNode * > &leafNodes, btAlignedObjectArray< btAlignedObjectArray< int > > &adj)
btSoftBody implementation by Nathanael Presson
static void findJacobian(const btMultiBodyLinkCollider *multibodyLinkCol, btMultiBodyJacobianData &jacobianData, const btVector3 &contact_point, const btVector3 &dir)
btSoftBody implementation by Nathanael Presson
static void solveCommonConstraints(btSoftBody **bodies, int count, int iterations)
btScalar getInvMass() const
static psolver_t getSolver(ePSolver::_ solver)
btAlignedObjectArray< btScalar > scratch_r
btVector3FloatData m_position
DBVT_PREFIX void selfCollideT(const btDbvntNode *root, DBVT_IPOLICY)
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
void predictMotion(btScalar dt)
const btCollisionObject * getCollisionObject() const
void initializeFaceTree()
static void clusterDCImpulse(Cluster *cluster, const btVector3 &impulse)
btScalar m_maxDisplacement
void setPose(bool bvolume, bool bframe)
static T Lerp(const T &a, const T &b, btScalar t)
static void getBarycentric(const btVector3 &p, btVector3 &a, btVector3 &b, btVector3 &c, btVector3 &bary)
@ RContacts
Anchor solver.
static btVector3 generateUnitOrthogonalVector(const btVector3 &u)
btVector3 getLinearVelocity()
btVector3 can be used to represent 3D points and vectors.
void setMaxStress(btScalar maxStress)
btMatrix3x3FloatData m_invwi
static btScalar rayFromToTriangle(const btVector3 &rayFrom, const btVector3 &rayTo, const btVector3 &rayNormalizedDirection, const btVector3 &a, const btVector3 &b, const btVector3 &c, btScalar maxt=SIMD_INFINITY)
static T BaryEval(const T &a, const T &b, const T &c, const btVector3 &coord)
void setRestLengthScale(btScalar restLength)
bool hasContactResponse() const
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
@ SVSmask
rigid vs deformable
btMatrix3x3FloatData m_rot
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
void appendAngularJoint(const AJoint::Specs &specs, Cluster *body0, Body body1)
btAlignedObjectArray< btScalar > m_z
void setRotation(const btVector3 &axis, const btScalar &_angle)
Set the rotation using axis angle notation.
@ SDF_RDF
Rigid versus deformable face mask.
static int MatchEdge(const btSoftBody::Node *a, const btSoftBody::Node *b, const btSoftBody::Node *ma, const btSoftBody::Node *mb)
btScalar getMass(int node) const
btMatrix3x3FloatData m_aqq
#define ATTRIBUTE_ALIGNED16(a)
void serializeFloat(struct btVector3FloatData &dataOut) const
void appendLinearJoint(const LJoint::Specs &specs, Cluster *body0, Body body1)
void scale(const btVector3 &scl)
bool btFuzzyZero(btScalar x)
const btScalar & getZ() const
Return the z value.
@ BT_JOINT_COLLISION_OBJECT
btAlignedObjectArray< int > m_links
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
const btScalar & getY() const
Return the y value.
virtual btScalar Eval(const btVector3 &x)=0
tRContactArray m_rcontacts
btVector3 evaluateCom() const
btSoftBody(btSoftBodyWorldInfo *worldInfo, int node_count, const btVector3 *x, const btScalar *m)
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
btScalar getRestLengthScale()
const Value * find(const Key &key) const
static btDbvtAabbMm FromCR(const btVector3 &c, btScalar r)
void setTotalMass(btScalar mass, bool fromfaces=false)
void initializeClusters()
static btVector3 Clamp(const btVector3 &v, btScalar maxlength)
const btScalar & w() const
Return the w value.
bool rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, sRayCast &results)
Ray casting using rayFrom and rayTo in worldspace, (not direction!)
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
tPSolverArray m_dsequence
void rotate(const btQuaternion &rot)
DBVT_INLINE bool isinternal() const
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
void updateLinkConstants()
@ V_TwoSided
Vertex normals are oriented toward velocity.
const btScalar & x() const
Return the x value.
void fillContactJacobianMultiDof(int link, const btVector3 &contact_point, const btVector3 &normal, btScalar *jac, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v, btAlignedObjectArray< btMatrix3x3 > &scratch_m) const
virtual void setMargin(btScalar margin)=0
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
DBVT_INLINE bool isleaf() const
btAlignedObjectArray< btVector3 > m_X
void setTotalDensity(btScalar density)
btMatrix3x3 adjoint() const
Return the adjoint of the matrix.
@ CL_RS
SDF based rigid vs soft.
void Prepare(btScalar dt, int iterations)
void appendDeformableAnchor(int node, btRigidBody *body)
bool checkContact(const btCollisionObjectWrapper *colObjWrap, const btVector3 &x, btScalar margin, btSoftBody::sCti &cti) const
int capacity() const
return the pre-allocated (reserved) elements, this is at least as large as the total number of elemen...
#define BT_SBMATERIAL_CODE
void insert(const Key &key, const Value &value)
static btVector3 NormalizeAny(const btVector3 &v)
const btScalar * getVelocityVector() const
int getInternalType() const
reserved for Bullet internal usage
static void calculateNormalCone(btDbvntNode *root)
void appendTetra(int model, Material *mat)
btVector3FloatData * m_positions
RayFromToCaster takes a ray from, ray to (instead of direction!)
void releaseCluster(int index)
@ V_TwoSidedLiftDrag
Vertex normals are flipped to match velocity.
void setIdentity()
Set the matrix to the identity.
btVector3FloatData m_localFrame
const btMatrix3x3 & getInvInertiaTensorWorld() const
virtual void Prepare(btScalar dt, int iterations)
void setVolumeMass(btScalar mass)
static unsigned long seed
@ V_OneSided
Vertex normals are flipped to match velocity and lift and drag forces are applied.
static void clusterDImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
#define WANTS_DEACTIVATION
SoftBodyMaterialData * m_material
void setSolver(eSolverPresets::_ preset)
static btScalar ImplicitSolve(btSoftBody::ImplicitFn *fn, const btVector3 &a, const btVector3 &b, const btScalar accuracy, const int maxiterations=256)
btMultiBody * m_multiBody
btDbvtNode * insert(const btDbvtVolume &box, void *data)
const btCollisionObjectWrapper * m_colObj1Wrap
void setCollisionQuadrature(int N)
void updateArea(bool averageArea=true)
btAlignedObjectArray< DeformableNodeRigidAnchor > m_deformableAnchors
void applyClusters(bool drift)
virtual void * findPointer(void *oldPtr)=0
btMultiBodyJacobianData jacobianData_t1
@ SDF_MDF
GJK based Rigid vs. deformable face.
void serializeFloat(struct btMatrix3x3FloatData &dataOut) const
bool cutLink(int node0, int node1, btScalar position)
bool checkDeformableFaceContact(const btCollisionObjectWrapper *colObjWrap, Face &f, btVector3 &contact_point, btVector3 &bary, btScalar margin, btSoftBody::sCti &cti, bool predict=false) const
@ SDF_RDN
GJK based Multibody vs. deformable face.
void setMass(int node, btScalar mass)
btAlignedObjectArray< const class btCollisionObject * > m_collisionDisabledObjects
static void PSolve_Anchors(btSoftBody *psb, btScalar kst, btScalar ti)
const btTransform * m_preTransform
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
@ CL_SELF
Cluster vs cluster soft vs soft handling.
btBroadphaseInterface * m_broadphase
void push_back(const T &_Val)
int generateBendingConstraints(int distance, Material *mat=0)
void interpolateRenderMesh()
eFeature::_ feature
soft body
btSparseSdf< 3 > m_sparsesdf
static void VSolve_Links(btSoftBody *psb, btScalar kst)
void setGravityFactor(btScalar gravFactor)
btMatrix3x3FloatData m_c0
void Solve(btScalar dt, btScalar sor)
void remove(btDbvtNode *leaf)
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
void remove(const T &key)
btScalar btSqrt(btScalar y)
#define PTR2IDX(_p_, _b_)
void advanceDeformation()
static void clusterImpulse(Cluster *cluster, const btVector3 &rpos, const Impulse &impulse)
btScalar getFriction() const
@ Default
SDF based Rigid vs. deformable node.
void addForce(const btVector3 &force)
btVector3 normalized() const
Return a normalized version of this vector.
@ F_TwoSided
Vertex normals are taken as it is.
btVector3 & safeNormalize()
void translate(const btVector3 &trs)
btAlignedObjectArray< btMatrix3x3 > scratch_m
static void clusterVImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static T sum(const btAlignedObjectArray< T > &items)
btAlignedObjectArray< btScalar > m_deltaVelocitiesUnitImpulse
virtual btChunk * allocate(size_t size, int numElements)=0
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
void initializeDmInverse()
btScalar getTotalMass() const
btVector3FloatData m_c0[4]
static void clusterDAImpulse(Cluster *cluster, const btVector3 &impulse)
const btScalar & z() const
Return the z value.
btVector3 m_rayNormalizedDirection
void setActivationState(int newState) const
int size() const
return the number of elements in the array
static btScalar Dot4(const btVector4 &a, const btVector4 &b)
void setVelocity(const btVector3 &velocity)
btScalar length2() const
Return the length of the vector squared.
btScalar m_dampingCoefficient
const btCollisionShape * getCollisionShape() const
void Terminate(btScalar dt)
float m_maxSelfCollisionImpulse
btTransform getRigidTransform()
btRigidBody * m_rigidBody