23#if defined(DEBUG) || defined (_DEBUG)
27#include <spu_printf.h>
28#define printf spu_printf
33#ifdef BT_USE_DOUBLE_PRECISION
34 #define REL_ERROR2 btScalar(1.0e-12)
37 #define REL_ERROR2 btScalar(1.0e-6)
101 localTransA.
getOrigin() -= positionOffset;
102 localTransB.
getOrigin() -= positionOffset;
119 int gGjkMaxIter = 1000;
122 bool isValid =
false;
123 bool checkSimplex =
false;
124 bool checkPenetration =
true;
133 btScalar margin = marginA + marginB;
180 btScalar f0 = squaredDistance - delta;
216 btScalar previousSquaredDistance = squaredDistance;
217 squaredDistance = newCachedSeparatingAxis.
length2();
220 if (squaredDistance>previousSquaredDistance)
223 squaredDistance = previousSquaredDistance;
224 checkSimplex =
false;
233 if (previousSquaredDistance - squaredDistance <=
SIMD_EPSILON * previousSquaredDistance)
247 #if defined(DEBUG) || defined (_DEBUG)
249 printf(
"btGjkPairDetector maxIter exceeded:%i\n",
m_curIter);
250 printf(
"sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
298 distance = ((
btScalar(1.)/rlen) - margin);
308 bool catchDegeneratePenetrationCase =
312 if (checkPenetration && (!isValid || catchDegeneratePenetrationCase ))
328 localTransA,localTransB,
336 btVector3 tmpNormalInB = tmpPointOnB-tmpPointOnA;
346 tmpNormalInB /=
btSqrt(lenSqr);
350 if (!isValid || (distance2 < distance))
352 distance = distance2;
353 pointOnA = tmpPointOnA;
354 pointOnB = tmpPointOnB;
355 normalInB = tmpNormalInB;
381 if (!isValid || (distance2 < distance))
383 distance = distance2;
384 pointOnA = tmpPointOnA;
385 pointOnB = tmpPointOnB;
431 d1 = (-normalInB).
dot(w);
445 d0 = normalInB.
dot(w);
456 pointOnB+positionOffset,
int gNumDeepPenetrationChecks
btScalar gGjkEpaPenetrationTolerance
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btScalar btSqrt(btScalar y)
#define btSimplexSolverInterface
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
const btConvexShape * m_minkowskiB
const btConvexShape * m_minkowskiA
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
int m_fixContactNormalDirection
btScalar m_cachedSeparatingDistance
btSimplexSolverInterface * m_simplexSolver
btVector3 m_cachedSeparatingAxis
void getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw)
btConvexPenetrationDepthSolver * m_penetrationDepthSolver
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
btVector3 can be used to represent 3D points and vectors.
btScalar dot(const btVector3 &v) const
Return the dot product.
btScalar length2() const
Return the length of the vector squared.
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.