Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorErwin Coumans <blender@erwincoumans.com>2006-06-15 17:39:05 +0400
committerErwin Coumans <blender@erwincoumans.com>2006-06-15 17:39:05 +0400
commit986f999671bad332b6bedc9e5ec8160d71cb515a (patch)
treef1a2f6ddffb8e5fad3939055a6a9aac90e8472cd /extern
parenta31829fe2044c9be14b93c0a2d260a159adb95e5 (diff)
try to catch error/ freezing reported on OSX
Diffstat (limited to 'extern')
-rw-r--r--extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp41
1 files changed, 40 insertions, 1 deletions
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp
index 2cdf2ff074f..bcaf84a87c2 100644
--- a/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp
+++ b/extern/bullet/Bullet/NarrowPhaseCollision/GjkPairDetector.cpp
@@ -21,8 +21,11 @@ subject to the following restrictions:
static const SimdScalar rel_error = SimdScalar(1.0e-5);
SimdScalar rel_error2 = rel_error * rel_error;
float maxdist2 = 1.e30f;
+#include <stdio.h>
+int gGjkMaxIter=1000;
+bool gIrregularCatch = true;
GjkPairDetector::GjkPairDetector(ConvexShape* objectA,ConvexShape* objectB,SimplexSolverInterface* simplexSolver,ConvexPenetrationDepthSolver* penetrationDepthSolver)
:m_cachedSeparatingAxis(0.f,0.f,1.f),
@@ -50,6 +53,8 @@ void GjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& ou
marginB = 0.f;
}
+int curIter = 0;
+
bool isValid = false;
bool checkSimplex = false;
bool checkPenetration = true;
@@ -66,6 +71,7 @@ void GjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& ou
while (true)
{
+
SimdVector3 seperatingAxisInA = (-m_cachedSeparatingAxis)* input.m_transformA.getBasis();
SimdVector3 seperatingAxisInB = m_cachedSeparatingAxis* input.m_transformB.getBasis();
@@ -120,7 +126,7 @@ void GjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& ou
break;
}
bool check = (!m_simplexSolver->fullSimplex());
- //&& squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex());
+ //bool check = (!m_simplexSolver->fullSimplex() && squaredDistance > SIMD_EPSILON * m_simplexSolver->maxVertex());
if (!check)
{
@@ -128,6 +134,39 @@ void GjkPairDetector::GetClosestPoints(const ClosestPointInput& input,Result& ou
m_simplexSolver->backup_closest(m_cachedSeparatingAxis);
break;
}
+
+ //rare failure case, perhaps deferate shapes?
+ if (curIter++ > gGjkMaxIter)
+ {
+
+#define CATCH_ME 1
+#ifdef CATCH_ME
+//this should not happen, we need to catch it
+//#if defined(DEBUG) || defined (_DEBUG)
+ if (gIrregularCatch)
+ {
+ gIrregularCatch = false;
+
+ printf("GjkPairDetector maxIter exceeded:%i\n",curIter);
+ printf("sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
+ m_cachedSeparatingAxis.getX(),
+ m_cachedSeparatingAxis.getY(),
+ m_cachedSeparatingAxis.getZ(),
+ squaredDistance,
+ m_minkowskiA->GetShapeType(),
+ m_minkowskiB->GetShapeType());
+
+ printf("If you can reproduce this, please email bugs@continuousphysics.com\n");
+ printf("Please include above information, your Platform, version of OS.\n");
+ printf("Thanks.\n");
+ }
+//#endif
+#endif //CATCH_ME
+
+ break;
+
+ }
+
}
if (checkSimplex)