parent
1538b870f1
commit
b958e8a236
|
@ -20,7 +20,7 @@ Files extracted from upstream source:
|
|||
## bullet
|
||||
|
||||
- Upstream: https://github.com/bulletphysics/bullet3
|
||||
- Version: 3.24 (7dee3436e747958e7088dfdcea0e4ae031ce619e, 2022)
|
||||
- Version: 3.25 (2c204c49e56ed15ec5fcfa71d199ab6d6570b3f5, 2022)
|
||||
- License: zlib
|
||||
|
||||
Files extracted from upstream source:
|
||||
|
@ -29,8 +29,6 @@ Files extracted from upstream source:
|
|||
and CMakeLists.txt and premake4.lua files
|
||||
- `LICENSE.txt`, and `VERSION` as `VERSION.txt`
|
||||
|
||||
Includes some patches in the `patches` folder which have been sent upstream.
|
||||
|
||||
|
||||
## certs
|
||||
|
||||
|
|
|
@ -103,7 +103,8 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle, int partId,
|
|||
|
||||
if (m_convexBodyWrap->getCollisionShape()->isConvex())
|
||||
{
|
||||
#ifndef BT_DISABLE_CONVEX_CONCAVE_EARLY_OUT
|
||||
#ifdef BT_ENABLE_CONVEX_CONCAVE_EARLY_OUT
|
||||
//todo: check this issue https://github.com/bulletphysics/bullet3/issues/4263
|
||||
//an early out optimisation if the object is separated from the triangle
|
||||
//projected on the triangle normal)
|
||||
{
|
||||
|
@ -139,7 +140,7 @@ void btConvexTriangleCallback::processTriangle(btVector3* triangle, int partId,
|
|||
if (dist > contact_threshold)
|
||||
return;
|
||||
}
|
||||
#endif //BT_DISABLE_CONVEX_CONCAVE_EARLY_OUT
|
||||
#endif //BT_ENABLE_CONVEX_CONCAVE_EARLY_OUT
|
||||
|
||||
btTriangleShape tm(triangle[0], triangle[1], triangle[2]);
|
||||
tm.setMargin(m_collisionMarginTriangle);
|
||||
|
|
|
@ -229,10 +229,12 @@ public:
|
|||
m_min[0] = BT_MIN3(V1[0], V2[0], V3[0]);
|
||||
m_min[1] = BT_MIN3(V1[1], V2[1], V3[1]);
|
||||
m_min[2] = BT_MIN3(V1[2], V2[2], V3[2]);
|
||||
m_min[3] = 0.f;
|
||||
|
||||
m_max[0] = BT_MAX3(V1[0], V2[0], V3[0]);
|
||||
m_max[1] = BT_MAX3(V1[1], V2[1], V3[1]);
|
||||
m_max[2] = BT_MAX3(V1[2], V2[2], V3[2]);
|
||||
m_max[3] = 0.f;
|
||||
}
|
||||
|
||||
btAABB(const btVector3 &V1,
|
||||
|
@ -243,10 +245,12 @@ public:
|
|||
m_min[0] = BT_MIN3(V1[0], V2[0], V3[0]);
|
||||
m_min[1] = BT_MIN3(V1[1], V2[1], V3[1]);
|
||||
m_min[2] = BT_MIN3(V1[2], V2[2], V3[2]);
|
||||
m_min[3] = 0.f;
|
||||
|
||||
m_max[0] = BT_MAX3(V1[0], V2[0], V3[0]);
|
||||
m_max[1] = BT_MAX3(V1[1], V2[1], V3[1]);
|
||||
m_max[2] = BT_MAX3(V1[2], V2[2], V3[2]);
|
||||
m_max[3] = 0.f;
|
||||
|
||||
m_min[0] -= margin;
|
||||
m_min[1] -= margin;
|
||||
|
@ -275,9 +279,11 @@ public:
|
|||
m_min[0] = SIMD_INFINITY;
|
||||
m_min[1] = SIMD_INFINITY;
|
||||
m_min[2] = SIMD_INFINITY;
|
||||
m_min[3] = 0.f;
|
||||
m_max[0] = -SIMD_INFINITY;
|
||||
m_max[1] = -SIMD_INFINITY;
|
||||
m_max[2] = -SIMD_INFINITY;
|
||||
m_max[3] = 0.f;
|
||||
}
|
||||
|
||||
SIMD_FORCE_INLINE void increment_margin(btScalar margin)
|
||||
|
@ -295,10 +301,12 @@ public:
|
|||
m_min[0] = other.m_min[0] - margin;
|
||||
m_min[1] = other.m_min[1] - margin;
|
||||
m_min[2] = other.m_min[2] - margin;
|
||||
m_min[3] = 0.f;
|
||||
|
||||
m_max[0] = other.m_max[0] + margin;
|
||||
m_max[1] = other.m_max[1] + margin;
|
||||
m_max[2] = other.m_max[2] + margin;
|
||||
m_max[3] = 0.f;
|
||||
}
|
||||
|
||||
template <typename CLASS_POINT>
|
||||
|
@ -310,10 +318,12 @@ public:
|
|||
m_min[0] = BT_MIN3(V1[0], V2[0], V3[0]);
|
||||
m_min[1] = BT_MIN3(V1[1], V2[1], V3[1]);
|
||||
m_min[2] = BT_MIN3(V1[2], V2[2], V3[2]);
|
||||
m_min[3] = 0.f;
|
||||
|
||||
m_max[0] = BT_MAX3(V1[0], V2[0], V3[0]);
|
||||
m_max[1] = BT_MAX3(V1[1], V2[1], V3[1]);
|
||||
m_max[2] = BT_MAX3(V1[2], V2[2], V3[2]);
|
||||
m_max[3] = 0.f;
|
||||
}
|
||||
|
||||
template <typename CLASS_POINT>
|
||||
|
@ -325,10 +335,12 @@ public:
|
|||
m_min[0] = BT_MIN3(V1[0], V2[0], V3[0]);
|
||||
m_min[1] = BT_MIN3(V1[1], V2[1], V3[1]);
|
||||
m_min[2] = BT_MIN3(V1[2], V2[2], V3[2]);
|
||||
m_min[3] = 0.f;
|
||||
|
||||
m_max[0] = BT_MAX3(V1[0], V2[0], V3[0]);
|
||||
m_max[1] = BT_MAX3(V1[1], V2[1], V3[1]);
|
||||
m_max[2] = BT_MAX3(V1[2], V2[2], V3[2]);
|
||||
m_max[3] = 0.f;
|
||||
|
||||
m_min[0] -= margin;
|
||||
m_min[1] -= margin;
|
||||
|
|
|
@ -71,8 +71,8 @@ public:
|
|||
const btVector3& normal,
|
||||
btScalar distance) : m_localPointA(pointA),
|
||||
m_localPointB(pointB),
|
||||
m_positionWorldOnB(0,0,0),
|
||||
m_positionWorldOnA(0,0,0),
|
||||
m_positionWorldOnB(0,0,0),
|
||||
m_positionWorldOnA(0,0,0),
|
||||
m_normalWorldOnB(normal),
|
||||
m_distance1(distance),
|
||||
m_combinedFriction(btScalar(0.)),
|
||||
|
@ -95,8 +95,8 @@ public:
|
|||
m_contactERP(0.f),
|
||||
m_frictionCFM(0.f),
|
||||
m_lifeTime(0),
|
||||
m_lateralFrictionDir1(0,0,0),
|
||||
m_lateralFrictionDir2(0,0,0)
|
||||
m_lateralFrictionDir1(0,0,0),
|
||||
m_lateralFrictionDir2(0,0,0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -169,9 +169,12 @@ btVectorXu btLemkeAlgorithm::solve(unsigned int maxloops /* = 0*/)
|
|||
|
||||
/*the column becomes part of the basis*/
|
||||
basis[pivotRowIndex] = pivotColIndexOld;
|
||||
|
||||
pivotRowIndex = findLexicographicMinimum(A, pivotColIndex);
|
||||
|
||||
bool isRayTermination = false;
|
||||
pivotRowIndex = findLexicographicMinimum(A, pivotColIndex, z0Row, isRayTermination);
|
||||
if (isRayTermination)
|
||||
{
|
||||
break; // ray termination
|
||||
}
|
||||
if (z0Row == pivotRowIndex)
|
||||
{ //if z0 leaves the basis the solution is found --> one last elimination step is necessary
|
||||
GaussJordanEliminationStep(A, pivotRowIndex, pivotColIndex, basis);
|
||||
|
@ -217,79 +220,100 @@ btVectorXu btLemkeAlgorithm::solve(unsigned int maxloops /* = 0*/)
|
|||
return solutionVector;
|
||||
}
|
||||
|
||||
int btLemkeAlgorithm::findLexicographicMinimum(const btMatrixXu& A, const int& pivotColIndex)
|
||||
int btLemkeAlgorithm::findLexicographicMinimum(const btMatrixXu& A, const int& pivotColIndex, const int& z0Row, bool& isRayTermination)
|
||||
{
|
||||
int RowIndex = 0;
|
||||
isRayTermination = false;
|
||||
btAlignedObjectArray<int> activeRows;
|
||||
|
||||
bool firstRow = true;
|
||||
btScalar currentMin = 0.0;
|
||||
|
||||
int dim = A.rows();
|
||||
btAlignedObjectArray<btVectorXu> Rows;
|
||||
|
||||
for (int row = 0; row < dim; row++)
|
||||
{
|
||||
btVectorXu vec(dim + 1);
|
||||
vec.setZero(); //, INIT, 0.)
|
||||
Rows.push_back(vec);
|
||||
btScalar a = A(row, pivotColIndex);
|
||||
if (a > 0)
|
||||
{
|
||||
Rows[row][0] = A(row, 2 * dim + 1) / a;
|
||||
Rows[row][1] = A(row, 2 * dim) / a;
|
||||
for (int j = 2; j < dim + 1; j++)
|
||||
Rows[row][j] = A(row, j - 1) / a;
|
||||
const btScalar denom = A(row, pivotColIndex);
|
||||
|
||||
#ifdef BT_DEBUG_OSTREAM
|
||||
// if (DEBUGLEVEL) {
|
||||
// cout << "Rows(" << row << ") = " << Rows[row] << endl;
|
||||
// }
|
||||
#endif
|
||||
if (denom > btMachEps())
|
||||
{
|
||||
const btScalar q = A(row, dim + dim + 1) / denom;
|
||||
if (firstRow)
|
||||
{
|
||||
currentMin = q;
|
||||
activeRows.push_back(row);
|
||||
firstRow = false;
|
||||
}
|
||||
else if (fabs(currentMin - q) < btMachEps())
|
||||
{
|
||||
activeRows.push_back(row);
|
||||
}
|
||||
else if (currentMin > q)
|
||||
{
|
||||
currentMin = q;
|
||||
activeRows.clear();
|
||||
activeRows.push_back(row);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < Rows.size(); i++)
|
||||
if (activeRows.size() == 0)
|
||||
{
|
||||
if (Rows[i].nrm2() > 0.)
|
||||
isRayTermination = true;
|
||||
return 0;
|
||||
}
|
||||
else if (activeRows.size() == 1)
|
||||
{
|
||||
return activeRows[0];
|
||||
}
|
||||
|
||||
// if there are multiple rows, check if they contain the row for z_0.
|
||||
for (int i = 0; i < activeRows.size(); i++)
|
||||
{
|
||||
if (activeRows[i] == z0Row)
|
||||
{
|
||||
int j = 0;
|
||||
for (; j < Rows.size(); j++)
|
||||
{
|
||||
if (i != j)
|
||||
{
|
||||
if (Rows[j].nrm2() > 0.)
|
||||
{
|
||||
btVectorXu test(dim + 1);
|
||||
for (int ii = 0; ii < dim + 1; ii++)
|
||||
{
|
||||
test[ii] = Rows[j][ii] - Rows[i][ii];
|
||||
}
|
||||
|
||||
//=Rows[j] - Rows[i]
|
||||
if (!LexicographicPositive(test))
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (j == Rows.size())
|
||||
{
|
||||
RowIndex += i;
|
||||
break;
|
||||
}
|
||||
return z0Row;
|
||||
}
|
||||
}
|
||||
|
||||
return RowIndex;
|
||||
}
|
||||
// look through the columns of the inverse of the basic matrix from left to right until the tie is broken.
|
||||
for (int col = 0; col < dim ; col++)
|
||||
{
|
||||
btAlignedObjectArray<int> activeRowsCopy(activeRows);
|
||||
activeRows.clear();
|
||||
firstRow = true;
|
||||
for (int i = 0; i<activeRowsCopy.size();i++)
|
||||
{
|
||||
const int row = activeRowsCopy[i];
|
||||
|
||||
bool btLemkeAlgorithm::LexicographicPositive(const btVectorXu& v)
|
||||
{
|
||||
int i = 0;
|
||||
// if (DEBUGLEVEL)
|
||||
// cout << "v " << v << endl;
|
||||
// denom is positive here as an invariant.
|
||||
const btScalar denom = A(row, pivotColIndex);
|
||||
const btScalar ratio = A(row, col) / denom;
|
||||
if (firstRow)
|
||||
{
|
||||
currentMin = ratio;
|
||||
activeRows.push_back(row);
|
||||
firstRow = false;
|
||||
}
|
||||
else if (fabs(currentMin - ratio) < btMachEps())
|
||||
{
|
||||
activeRows.push_back(row);
|
||||
}
|
||||
else if (currentMin > ratio)
|
||||
{
|
||||
currentMin = ratio;
|
||||
activeRows.clear();
|
||||
activeRows.push_back(row);
|
||||
}
|
||||
}
|
||||
|
||||
while (i < v.size() - 1 && fabs(v[i]) < btMachEps())
|
||||
i++;
|
||||
if (v[i] > 0)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
if (activeRows.size() == 1)
|
||||
{
|
||||
return activeRows[0];
|
||||
}
|
||||
}
|
||||
// must not reach here.
|
||||
isRayTermination = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void btLemkeAlgorithm::GaussJordanEliminationStep(btMatrixXu& A, int pivotRowIndex, int pivotColumnIndex, const btAlignedObjectArray<int>& basis)
|
||||
|
|
|
@ -71,8 +71,7 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
int findLexicographicMinimum(const btMatrixXu& A, const int& pivotColIndex);
|
||||
bool LexicographicPositive(const btVectorXu& v);
|
||||
int findLexicographicMinimum(const btMatrixXu& A, const int& pivotColIndex, const int& z0Row, bool& isRayTermination);
|
||||
void GaussJordanEliminationStep(btMatrixXu& A, int pivotRowIndex, int pivotColumnIndex, const btAlignedObjectArray<int>& basis);
|
||||
bool greaterZero(const btVectorXu& vector);
|
||||
bool validBasis(const btAlignedObjectArray<int>& basis);
|
||||
|
|
|
@ -2807,7 +2807,7 @@ bool btSoftBody::checkDeformableContact(const btCollisionObjectWrapper* colObjWr
|
|||
//
|
||||
// Compute barycentric coordinates (u, v, w) for
|
||||
// point p with respect to triangle (a, b, c)
|
||||
static void getBarycentric(const btVector3& p, btVector3& a, btVector3& b, btVector3& c, btVector3& bary)
|
||||
static void getBarycentric(const btVector3& p, const btVector3& a, const btVector3& b, const btVector3& c, btVector3& bary)
|
||||
{
|
||||
btVector3 v0 = b - a, v1 = c - a, v2 = p - a;
|
||||
btScalar d00 = v0.dot(v0);
|
||||
|
@ -2816,8 +2816,17 @@ static void getBarycentric(const btVector3& p, btVector3& a, btVector3& b, btVec
|
|||
btScalar d20 = v2.dot(v0);
|
||||
btScalar d21 = v2.dot(v1);
|
||||
btScalar denom = d00 * d11 - d01 * d01;
|
||||
bary.setY((d11 * d20 - d01 * d21) / denom);
|
||||
bary.setZ((d00 * d21 - d01 * d20) / denom);
|
||||
// In the case of a degenerate triangle, pick a vertex.
|
||||
if (btFabs(denom) < SIMD_EPSILON)
|
||||
{
|
||||
bary.setY(btScalar(0.0));
|
||||
bary.setZ(btScalar(0.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
bary.setY((d11 * d20 - d01 * d21) / denom);
|
||||
bary.setZ((d00 * d21 - d01 * d20) / denom);
|
||||
}
|
||||
bary.setX(btScalar(1) - bary.getY() - bary.getZ());
|
||||
}
|
||||
|
||||
|
|
|
@ -678,7 +678,9 @@ HullError HullLibrary::CreateConvexHull(const HullDesc &desc, // describes the
|
|||
if (vcount < 8) vcount = 8;
|
||||
|
||||
btAlignedObjectArray<btVector3> vertexSource;
|
||||
vertexSource.resize(static_cast<int>(vcount));
|
||||
btVector3 zero;
|
||||
zero.setZero();
|
||||
vertexSource.resize(static_cast<int>(vcount), zero);
|
||||
|
||||
btVector3 scale;
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ subject to the following restrictions:
|
|||
#include <float.h>
|
||||
|
||||
/* SVN $Revision$ on $Date$ from http://bullet.googlecode.com*/
|
||||
#define BT_BULLET_VERSION 324
|
||||
#define BT_BULLET_VERSION 325
|
||||
|
||||
inline int btGetVersion()
|
||||
{
|
||||
|
|
|
@ -481,7 +481,7 @@ public:
|
|||
|
||||
buffer[9] = '3';
|
||||
buffer[10] = '2';
|
||||
buffer[11] = '4';
|
||||
buffer[11] = '5';
|
||||
}
|
||||
|
||||
virtual void startSerialization()
|
||||
|
@ -512,7 +512,7 @@ public:
|
|||
currentPtr += BT_HEADER_LENGTH;
|
||||
for (int i = 0; i < m_chunkPtrs.size(); i++)
|
||||
{
|
||||
int curLength = sizeof(btChunk) + m_chunkPtrs[i]->m_length;
|
||||
int curLength = (int)sizeof(btChunk) + m_chunkPtrs[i]->m_length;
|
||||
memcpy(currentPtr, m_chunkPtrs[i], curLength);
|
||||
btAlignedFree(m_chunkPtrs[i]);
|
||||
currentPtr += curLength;
|
||||
|
|
|
@ -1 +1 @@
|
|||
3.24
|
||||
3.25
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
diff --git a/thirdparty/bullet/BulletSoftBody/btSparseSDF.h b/thirdparty/bullet/BulletSoftBody/btSparseSDF.h
|
||||
index ae1288d9e6..243b80f8ae 100644
|
||||
--- a/thirdparty/bullet/BulletSoftBody/btSparseSDF.h
|
||||
+++ b/thirdparty/bullet/BulletSoftBody/btSparseSDF.h
|
||||
@@ -233,9 +233,9 @@ struct btSparseSdf
|
||||
//int sz = sizeof(Cell);
|
||||
if (ncells > m_clampCells)
|
||||
{
|
||||
- static int numResets = 0;
|
||||
- numResets++;
|
||||
- // printf("numResets=%d\n",numResets);
|
||||
+ //static int numResets = 0;
|
||||
+ //numResets++;
|
||||
+ //printf("numResets=%d\n",numResets);
|
||||
Reset();
|
||||
}
|
||||
|
Loading…
Reference in New Issue