23 #define NUM_UNITSPHERE_POINTS 42
84 btIntermediateResult():m_hasResult(
false)
93 virtual void setShapeIdentifiersA(
int partId0,
int index0)
99 virtual void setShapeIdentifiersB(
int partId1,
int index1)
106 m_normalOnBInWorld = normalOnBInWorld;
107 m_pointInWorld = pointInWorld;
118 btVector3 seperatingAxisInA,seperatingAxisInB;
122 #ifdef USE_BATCHED_SUPPORT
132 for (i=0;i<numSampleDirections;i++)
135 seperatingAxisInABatch[i] = (-
norm) * transA.
getBasis() ;
136 seperatingAxisInBBatch[i] = norm * transB.
getBasis() ;
143 for (
int i=0;i<numPDA;i++)
148 sPenetrationDirections[numSampleDirections] =
norm;
149 seperatingAxisInABatch[numSampleDirections] = (-
norm) * transA.
getBasis();
150 seperatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
151 numSampleDirections++;
160 for (
int i=0;i<numPDB;i++)
165 sPenetrationDirections[numSampleDirections] =
norm;
166 seperatingAxisInABatch[numSampleDirections] = (-
norm) * transA.
getBasis();
167 seperatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
168 numSampleDirections++;
178 for (i=0;i<numSampleDirections;i++)
181 seperatingAxisInA = seperatingAxisInABatch[i];
182 seperatingAxisInB = seperatingAxisInBBatch[i];
184 pInA = supportVerticesABatch[i];
185 qInB = supportVerticesBBatch[i];
187 pWorld = transA(pInA);
188 qWorld = transB(qInB);
205 #define DO_PREFERRED_DIRECTIONS 1
206 #ifdef DO_PREFERRED_DIRECTIONS
211 for (
int i=0;i<numPDA;i++)
216 sPenetrationDirections[numSampleDirections] =
norm;
217 numSampleDirections++;
226 for (
int i=0;i<numPDB;i++)
231 sPenetrationDirections[numSampleDirections] =
norm;
232 numSampleDirections++;
236 #endif //DO_PREFERRED_DIRECTIONS
238 for (
int i=0;i<numSampleDirections;i++)
242 seperatingAxisInB = norm* transB.
getBasis();
250 pWorld = transA(pInA);
251 qWorld = transB(qInB);
263 #endif //USE_BATCHED_SUPPORT
267 minA += minNorm*marginA;
268 minB -= minNorm*marginB;
273 minProj += (marginA + marginB) +
btScalar(1.00);
284 debugDraw->
drawLine(minA,minB,color);
288 debugDraw->
drawLine(minA,minA+(minNorm*minProj),color);
312 btIntermediateResult res;
315 btScalar correctedMinNorm = minProj - res.m_depth;
320 minNorm*=penetration_relaxation;
325 pa = res.m_pointInWorld - minNorm * correctedMinNorm;
326 pb = res.m_pointInWorld;
341 return res.m_hasResult;
int spuGetNumPreferredPenetrationDirections(int shapeType, void *shape)
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
virtual void getPreferredPenetrationDirection(int index, btVector3 &penetrationVector) const =0
btVector3 localGetSupportVertexWithoutMarginNonVirtual(const btVector3 &vec) 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.
void spuGetPreferredPenetrationDirection(int shapeType, void *shape, int index, btVector3 &penetrationVector)
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
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 getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
#define NUM_UNITSPHERE_POINTS