22#define NUM_UNITSPHERE_POINTS 42
36 btIntermediateResult() : m_hasResult(
false)
45 virtual void setShapeIdentifiersA(
int partId0,
int index0)
50 virtual void setShapeIdentifiersB(
int partId1,
int index1)
57 m_normalOnBInWorld = normalOnBInWorld;
58 m_pointInWorld = pointInWorld;
68 btVector3 separatingAxisInA, separatingAxisInB;
72#define USE_BATCHED_SUPPORT 1
74#ifdef USE_BATCHED_SUPPORT
84 for (i = 0; i < numSampleDirections; i++)
87 separatingAxisInABatch[i] = (-norm) * transA.
getBasis();
88 separatingAxisInBBatch[i] = norm * transB.
getBasis();
95 for (
int i = 0; i < numPDA; i++)
101 separatingAxisInABatch[numSampleDirections] = (-norm) * transA.
getBasis();
102 separatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
103 numSampleDirections++;
112 for (
int i = 0; i < numPDB; i++)
118 separatingAxisInABatch[numSampleDirections] = (-norm) * transA.
getBasis();
119 separatingAxisInBBatch[numSampleDirections] = norm * transB.
getBasis();
120 numSampleDirections++;
128 for (i = 0; i < numSampleDirections; i++)
137 separatingAxisInA = separatingAxisInABatch[i];
138 separatingAxisInB = separatingAxisInBBatch[i];
140 pInA = supportVerticesABatch[i];
141 qInB = supportVerticesBBatch[i];
143 pWorld = transA(pInA);
144 qWorld = transB(qInB);
172 for (
int i = 0; i < numPDA; i++)
178 numSampleDirections++;
187 for (
int i = 0; i < numPDB; i++)
193 numSampleDirections++;
199 for (
int i = 0; i < numSampleDirections; i++)
202 separatingAxisInA = (-norm) * transA.
getBasis();
203 separatingAxisInB = norm * transB.
getBasis();
206 pWorld = transA(pInA);
207 qWorld = transB(qInB);
237 debugDraw->
drawLine(minA, minB, color);
241 debugDraw->
drawLine(minA, minA + (minNorm * minProj), color);
261 btIntermediateResult res;
265 btScalar correctedMinNorm = minProj - res.m_depth;
269 minNorm *= penetration_relaxation;
273 pa = res.m_pointInWorld - minNorm * correctedMinNorm;
274 pb = res.m_pointInWorld;
285 return res.m_hasResult;
335 return sPenetrationDirections;
#define MAX_PREFERRED_PENETRATION_DIRECTIONS
#define NUM_UNITSPHERE_POINTS
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
#define btSimplexSolverInterface
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
btScalar getMarginNonVirtual() const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const =0
virtual int getNumPreferredPenetrationDirections() const =0
btVector3 localGetSupportVertexWithoutMarginNonVirtual(const btVector3 &vec) const
virtual void getPreferredPenetrationDirection(int index, btVector3 &penetrationVector) const =0
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
virtual void getClosestPoints(const ClosestPointInput &input, Result &output, class btIDebugDraw *debugDraw, bool swapResults=false)
void setCachedSeparatingAxis(const btVector3 &separatingAxis)
The btIDebugDraw interface class allows hooking up a debug renderer to visually debug simulations.
virtual void drawLine(const btVector3 &from, const btVector3 &to, const btVector3 &color)=0
static btVector3 * getPenetrationDirections()
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)
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.