22 #define NUM_UNITSPHERE_POINTS 42
40 btIntermediateResult():m_hasResult(
false)
49 virtual void setShapeIdentifiersA(
int partId0,
int index0)
54 virtual void setShapeIdentifiersB(
int partId1,
int index1)
61 m_normalOnBInWorld = normalOnBInWorld;
62 m_pointInWorld = pointInWorld;
72 btVector3 seperatingAxisInA,seperatingAxisInB;
76 #define USE_BATCHED_SUPPORT 1
78 #ifdef USE_BATCHED_SUPPORT
88 for (i=0;i<numSampleDirections;i++)
91 seperatingAxisInABatch[i] = (-
norm) * transA.
getBasis() ;
92 seperatingAxisInBBatch[i] = norm * transB.
getBasis() ;
99 for (
int i=0;i<numPDA;i++)
105 seperatingAxisInABatch[numSampleDirections] = (-
norm) * transA.
getBasis();
106 seperatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
107 numSampleDirections++;
116 for (
int i=0;i<numPDB;i++)
122 seperatingAxisInABatch[numSampleDirections] = (-
norm) * transA.
getBasis();
123 seperatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
124 numSampleDirections++;
135 for (i=0;i<numSampleDirections;i++)
145 seperatingAxisInA = seperatingAxisInABatch[i];
146 seperatingAxisInB = seperatingAxisInBBatch[i];
148 pInA = supportVerticesABatch[i];
149 qInB = supportVerticesBBatch[i];
151 pWorld = transA(pInA);
152 qWorld = transB(qInB);
180 for (
int i=0;i<numPDA;i++)
186 numSampleDirections++;
195 for (
int i=0;i<numPDB;i++)
201 numSampleDirections++;
207 for (
int i=0;i<numSampleDirections;i++)
211 seperatingAxisInB = norm* transB.
getBasis();
214 pWorld = transA(pInA);
215 qWorld = transB(qInB);
227 #endif //USE_BATCHED_SUPPORT
249 debugDraw->
drawLine(minA,minB,color);
253 debugDraw->
drawLine(minA,minA+(minNorm*minProj),color);
278 btIntermediateResult res;
282 btScalar correctedMinNorm = minProj - res.m_depth;
287 minNorm*=penetration_relaxation;
293 pa = res.m_pointInWorld - minNorm * correctedMinNorm;
294 pb = res.m_pointInWorld;
307 return res.m_hasResult;
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)
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
static btVector3 * getPenetrationDirections()
virtual void getPreferredPenetrationDirection(int index, btVector3 &penetrationVector) const =0
btVector3 localGetSupportVertexWithoutMarginNonVirtual(const btVector3 &vec) const
btScalar getMarginNonVirtual() const
btScalar dot(const btVector3 &v) const
Return the dot product.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
static btVector3 sPenetrationDirections[NUM_UNITSPHERE_POINTS+MAX_PREFERRED_PENETRATION_DIRECTIONS *2]
#define btSimplexSolverInterface
virtual int getNumPreferredPenetrationDirections() const =0
#define MAX_PREFERRED_PENETRATION_DIRECTIONS
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations...
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const =0
float norm(const Quat &quat)
btVector3 can be used to represent 3D points and vectors.
btScalar length2() const
Return the length of the vector squared.
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
void setCachedSeperatingAxis(const btVector3 &seperatingAxis)
#define NUM_UNITSPHERE_POINTS
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)