Added Dantzig MLCP solver option from Open Dynamics Engine (trying to avoid naming/linking conflicts in case ODE and Bullet is used together)
If an MLCP solver fails, use PGS/SI fallback, add a boolean return value for 'solve' method
This commit is contained in:
@@ -131,46 +131,10 @@ struct btMatrixX
|
||||
{
|
||||
if (m_storage[col+row*m_cols]==0.f)
|
||||
{
|
||||
|
||||
|
||||
m_rowNonZeroElements1[row].push_back(col);
|
||||
m_colNonZeroElements[col].push_back(row);
|
||||
/*
|
||||
//we need to keep the m_rowNonZeroElements1/m_colNonZeroElements arrays sorted (it is too slow, so commented out)
|
||||
int f=0;
|
||||
int l=0;
|
||||
m_rowNonZeroElements1[row].findBinarySearch(col,&f,&l);
|
||||
// btAssert(f==l);
|
||||
if (f<m_rowNonZeroElements1[row].size()-1)
|
||||
{
|
||||
m_rowNonZeroElements1[row].expandNonInitializing();
|
||||
for (int j=m_rowNonZeroElements1[row].size()-1;j>f;j--)
|
||||
m_rowNonZeroElements1[row][j] = m_rowNonZeroElements1[row][j-1];
|
||||
m_rowNonZeroElements1[row][f] = col;
|
||||
} else
|
||||
{
|
||||
m_rowNonZeroElements1[row].push_back(col);
|
||||
}
|
||||
m_colNonZeroElements[col].findBinarySearch(row,&f,&l);
|
||||
// btAssert(f==l);
|
||||
if (f<m_colNonZeroElements[col].size()-1)
|
||||
{
|
||||
m_colNonZeroElements[col].expandNonInitializing();
|
||||
for (int j=m_colNonZeroElements[col].size()-1;j>f;j++)
|
||||
m_colNonZeroElements[col][j-1] = m_colNonZeroElements[col][j];
|
||||
m_colNonZeroElements[col][f] = row;
|
||||
} else
|
||||
{
|
||||
m_colNonZeroElements[col].push_back(row);
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
m_storage[row*m_cols+col] = val;
|
||||
} else
|
||||
{
|
||||
|
||||
}
|
||||
m_storage[row*m_cols+col] = val;
|
||||
}
|
||||
}
|
||||
const T& operator() (int row,int col) const
|
||||
|
||||
@@ -257,10 +257,12 @@ inline int btGetVersion()
|
||||
|
||||
///The btScalar type abstracts floating point numbers, to easily switch between double and single floating point precision.
|
||||
#if defined(BT_USE_DOUBLE_PRECISION)
|
||||
|
||||
typedef double btScalar;
|
||||
//this number could be bigger in double precision
|
||||
#define BT_LARGE_FLOAT 1e30
|
||||
#else
|
||||
|
||||
typedef float btScalar;
|
||||
//keep BT_LARGE_FLOAT*BT_LARGE_FLOAT < FLT_MAX
|
||||
#define BT_LARGE_FLOAT 1e18f
|
||||
@@ -412,15 +414,15 @@ SIMD_FORCE_INLINE btScalar btFmod(btScalar x,btScalar y) { return fmodf(x,y); }
|
||||
|
||||
#endif
|
||||
|
||||
#define SIMD_2_PI btScalar(6.283185307179586232)
|
||||
#define SIMD_PI (SIMD_2_PI * btScalar(0.5))
|
||||
#define SIMD_HALF_PI (SIMD_2_PI * btScalar(0.25))
|
||||
#define SIMD_PI btScalar(3.1415926535897932384626433832795029)
|
||||
#define SIMD_2_PI btScalar(2.0) * SIMD_PI
|
||||
#define SIMD_HALF_PI (SIMD_PI * btScalar(0.5))
|
||||
#define SIMD_RADS_PER_DEG (SIMD_2_PI / btScalar(360.0))
|
||||
#define SIMD_DEGS_PER_RAD (btScalar(360.0) / SIMD_2_PI)
|
||||
#define SIMDSQRT12 btScalar(0.7071067811865475244008443621048490)
|
||||
|
||||
#define btRecipSqrt(x) ((btScalar)(btScalar(1.0)/btSqrt(btScalar(x)))) /* reciprocal square root */
|
||||
|
||||
#define btRecip(x) (btScalar(1.0)/btScalar(x))
|
||||
|
||||
#ifdef BT_USE_DOUBLE_PRECISION
|
||||
#define SIMD_EPSILON DBL_EPSILON
|
||||
@@ -622,6 +624,35 @@ SIMD_FORCE_INLINE void btSetZero(T* a, int n)
|
||||
--ncurr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SIMD_FORCE_INLINE btScalar btLargeDot(const btScalar *a, const btScalar *b, int n)
|
||||
{
|
||||
btScalar p0,q0,m0,p1,q1,m1,sum;
|
||||
sum = 0;
|
||||
n -= 2;
|
||||
while (n >= 0) {
|
||||
p0 = a[0]; q0 = b[0];
|
||||
m0 = p0 * q0;
|
||||
p1 = a[1]; q1 = b[1];
|
||||
m1 = p1 * q1;
|
||||
sum += m0;
|
||||
sum += m1;
|
||||
a += 2;
|
||||
b += 2;
|
||||
n -= 2;
|
||||
}
|
||||
n += 2;
|
||||
while (n > 0) {
|
||||
sum += (*a) * (*b);
|
||||
a++;
|
||||
b++;
|
||||
n--;
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
// returns normalized value in range [-SIMD_PI, SIMD_PI]
|
||||
SIMD_FORCE_INLINE btScalar btNormalizeAngle(btScalar angleInRadians)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user