23 #if defined(DEBUG) || defined (_DEBUG) 27 #include <spu_printf.h> 28 #define printf spu_printf 33 #define REL_ERROR2 btScalar(1.0e-6) 42 m_penetrationDepthSolver(penetrationDepthSolver),
43 m_simplexSolver(simplexSolver),
44 m_minkowskiA(objectA),
45 m_minkowskiB(objectB),
46 m_shapeTypeA(objectA->getShapeType()),
47 m_shapeTypeB(objectB->getShapeType()),
48 m_marginA(objectA->getMargin()),
49 m_marginB(objectB->getMargin()),
50 m_ignoreMargin(false),
52 m_catchDegeneracies(1),
53 m_fixContactNormalDirection(1)
95 localTransA.
getOrigin() -= positionOffset;
96 localTransB.
getOrigin() -= positionOffset;
113 int gGjkMaxIter = 1000;
116 bool isValid =
false;
117 bool checkSimplex =
false;
118 bool checkPenetration =
true;
127 btScalar margin = marginA + marginB;
174 btScalar f0 = squaredDistance - delta;
210 btScalar previousSquaredDistance = squaredDistance;
211 squaredDistance = newCachedSeparatingAxis.
length2();
213 if (squaredDistance>previousSquaredDistance)
217 squaredDistance = previousSquaredDistance;
218 checkSimplex =
false;
227 if (previousSquaredDistance - squaredDistance <=
SIMD_EPSILON * previousSquaredDistance)
241 #if defined(DEBUG) || defined (_DEBUG) 243 printf(
"btGjkPairDetector maxIter exceeded:%i\n",
m_curIter);
244 printf(
"sepAxis=(%f,%f,%f), squaredDistance = %f, shapeTypeA=%i,shapeTypeB=%i\n",
292 distance = ((
btScalar(1.)/rlen) - margin);
302 bool catchDegeneratePenetrationCase =
306 if (checkPenetration && (!isValid || catchDegeneratePenetrationCase ))
322 localTransA,localTransB,
330 btVector3 tmpNormalInB = tmpPointOnB-tmpPointOnA;
338 if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON))
340 tmpNormalInB /=
btSqrt(lenSqr);
343 if (!isValid || (distance2 < distance))
345 distance = distance2;
346 pointOnA = tmpPointOnA;
347 pointOnB = tmpPointOnB;
348 normalInB = tmpNormalInB;
374 if (!isValid || (distance2 < distance))
376 distance = distance2;
377 pointOnA = tmpPointOnA;
378 pointOnB = tmpPointOnB;
408 pointOnB+positionOffset,
btConvexPenetrationDepthSolver * m_penetrationDepthSolver
btVector3 m_cachedSeparatingAxis
btSimplexSolverInterface * m_simplexSolver
btGjkPairDetector(const btConvexShape *objectA, const btConvexShape *objectB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
btScalar m_cachedSeparatingDistance
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
btScalar length2() const
Return the length of the vector squared.
btScalar btSqrt(btScalar y)
const btScalar & getY() const
Return the y value.
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
int gNumDeepPenetrationChecks
const btScalar & getZ() const
Return the z value.
virtual bool calcPenDepth(btSimplexSolverInterface &simplexSolver, const btConvexShape *convexA, const btConvexShape *convexB, const btTransform &transA, const btTransform &transB, btVector3 &v, btVector3 &pa, btVector3 &pb, class btIDebugDraw *debugDraw)=0
#define btSimplexSolverInterface
btScalar dot(const btVector3 &v) const
Return the dot product.
int m_fixContactNormalDirection
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
const btConvexShape * m_minkowskiB
btVector3 can be used to represent 3D points and vectors.
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)=0
btVector3 localGetSupportVertexWithoutMarginNonVirtual(const btVector3 &vec) const
const btConvexShape * m_minkowskiA
const btScalar & getX() const
Return the x value.
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
void getClosestPointsNonVirtual(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw)