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)
264 const Node* n[] = {node0, node1};
268 if ((l.
m_n[0] == n[0] && l.
m_n[1] == n[1]) ||
269 (l.
m_n[0] == n[1] && l.
m_n[1] == n[0]))
287 for (
int j = 0; j < 3; ++j)
289 if ((f.
m_n[j] == n[0]) ||
290 (f.
m_n[j] == n[1]) ||
296 if (c == 7)
return (
true);
386 n.
m_im = m > 0 ? 1 / m : 0;
420 if ((!bcheckexist) || (!
checkLink(node0, node1)))
507 appendAnchor(node, body, local, disableCollisionBetweenLinkedBodies, influence);
513 if (disableCollisionBetweenLinkedBodies)
555 static const btMatrix3x3 iwiStatic(0, 0, 0, 0, 0, 0, 0, 0, 0);
717 const bool as_lift = kLF > 0;
718 const bool as_drag = kDG > 0;
719 const bool as_aero = as_lift || as_drag;
751 btScalar tri_area = 0.5f * n.m_area;
753 fDrag = 0.5f * kDG * medium.
m_density * rel_v2 * tri_area * n_dot_v * (-rel_v_nrm);
757 if (0 < n_dot_v && n_dot_v < 0.98480f)
758 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));
765 if (del_v_by_fDrag_len2 >= v_len2 && del_v_by_fDrag_len2 > 0)
769 fDrag *=
btScalar(0.8) * (v_len / del_v_by_fDrag_len);
785 const btScalar c0 = n.m_area * dvn * rel_v2 / 2;
787 force += nrm * (-c1 * kLF);
804 const bool as_lift = kLF > 0;
805 const bool as_drag = kDG > 0;
806 const bool as_aero = as_lift || as_drag;
839 fDrag = 0.5f * kDG * medium.
m_density * rel_v2 * tri_area * n_dot_v * (-rel_v_nrm);
843 if (0 < n_dot_v && n_dot_v < 0.98480f)
844 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));
849 for (
int j = 0; j < 3; ++j)
858 if (del_v_by_fDrag_len2 >= v_len2 && del_v_by_fDrag_len2 > 0)
862 fDrag *=
btScalar(0.8) * (v_len / del_v_by_fDrag_len);
882 force += nrm * (-c1 * kLF);
925 m_nodes[node].m_im = mass > 0 ? 1 / mass : 0;
963 for (
int j = 0; j < 3; ++j)
1002 for (
int j = 0; j < 4; ++j)
1025 for (
int j = 0; j < 4; ++j)
1040 total_momentum += mass *
m_nodes[i].m_v;
1043 return total_mass == 0 ? total_momentum : total_momentum / total_mass;
1198 if (
m_nodes[i].m_im <= 0) tmass += kmass;
1272 for (
int i = 0, ni = cluster->
m_nodes.size(); i < ni; ++i)
1276 return (com * cluster->
m_imass);
1297 cluster->
m_lv += li;
1299 cluster->
m_av += ai;
1325 cluster->
m_av += ai;
1365 const unsigned inf = (~(unsigned)0) >> 1;
1366 unsigned* adj =
new unsigned[n * n];
1368#define IDX(_x_, _y_) ((_y_)*n + (_x_))
1369 for (j = 0; j < n; ++j)
1371 for (i = 0; i < n; ++i)
1375 adj[
IDX(i, j)] = adj[
IDX(j, i)] = inf;
1379 adj[
IDX(i, j)] = adj[
IDX(j, i)] = 0;
1387 adj[
IDX(ia, ib)] = 1;
1388 adj[
IDX(ib, ia)] = 1;
1409 for (
int ii = 0; ii < nodeLinks.
size(); ii++)
1413 for (
int jj = 0; jj < nodeLinks[ii].m_links.
size(); jj++)
1415 int k = nodeLinks[ii].m_links[jj];
1416 for (
int kk = 0; kk < nodeLinks[k].m_links.
size(); kk++)
1418 int j = nodeLinks[k].m_links[kk];
1421 const unsigned sum = adj[
IDX(i, k)] + adj[
IDX(k, j)];
1423 if (adj[
IDX(i, j)] >
sum)
1435 for (
int k = 0; k < n; ++k)
1437 for (j = 0; j < n; ++j)
1439 for (i = j + 1; i < n; ++i)
1441 const unsigned sum = adj[
IDX(i, k)] + adj[
IDX(k, j)];
1442 if (adj[
IDX(i, j)] >
sum)
1453 for (j = 0; j < n; ++j)
1455 for (i = j + 1; i < n; ++i)
1457 if (adj[
IDX(i, j)] == (
unsigned)distance)
1474 unsigned long seed = 243703;
1475#define NEXTRAND (seed = (1664525L * seed + 1013904223L) & 0xffffffff)
1494 for (
int i = 0; i < node_count; i++)
1556 for (i = 0; i < k; ++i)
1566 c = centers[i] + (c - centers[i]) * w;
1567 changed |= ((c - centers[i]).length2() >
SIMD_EPSILON);
1577 for (
int j = 1; j < k; ++j)
1588 }
while (changed && (iterations < maxiterations));
1604 for (
int j = 0; j < 3; ++j)
1606 const int cid = cids[idx[j]];
1607 for (
int q = 1; q < 3; ++q)
1609 const int kid = idx[(j + q) % 3];
1610 if (cids[kid] != cid)
1652 for (
int j = 0; j < 4; j++)
1669 for (
int j = 0; j < 3; ++j)
1690 bool connected =
false;
1693 for (
int i = 0; !connected && i < cla->
m_nodes.size(); i++)
1695 for (
int j = 0; j < clb->
m_nodes.size(); j++)
1740 edges(
int(l.
m_n[0] - nbase),
int(l.
m_n[1] - nbase)) = -1;
1745 edges(
int(f.
m_n[0] - nbase),
int(f.
m_n[1] - nbase)) = -1;
1746 edges(
int(f.
m_n[1] - nbase),
int(f.
m_n[2] - nbase)) = -1;
1747 edges(
int(f.
m_n[2] - nbase),
int(f.
m_n[0] - nbase)) = -1;
1750 for (i = 0; i < ncount; ++i)
1752 for (j = i + 1; j < ncount; ++j)
1754 if (edges(i, j) == -1)
1771 const btScalar f = (ma + mb) / (ma + mb + mc);
1772 a.
m_im = 1 / (ma * f);
1773 b.
m_im = 1 / (mb * f);
1805 const int idx[] = {int(feat.
m_n[0] - nbase),
1806 int(feat.
m_n[1] - nbase)};
1807 if ((idx[0] < ncount) && (idx[1] < ncount))
1809 const int ni = edges(idx[0], idx[1]);
1826 const int idx[] = {int(feat.
m_n[0] - nbase),
1827 int(feat.
m_n[1] - nbase),
1828 int(feat.
m_n[2] - nbase)};
1829 for (j = 2, k = 0; k < 3; j = k++)
1831 if ((idx[j] < ncount) && (idx[k] < ncount))
1833 const int ni = edges(idx[j], idx[k]);
1837 const int l = (k + 1) % 3;
1857 const int pcount = ncount;
1860 cnodes.
resize(ncount, 0);
1862 for (i = 0; i < ncount; ++i)
1865 if ((i >= pcount) || (
btFabs(ifn->
Eval(x)) < accurary))
1883 const int id[] = {int(
m_links[i].m_n[0] - nbase),
1884 int(
m_links[i].m_n[1] - nbase)};
1886 if (cnodes[
id[0]] && cnodes[
id[1]])
1893 if (((ifn->
Eval(
m_nodes[
id[0]].m_x) < accurary) &&
1900 for (
int j = 0; j < 2; ++j)
1902 int cn = cnodes[int(l.
m_n[j] - nbase)];
1911 if ((ifn->
Eval(n[0]->
m_x) < accurary) &&
1912 (ifn->
Eval(n[1]->
m_x) < accurary) &&
1913 (ifn->
Eval(n[2]->
m_x) < accurary))
1915 for (
int j = 0; j < 3; ++j)
1917 int cn = cnodes[int(n[j] - nbase)];
1929 for (
int j = 0; j < 2; ++j) ranks[
int(
m_links[i].m_n[j] - nbase)]++;
1933 for (
int j = 0; j < 3; ++j) ranks[
int(
m_faces[i].m_n[j] - nbase)]++;
1937 const int id[] = {int(
m_links[i].m_n[0] - nbase),
1938 int(
m_links[i].m_n[1] - nbase)};
1939 const bool sg[] = {ranks[
id[0]] == 1,
1951 for(i=nnodes-1;i>=0;--i)
1958 for(
int i=0;i<nnodes;++i) map[i]=i;
1959 PointersToIndices(
this);
1960 for(
int i=0,ni=todelete.
size();i<ni;++i)
1964 int& b=map[--nnodes];
1969 IndicesToPointers(
this,&map[0]);
2007 pft[0]->
m_n[1] = pn[mtch];
2008 pft[1]->
m_n[0] = pn[1 - mtch];
2014 for (
int k = 2, l = 0; l < 3; k = l++)
2021 pft[0]->
m_n[l] = pn[mtch];
2022 pft[1]->
m_n[k] = pn[1 - mtch];
2023 appendLink(pn[0], pft[0]->m_n[(l + 1) % 3], pft[0]->m_material,
true);
2024 appendLink(pn[1], pft[0]->m_n[(l + 1) % 3], pft[0]->m_material,
true);
2046 results.
body =
this;
2066 results.
body =
this;
2133 for (
int c = 0; c < 3; c++)
2135 if (deltaV[c] > clampDeltaV)
2137 deltaV[c] = clampDeltaV;
2139 if (deltaV[c] < -clampDeltaV)
2141 deltaV[c] = -clampDeltaV;
2303 for (
int isolve = 0; isolve < iterations; ++isolve)
2321 const int nb = bodies.
size();
2325 for (i = 0; i < nb; ++i)
2329 for (i = 0; i < nb; ++i)
2331 bodies[i]->prepareClusters(iterations);
2333 for (i = 0; i < iterations; ++i)
2336 for (
int j = 0; j < nb; ++j)
2338 bodies[j]->solveClusters(sor);
2341 for (i = 0; i < nb; ++i)
2343 bodies[i]->cleanupClusters();
2369 const btScalar t = rayFromToTriangle(m_rayFrom, m_rayTo, m_rayNormalizedDirection,
2374 if ((t > 0) && (t < m_mint))
2385 const btVector3& rayNormalizedDirection,
2401 if ((t > teps) && (t < maxt))
2403 const btVector3 hit = rayFrom + rayNormalizedDirection * t;
2418#define PTR2IDX(_p_, _b_) reinterpret_cast<btSoftBody::Node*>((_p_) - (_b_))
2426 m_nodes[i].m_leaf->data = *(
void**)&i;
2441 m_faces[i].m_leaf->data = *(
void**)&i;
2450 for (
int j = 0; j <
m_notes[i].m_rank; ++j)
2461#define IDX2PTR(_p_, _b_) map ? (&(_b_)[map[(((char*)_p_) - (char*)0)]]) : (&(_b_)[(((char*)_p_) - (char*)0)])
2493 for (
int j = 0; j <
m_notes[i].m_rank; ++j)
2549 int tetfaces[4][3] = {{0, 1, 2}, {0, 1, 3}, {1, 2, 3}, {0, 2, 3}};
2550 for (
int f = 0; f < 4; f++)
2552 int index0 = tetfaces[f][0];
2553 int index1 = tetfaces[f][1];
2554 int index2 = tetfaces[f][2];
2637 root->
normal = (n0 + n1).safeNormalize();
2644 BT_PROFILE(
"btSoftBody::initializeFaceTree");
2659 leafNodes[i] = node;
2665 for (
int i = 0; i < adj.
size(); ++i)
2667 for (
int j = i + 1; j < adj.
size(); ++j)
2670 for (
int k = 0; k < 3; ++k)
2672 for (
int l = 0; l < 3; ++l)
2712 leafNodes[i] = node;
2812 btVector3 v0 = b - a, v1 = c - a, v2 = p - a;
2818 btScalar denom = d00 * d11 - d01 * d01;
2827 bary.
setY((d11 * d20 - d01 * d21) / denom);
2828 bary.
setZ((d00 * d21 - d01 * d20) / denom);
2854#ifdef USE_QUADRATURE
2870 if (local_dst < dst)
2872 if (local_dst < 0 && predict)
2907 for (
int i = 0; i < 3; ++i)
2936 for (
int i = 0; i < 3; ++i)
3019 for (
int d = 0; d < 3; ++d)
3021 if (
m_nodes[i].m_x[d] > maxs[d])
3023 if (
m_nodes[i].m_x[d] < mins[d])
3060 Apq[0] = Apq[1] = Apq[2] =
btVector3(0, 0, 0);
3062 Apq[1].setY(
eps * 2);
3063 Apq[2].setZ(
eps * 3);
3068 Apq[0] += a.
x() * b;
3069 Apq[1] += a.
y() * b;
3070 Apq[2] += a.
z() * b;
3110 for (
int j = 0; j < 3; ++j)
3112 const int index = (int)(f.
m_n[j] - &
m_nodes[0]);
3137 for (
int j = 0; j < 3; ++j)
3145 m_nodes[i].m_area *= 0.3333333f;
3180 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3200 ii[0] = ii[1] = ii[2] =
btVector3(0, 0, 0);
3204 for (i = 0, ni = c.
m_nodes.size(); i < ni; ++i)
3209 ii[0][0] += m * (q[1] + q[2]);
3210 ii[1][1] += m * (q[0] + q[2]);
3211 ii[2][2] += m * (q[0] + q[1]);
3212 ii[0][1] -= m * k[0] * k[1];
3213 ii[0][2] -= m * k[0] * k[2];
3214 ii[1][2] -= m * k[1] * k[2];
3217 ii[1][0] = ii[0][1];
3218 ii[2][0] = ii[0][2];
3219 ii[2][1] = ii[1][2];
3246 const int n = c.
m_nodes.size();
3253 m[0] = m[1] = m[2] =
btVector3(0, 0, 0);
3258 for (
int i = 0; i < c.
m_nodes.size(); ++i)
3280 c.
m_invwi=c.m_xform.getBasis().scaled(iin)*c.m_xform.getBasis().transpose();
3283 for (
int i = 0; i < n; ++i)
3288 c.
m_invwi[0][0] += m * (q[1] + q[2]);
3289 c.
m_invwi[1][1] += m * (q[0] + q[2]);
3290 c.
m_invwi[2][2] += m * (q[0] + q[1]);
3291 c.
m_invwi[0][1] -= m * k[0] * k[1];
3292 c.
m_invwi[0][2] -= m * k[0] * k[2];
3293 c.
m_invwi[1][2] -= m * k[1] * k[2];
3307 for (i = 0; i < n; ++i)
3325 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3337 for (
int j = 1; j < n; ++j)
3417 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3427 for (i = 0; i < deltas.
size(); ++i)
3431 m_nodes[i].m_x += deltas[i] / weights[i];
3446 for (
int j = 0; j < c.
m_nodes.size(); ++j)
3466 m_links[i].Feature::m_material->m_kLST = k;
3483 btScalar unit_simplex_measure = 1. / 6.;
3503 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]);
3505 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];
3506 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];
3507 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];
3508 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];
3509 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];
3510 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];
3511 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];
3512 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];
3513 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];
3514 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];
3515 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];
3516 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];
3518 btVector4 p1(P11 * det, P21 * det, P31 * det, P41 * det);
3519 btVector4 p2(P12 * det, P22 * det, P32 * det, P42 * det);
3520 btVector4 p3(P13 * det, P23 * det, P33 * det, P43 * det);
3530 return a[0] * b[0] + a[1] * b[1] + a[2] * b[2] + a[3] * b[3];
3551 s.
m_trace = C[0].getX() + C[1].getY() + C[2].getZ();
3582 m_bodies[0].activate();
3583 m_bodies[1].activate();
3589 static const btScalar maxdrift = 4;
3591 m_rpos[0] = m_bodies[0].xform() * m_refs[0];
3592 m_rpos[1] = m_bodies[1].xform() * m_refs[1];
3593 m_drift =
Clamp(m_rpos[0] - m_rpos[1], maxdrift) * m_erp / dt;
3594 m_rpos[0] -= m_bodies[0].xform().getOrigin();
3595 m_rpos[1] -= m_bodies[1].xform().getOrigin();
3596 m_massmatrix =
ImpulseMatrix(m_bodies[0].invMass(), m_bodies[0].invWorldInertia(), m_rpos[0],
3597 m_bodies[1].invMass(), m_bodies[1].invWorldInertia(), m_rpos[1]);
3600 m_sdrift = m_massmatrix * (m_drift * m_split);
3601 m_drift *= 1 - m_split;
3609 const btVector3 va = m_bodies[0].velocity(m_rpos[0]);
3610 const btVector3 vb = m_bodies[1].velocity(m_rpos[1]);
3614 impulse.
m_velocity = m_massmatrix * (m_drift + vr * m_cfm) * sor;
3615 m_bodies[0].applyImpulse(-impulse, m_rpos[0]);
3616 m_bodies[1].applyImpulse(impulse, m_rpos[1]);
3624 m_bodies[0].applyDImpulse(-m_sdrift, m_rpos[0]);
3625 m_bodies[1].applyDImpulse(m_sdrift, m_rpos[1]);
3633 m_icontrol->Prepare(
this);
3635 m_axis[0] = m_bodies[0].xform().getBasis() * m_refs[0];
3636 m_axis[1] = m_bodies[1].xform().getBasis() * m_refs[1];
3639 m_drift *= m_erp / dt;
3640 m_massmatrix =
AngularImpulseMatrix(m_bodies[0].invWorldInertia(), m_bodies[1].invWorldInertia());
3643 m_sdrift = m_massmatrix * (m_drift * m_split);
3644 m_drift *= 1 - m_split;
3652 const btVector3 va = m_bodies[0].angularVelocity();
3653 const btVector3 vb = m_bodies[1].angularVelocity();
3656 const btVector3 vc = vr - m_axis[0] * m_icontrol->Speed(
this, sp);
3659 impulse.
m_velocity = m_massmatrix * (m_drift + vc * m_cfm) * sor;
3660 m_bodies[0].applyAImpulse(-impulse);
3661 m_bodies[1].applyAImpulse(impulse);
3669 m_bodies[0].applyDAImpulse(-m_sdrift);
3670 m_bodies[1].applyDAImpulse(m_sdrift);
3678 const bool dodrift = (m_life == 0);
3679 m_delete = (++m_life) > m_maxlife;
3682 m_drift = m_drift * m_erp / dt;
3685 m_sdrift = m_massmatrix * (m_drift * m_split);
3686 m_drift *= 1 - m_split;
3692 m_drift = m_sdrift =
btVector3(0, 0, 0);
3699 const btVector3 va = m_bodies[0].velocity(m_rpos[0]);
3700 const btVector3 vb = m_bodies[1].velocity(m_rpos[1]);
3714 if (m_bodies[0].m_soft == m_bodies[1].m_soft)
3721 if (impulse.
m_velocity.
length() < m_bodies[0].m_soft->m_maxSelfCollisionImpulse)
3726 m_bodies[0].applyImpulse(-impulse * m_bodies[0].m_soft->m_selfCollisionImpulseFactor, m_rpos[0]);
3727 m_bodies[1].applyImpulse(impulse * m_bodies[0].m_soft->m_selfCollisionImpulseFactor, m_rpos[1]);
3734 m_bodies[0].applyImpulse(-impulse, m_rpos[0]);
3735 m_bodies[1].applyImpulse(impulse, m_rpos[1]);
3744 m_bodies[0].applyDImpulse(-m_sdrift, m_rpos[0]);
3745 m_bodies[1].applyDImpulse(m_sdrift, m_rpos[1]);
3758 const bool as_lift = kLF > 0;
3759 const bool as_drag = kDG > 0;
3760 const bool as_pressure = kPR != 0;
3761 const bool as_volume = kVC > 0;
3762 const bool as_aero = as_lift ||
3768 const bool use_medium = as_aero;
3769 const bool use_volume = as_pressure ||
3778 ivolumetp = 1 /
btFabs(volume) * kPR;
3837 for (
int j = 0; j < 3; ++j)
3841 n.
m_x +=
m_z[i] * unit_normal;
3850 for (
int j = 0; j < 4; ++j)
3863 for (
int i = 0; i <= N; ++i)
3865 for (
int j = 0; i + j <= N; ++j)
3919 if (multibodyLinkCol)
3931 for (
int j = 0; j < ndof; ++j)
3957 if (multibodyLinkCol)
3959 double multiplier = 0.5;
4007 for (
int i = 0, ni = psb->
m_links.
size(); i < ni; ++i)
4030 for (
int i = 0, ni = psb->
m_links.
size(); i < ni; ++i)
4106 volume.Expand(
btVector3(basemargin, basemargin, basemargin));
4107 docollide.
psb =
this;
4111 docollide.
dynmargin = basemargin + timemargin;
4138 volume.Expand(
btVector3(basemargin, basemargin, basemargin));
4142 docollideNode.
psb =
this;
4145 docollideNode.
dynmargin = basemargin + timemargin;
4153 docollideFace.
psb =
this;
4156 docollideFace.
dynmargin = basemargin + timemargin;
4193 docollide.
psb[0] =
this;
4194 docollide.
psb[1] = psb;
4199 docollide.
psb[0] = psb;
4200 docollide.
psb[1] =
this;
4211 if (psb->
isActive() || this->isActive())
4224 docollide.
psb[0] =
this;
4225 docollide.
psb[1] = psb;
4235 docollide.
psb[0] = psb;
4236 docollide.
psb[1] =
this;
4247 docollide.
psb[0] =
this;
4248 docollide.
psb[1] = psb;
4269 if (psb->
isActive() || this->isActive())
4282 docollide.
psb[0] =
this;
4283 docollide.
psb[1] = psb;
4292 docollide.
psb[0] = psb;
4293 docollide.
psb[1] =
this;
4304 docollide.
psb[0] =
this;
4305 docollide.
psb[1] = psb;
4347 if (sbd->m_materials)
4350 int numElem = sbd->m_numMaterials;
4354 for (
int i = 0; i < numElem; i++, memPtr++)
4378 int numElem = sbd->m_numNodes;
4381 for (
int i = 0; i < numElem; i++, memPtr++)
4402 int numElem = sbd->m_numLinks;
4405 for (
int i = 0; i < numElem; i++, memPtr++)
4423 int numElem = sbd->m_numFaces;
4426 for (
int i = 0; i < numElem; i++, memPtr++)
4430 for (
int j = 0; j < 3; j++)
4441 if (sbd->m_tetrahedra)
4444 int numElem = sbd->m_numTetrahedra;
4447 for (
int i = 0; i < numElem; i++, memPtr++)
4449 for (
int j = 0; j < 4; j++)
4467 int numElem = sbd->m_numAnchors;
4470 for (
int i = 0; i < numElem; i++, memPtr++)
4484 sbd->m_config.m_dynamicFriction =
m_cfg.
kDF;
4486 sbd->m_config.m_pressure =
m_cfg.
kPR;
4495 sbd->m_config.m_damping =
m_cfg.
kDP;
4496 sbd->m_config.m_poseMatch =
m_cfg.
kMT;
4498 sbd->m_config.m_volume =
m_cfg.
kVC;
4499 sbd->m_config.m_rigidContactHardness =
m_cfg.
kCHR;
4500 sbd->m_config.m_kineticContactHardness =
m_cfg.
kKHR;
4501 sbd->m_config.m_softContactHardness =
m_cfg.
kSHR;
4502 sbd->m_config.m_anchorHardness =
m_cfg.
kAHR;
4506 sbd->m_config.m_softKineticClusterHardness =
m_cfg.
kSKHR_CL;
4533 for (
int i = 0; i < numElem; i++, memPtr++)
4548 int sz =
sizeof(float);
4550 float* memPtr = (
float*)chunk->
m_oldPtr;
4551 for (
int i = 0; i < numElem; i++, memPtr++)
4565 if (sbd->m_numClusters)
4567 int numElem = sbd->m_numClusters;
4571 for (
int i = 0; i < numElem; i++, memPtr++)
4611 for (
int j = 0; j < numElem; j++, memPtr++)
4613 m_clusters[i]->m_framerefs[j].serializeFloat(*memPtr);
4622 int sz =
sizeof(float);
4624 float* memPtr = (
float*)chunk->
m_oldPtr;
4625 for (
int j = 0; j < numElem; j++, memPtr++)
4636 int sz =
sizeof(int);
4638 int* memPtr = (
int*)chunk->
m_oldPtr;
4639 for (
int j = 0; j < numElem; j++, memPtr++)
4643 *memPtr = *indexPtr;
4661 for (
int i = 0; i < numElem; i++, memPtr++)
4671 for (
int j = 0; j < 4; j++)
4678 if (
m_joints[i]->m_bodies[0].m_soft)
4683 if (
m_joints[i]->m_bodies[0].m_collisionObject)
4688 if (
m_joints[i]->m_bodies[0].m_rigid)
4694 if (
m_joints[i]->m_bodies[1].m_soft)
4699 if (
m_joints[i]->m_bodies[1].m_collisionObject)
4704 if (
m_joints[i]->m_bodies[1].m_rigid)
#define btAlignedFree(ptr)
#define btAlignedAlloc(size, alignment)
#define DISABLE_DEACTIVATION
#define WANTS_DEACTIVATION
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
static btDbvtVolume bounds(btDbvtNode **leaves, int count)
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)
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btQuaternion inverse(const btQuaternion &q)
Return the inverse of a quaternion.
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
btScalar btAngle(const btQuaternion &q1, const btQuaternion &q2)
Return the angle between two quaternions.
bool gDisableDeactivation
btScalar gDeactivationTime
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define ATTRIBUTE_ALIGNED16(a)
btScalar btSqrt(btScalar y)
btScalar btFabs(btScalar x)
btScalar btAcos(btScalar x)
bool btFuzzyZero(btScalar x)
#define BT_SBMATERIAL_CODE
@ BT_JOINT_SOFT_BODY_CLUSTER
@ BT_JOINT_COLLISION_OBJECT
static T sum(const btAlignedObjectArray< T > &items)
static btMatrix3x3 OuterProduct(const btScalar *v1, const btScalar *v2, const btScalar *v3, const btScalar *u1, const btScalar *u2, const btScalar *u3, int ndof)
static btMatrix3x3 Mul(const btMatrix3x3 &a, btScalar b)
static btScalar ImplicitSolve(btSoftBody::ImplicitFn *fn, const btVector3 &a, const btVector3 &b, const btScalar accuracy, const int maxiterations=256)
static btDbvtVolume VolumeOf(const btSoftBody::Face &f, btScalar margin)
static T Lerp(const T &a, const T &b, btScalar t)
static btMatrix3x3 AngularImpulseMatrix(const btMatrix3x3 &iia, const btMatrix3x3 &iib)
static btScalar AreaOf(const btVector3 &x0, const btVector3 &x1, const btVector3 &x2)
static btVector3 generateUnitOrthogonalVector(const btVector3 &u)
static btVector3 NormalizeAny(const btVector3 &v)
static int PolarDecompose(const btMatrix3x3 &m, btMatrix3x3 &q, btMatrix3x3 &s)
static int MatchEdge(const btSoftBody::Node *a, const btSoftBody::Node *b, const btSoftBody::Node *ma, const btSoftBody::Node *mb)
static void findJacobian(const btMultiBodyLinkCollider *multibodyLinkCol, btMultiBodyJacobianData &jacobianData, const btVector3 &contact_point, const btVector3 &dir)
btSoftBody implementation by Nathanael Presson
static bool SameSign(const T &x, const T &y)
static void EvaluateMedium(const btSoftBodyWorldInfo *wfi, const btVector3 &x, btSoftBody::sMedium &medium)
static void ZeroInitialize(T &value)
static btVector3 ProjectOnPlane(const btVector3 &v, const btVector3 &a)
static btScalar ClusterMetric(const btVector3 &x, const btVector3 &y)
static btMatrix3x3 ImpulseMatrix(btScalar dt, btScalar ima, btScalar imb, const btMatrix3x3 &iwi, const btVector3 &r)
static void ApplyClampedForce(btSoftBody::Node &n, const btVector3 &f, btScalar dt)
static btVector3 Clamp(const btVector3 &v, btScalar maxlength)
static btMatrix3x3 Diagonal(btScalar x)
static void calculateNormalCone(btDbvntNode *root)
#define IDX2PTR(_p_, _b_)
#define PTR2IDX(_p_, _b_)
static void getBarycentric(const btVector3 &p, const btVector3 &a, const btVector3 &b, const btVector3 &c, btVector3 &bary)
static btScalar Dot4(const btVector4 &a, const btVector4 &b)
static btDbvtNode * buildTreeBottomUp(btAlignedObjectArray< btDbvtNode * > &leafNodes, btAlignedObjectArray< btAlignedObjectArray< int > > &adj)
btSoftBody implementation by Nathanael Presson
static btDbvntNode * copyToDbvnt(const btDbvtNode *n)
static unsigned long seed
#define btSoftBodyDataName
#define btSoftBodyData
btSoftBody implementation by Nathanael Presson
btScalar btDot(const btVector3 &v1, const btVector3 &v2)
Return the dot product between two vectors.
btVector3 btCross(const btVector3 &v1, const btVector3 &v2)
Return the cross product of two vectors.
The btAlignedObjectArray template class uses a subset of the stl::vector interface for its methods It...
int size() const
return the number of elements in the array
int findLinearSearch(const T &key) const
void resize(int newsize, const T &fillData=T())
void clear()
clear the array, deallocated memory. Generally it is better to use array.resize(0),...
void remove(const T &key)
void push_back(const T &_Val)
int capacity() const
return the pre-allocated (reserved) elements, this is at least as large as the total number of elemen...
virtual void setAabb(btBroadphaseProxy *proxy, const btVector3 &aabbMin, const btVector3 &aabbMax, btDispatcher *dispatcher)=0
btCollisionObject can be used to manage collision detection objects.
bool isStaticOrKinematicObject() const
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
btTransform & getWorldTransform()
btBroadphaseProxy * getBroadphaseHandle()
btTransform m_worldTransform
btCollisionShape * m_collisionShape
int getInternalType() const
reserved for Bullet internal usage
bool hasContactResponse() const
void activate(bool forceActivation=false) const
void setActivationState(int newState) const
int m_internalType
m_internalType is reserved to distinguish Bullet's btCollisionObject, btRigidBody,...
btScalar getFriction() const
btScalar m_deactivationTime
const btTransform & getInterpolationWorldTransform() const
const btCollisionShape * getCollisionShape() const
int getActivationState() const
The btCollisionShape class provides an interface for collision shapes that can be shared among btColl...
virtual void setMargin(btScalar margin)=0
virtual btScalar getMargin() const =0
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.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
virtual btScalar getMargin() const =0
The btHashMap template class implements a generic and lightweight hashmap.
void insert(const Key &key, const Value &value)
const Value * find(const Key &key) const
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
btMatrix3x3 adjoint() const
Return the adjoint of the matrix.
btMatrix3x3 inverse() const
Return the inverse of the matrix.
btMatrix3x3 transpose() const
Return the transpose of the matrix.
void setIdentity()
Set the matrix to the identity.
btScalar determinant() const
Return the determinant of the matrix.
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...
void setZero()
Set the matrix to the identity.
void serializeFloat(struct btMatrix3x3FloatData &dataOut) const
static btMultiBodyLinkCollider * upcast(btCollisionObject *colObj)
btMultiBody * m_multiBody
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
void calcAccelerationDeltasMultiDof(const btScalar *force, btScalar *output, btAlignedObjectArray< btScalar > &scratch_r, btAlignedObjectArray< btVector3 > &scratch_v) const
stepVelocitiesMultiDof is deprecated, use computeAccelerationsArticulatedBodyAlgorithmMultiDof instea...
void applyDeltaVeeMultiDof(const btScalar *delta_vee, btScalar multiplier)
const btScalar * getVelocityVector() const
The btQuaternion implements quaternion to perform linear algebra rotations in combination with btMatr...
void setRotation(const btVector3 &axis, const btScalar &_angle)
Set the rotation using axis angle notation.
The btRigidBody is the main class for rigid body objects.
btVector3 getVelocityInLocalPoint(const btVector3 &rel_pos) const
btScalar getInvMass() const
const btCollisionShape * getCollisionShape() const
void applyImpulse(const btVector3 &impulse, const btVector3 &rel_pos)
static const btRigidBody * upcast(const btCollisionObject *colObj)
to keep collision detection and dynamics separate we don't store a rigidbody pointer but a rigidbody ...
const btMatrix3x3 & getInvInertiaTensorWorld() const
virtual btChunk * allocate(size_t size, int numElements)=0
virtual void * getUniquePointer(void *oldPtr)=0
virtual void finalizeChunk(btChunk *chunk, const char *structType, int chunkCode, void *oldPtr)=0
virtual void * findPointer(void *oldPtr)=0
btMultiBodyJacobianData jacobianData_t1
btMultiBodyJacobianData jacobianData_normal
btMultiBodyJacobianData jacobianData_t2
The btSoftBody is an class to simulate cloth and volumetric soft bodies.
static void PSolve_Links(btSoftBody *psb, btScalar kst, btScalar ti)
static void PSolve_SContacts(btSoftBody *psb, btScalar, btScalar ti)
bool checkLink(int node0, int node1) const
btScalar m_sleepingThreshold
virtual void transformTo(const btTransform &trs)
btVector3 getLinearVelocity()
bool checkFace(int node0, int node1, int node2) const
void advanceDeformation()
void setGravityFactor(btScalar gravFactor)
void setPose(bool bvolume, bool bframe)
bool cutLink(int node0, int node1, btScalar position)
void appendFace(int model=-1, Material *mat=0)
void setMass(int node, btScalar mass)
void interpolateRenderMesh()
btScalar m_dampingCoefficient
btAlignedObjectArray< TetraScratch > m_tetraScratchesTn
bool rayFaceTest(const btVector3 &rayFrom, const btVector3 &rayTo, sRayCast &results)
void appendLinearJoint(const LJoint::Specs &specs, Cluster *body0, Body body1)
virtual void scale(const btVector3 &scl)
btAlignedObjectArray< bool > m_clusterConnectivity
void updateFaceTree(bool use_velocity, bool margin)
void defaultCollisionHandler(const btCollisionObjectWrapper *pcoWrap)
btScalar getVolume() const
bool rayTest(const btVector3 &rayFrom, const btVector3 &rayTo, sRayCast &results)
Ray casting using rayFrom and rayTo in worldspace, (not direction!)
void addVelocity(const btVector3 &velocity)
void predictMotion(btScalar dt)
void(*) vsolver_t(btSoftBody *, btScalar)
void setSelfCollision(bool useSelfCollision)
void setLinearVelocity(const btVector3 &linVel)
void appendTetra(int model, Material *mat)
void setRestLengthScale(btScalar restLength)
virtual void rotate(const btQuaternion &rot)
void applyClusters(bool drift)
static void PSolve_Anchors(btSoftBody *psb, btScalar kst, btScalar ti)
btSoftBodyWorldInfo * m_worldInfo
void updateArea(bool averageArea=true)
void addForce(const btVector3 &force)
void prepareClusters(int iterations)
void setCollisionQuadrature(int N)
static void clusterVImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
virtual const char * serialize(void *dataBuffer, class btSerializer *serializer) const
fills the dataBuffer and returns the struct name (and 0 on failure)
static void VSolve_Links(btSoftBody *psb, btScalar kst)
btVector3 evaluateCom() const
void setTotalDensity(btScalar density)
btAlignedObjectArray< const class btCollisionObject * > m_collisionDisabledObjects
static void clusterDAImpulse(Cluster *cluster, const btVector3 &impulse)
void appendNode(const btVector3 &x, btScalar m)
void staticSolve(int iterations)
void setVolumeMass(btScalar mass)
btScalar m_restLengthScale
bool checkDeformableContact(const btCollisionObjectWrapper *colObjWrap, const btVector3 &x, btScalar margin, btSoftBody::sCti &cti, bool predict=false) const
void updateDeactivation(btScalar timeStep)
btAlignedObjectArray< TetraScratch > m_tetraScratches
const btVector3 & getWindVelocity()
Return the wind velocity for interaction with the air.
void addAeroForceToFace(const btVector3 &windVelocity, int faceIndex)
btAlignedObjectArray< btVector4 > m_renderNodesInterpolationWeights
void appendAngularJoint(const AJoint::Specs &specs, Cluster *body0, Body body1)
void setAngularVelocity(const btVector3 &angVel)
void setVolumeDensity(btScalar density)
static void clusterDCImpulse(Cluster *cluster, const btVector3 &impulse)
virtual void transform(const btTransform &trs)
static void clusterVAImpulse(Cluster *cluster, const btVector3 &impulse)
btScalar getMass(int node) const
tMaterialArray m_materials
void setMaxStress(btScalar maxStress)
btSoftBody(btSoftBodyWorldInfo *worldInfo, int node_count, const btVector3 *x, const btScalar *m)
btAlignedObjectArray< btScalar > m_z
void addAeroForceToNode(const btVector3 &windVelocity, int nodeIndex)
static btVector3 clusterCom(const Cluster *cluster)
tRContactArray m_rcontacts
void appendAnchor(int node, btRigidBody *body, bool disableCollisionBetweenLinkedBodies=false, btScalar influence=1)
btScalar m_maxSpeedSquared
void releaseCluster(int index)
btScalar m_repulsionStiffness
void setVelocity(const btVector3 &velocity)
int generateClusters(int k, int maxiterations=8192)
generateClusters with k=0 will create a convex cluster for each tetrahedron or triangle otherwise an ...
void geometricCollisionHandler(btSoftBody *psb)
void refine(ImplicitFn *ifn, btScalar accurary, bool cut)
void setSolver(eSolverPresets::_ preset)
static T BaryEval(const T &a, const T &b, const T &c, const btVector3 &coord)
Material * appendMaterial()
void removeAnchor(int node)
btAlignedObjectArray< DeformableNodeRigidAnchor > m_deformableAnchors
void setCacheBarycenter(bool cacheBarycenter)
static void solveClusters(const btAlignedObjectArray< btSoftBody * > &bodies)
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)
bool checkDeformableFaceContact(const btCollisionObjectWrapper *colObjWrap, Face &f, btVector3 &contact_point, btVector3 &bary, btScalar margin, btSoftBody::sCti &cti, bool predict=false) const
virtual int calculateSerializeBufferSize() const
static void PSolve_RContacts(btSoftBody *psb, btScalar kst, btScalar ti)
static void clusterImpulse(Cluster *cluster, const btVector3 &rpos, const Impulse &impulse)
btAlignedObjectArray< btAlignedObjectArray< const btSoftBody::Node * > > m_renderNodesParents
tRenderNodeArray m_renderNodes
static void clusterDImpulse(Cluster *cluster, const btVector3 &rpos, const btVector3 &impulse)
static btVector3 clusterVelocity(const Cluster *cluster, const btVector3 &rpos)
btTransform getRigidTransform()
tSContactArray m_scontacts
void initializeClusters()
btScalar getRestLengthScale()
void updateState(const btAlignedObjectArray< btVector3 > &qs, const btAlignedObjectArray< btVector3 > &vs)
void randomizeConstraints()
btScalar getTotalMass() const
void appendLink(int model=-1, Material *mat=0)
void setSpringStiffness(btScalar k)
void initializeDmInverse()
void setTotalMass(btScalar mass, bool fromfaces=false)
void appendDeformableAnchor(int node, btRigidBody *body)
void updateLinkConstants()
btAlignedObjectArray< btVector3 > m_quads
static psolver_t getSolver(ePSolver::_ solver)
bool checkContact(const btCollisionObjectWrapper *colObjWrap, const btVector3 &x, btScalar margin, btSoftBody::sCti &cti) const
void indicesToPointers(const int *map=0)
static void solveCommonConstraints(btSoftBody **bodies, int count, int iterations)
void setWindVelocity(const btVector3 &velocity)
Set a wind velocity for interaction with the air.
int generateBendingConstraints(int distance, Material *mat=0)
btAlignedObjectArray< btVector3 > m_X
virtual void translate(const btVector3 &trs)
btVector3 getCenterOfMass() const
void(*) psolver_t(btSoftBody *, btScalar, btScalar)
void initializeFaceTree()
void resetLinkRestLengths()
static void clusterAImpulse(Cluster *cluster, const Impulse &impulse)
btVector3 can be used to represent 3D points and vectors.
const btScalar & getZ() const
Return the z value.
void setMax(const btVector3 &other)
Set each element to the max of the current values and the values of another btVector3.
void setZ(btScalar _z)
Set the z value.
const btScalar & w() const
Return the w value.
const btScalar & z() const
Return the z value.
btVector3 & safeNormalize()
btScalar length() const
Return the length of the vector.
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
void serializeFloat(struct btVector3FloatData &dataOut) const
btVector3 normalized() const
Return a normalized version of this vector.
void setY(btScalar _y)
Set the y value.
void setX(btScalar _x)
Set the x value.
btScalar length2() const
Return the length of the vector squared.
const btScalar & getY() const
Return the y value.
const btScalar & x() const
Return the x value.
void setMin(const btVector3 &other)
Set each element to the min of the current values and the values of another btVector3.
const btScalar & getX() const
Return the x value.
const btScalar & y() const
Return the y value.
btAlignedObjectArray< int > m_links
btMatrix3x3FloatData m_invwi
btVector3FloatData m_vimpulses[2]
btVector3FloatData * m_framerefs
btVector3FloatData m_dimpulses[2]
btMatrix3x3FloatData m_locii
float m_maxSelfCollisionImpulse
btTransformFloatData m_framexform
float m_selfCollisionImpulseFactor
btVector3FloatData m_normal
SoftBodyMaterialData * m_material
SoftBodyMaterialData * m_material
btVector3FloatData m_accumulatedForce
btVector3FloatData m_normal
btVector3FloatData m_previousPosition
btVector3FloatData m_velocity
btVector3FloatData m_position
SoftBodyMaterialData * m_material
btMatrix3x3FloatData m_rot
btVector3FloatData * m_positions
btMatrix3x3FloatData m_aqq
btMatrix3x3FloatData m_scale
btVector3FloatData m_c0[4]
SoftBodyMaterialData * m_material
btMatrix3x3FloatData m_c0
btVector3FloatData m_localFrame
btRigidBodyData * m_rigidBody
const btCollisionShape * getCollisionShape() const
const btTransform * m_preTransform
const btCollisionObject * getCollisionObject() const
const btTransform & getWorldTransform() const
DBVT_INLINE bool isleaf() const
static btDbvtAabbMm FromMM(const btVector3 &mi, const btVector3 &mx)
static btDbvtAabbMm FromCR(const btVector3 &c, btScalar r)
DBVT_INLINE bool isinternal() const
btDbvtNode * insert(const btDbvtVolume &box, void *data)
void optimizeIncremental(int passes)
void update(btDbvtNode *leaf, int lookahead=-1)
DBVT_PREFIX void collideTV(const btDbvtNode *root, const btDbvtVolume &volume, DBVT_IPOLICY) 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 remove(btDbvtNode *leaf)
DBVT_PREFIX void collideTT(const btDbvtNode *root0, const btDbvtNode *root1, DBVT_IPOLICY)
DBVT_PREFIX void selfCollideT(const btDbvntNode *root, DBVT_IPOLICY)
static btScalar SignedDistance(const btVector3 &position, btScalar margin, const btConvexShape *shape, const btTransform &wtrs, sResults &results)
btAlignedObjectArray< btScalar > m_deltaVelocitiesUnitImpulse
btAlignedObjectArray< btScalar > m_jacobians
btAlignedObjectArray< btScalar > scratch_r
btAlignedObjectArray< btMatrix3x3 > scratch_m
btAlignedObjectArray< btVector3 > scratch_v
btVector3FloatData m_refs[2]
btVector3FloatData m_relPosition[2]
btDispatcher * m_dispatcher
btSparseSdf< 3 > m_sparsesdf
btScalar m_maxDisplacement
btBroadphaseInterface * m_broadphase
void Prepare(btScalar dt, int iterations)
void Solve(btScalar dt, btScalar sor)
void Terminate(btScalar dt)
const btTransform & xform() const
void Terminate(btScalar dt)
void Prepare(btScalar dt, int iterations)
void Solve(btScalar dt, btScalar sor)
tVector3Array m_framerefs
btAlignedObjectArray< Node * > m_nodes
tPSolverArray m_psequence
tPSolverArray m_dsequence
tVSolverArray m_vsequence
virtual btScalar Eval(const btVector3 &x)=0
virtual void Prepare(btScalar dt, int iterations)
void Solve(btScalar dt, btScalar sor)
void Prepare(btScalar dt, int iterations)
void Terminate(btScalar dt)
RayFromToCaster takes a ray from, ray to (instead of direction!)
RayFromToCaster(const btVector3 &rayFrom, const btVector3 &rayTo, btScalar mxt)
void Process(const btDbvtNode *leaf)
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)
btVector3 m_rayNormalizedDirection
btScalar m_element_measure
@ V_TwoSided
Vertex normals are oriented toward velocity.
@ V_OneSided
Vertex normals are flipped to match velocity and lift and drag forces are applied.
@ V_TwoSidedLiftDrag
Vertex normals are flipped to match velocity.
@ F_OneSided
Face normals are flipped to match velocity and lift and drag forces are applied.
@ F_TwoSided
Vertex normals are taken as it is.
@ F_TwoSidedLiftDrag
Face normals are flipped to match velocity.
@ RContacts
Anchor solver.
@ SContacts
Rigid contacts solver.
@ SDF_RDN
GJK based Multibody vs. deformable face.
@ VF_SS
Rigid versus soft mask.
@ Default
SDF based Rigid vs. deformable node.
@ VF_DD
Cluster soft body self collision.
@ CL_SS
Vertex vs face soft vs soft handling.
@ CL_SELF
Cluster vs cluster soft vs soft handling.
@ SVSmask
rigid vs deformable
@ SDF_RS
Rigid versus soft mask.
@ SDF_RD
Cluster vs convex rigid vs soft.
@ SDF_RDF
Rigid versus deformable face mask.
@ SDF_MDF
GJK based Rigid vs. deformable face.
@ CL_RS
SDF based rigid vs soft.
@ Default
Enable debug draw.
const btCollisionObject * m_colObj
eFeature::_ feature
soft body
btScalar fraction
feature index
void ProcessColObj(btSoftBody *ps, const btCollisionObjectWrapper *colObWrap)
void ProcessSoftSoft(btSoftBody *psa, btSoftBody *psb)
btRigidBody * m_rigidBody
const btCollisionObjectWrapper * m_colObj1Wrap
btRigidBody * m_rigidBody
const btCollisionObjectWrapper * m_colObj1Wrap
btRigidBody * m_rigidBody
const btCollisionObjectWrapper * m_colObj1Wrap
btScalar Evaluate(const btVector3 &x, const btCollisionShape *shape, btVector3 &normal, btScalar margin)