30 :m_simplexSolver(simplexSolver),
31 m_penetrationDepthSolver(penetrationDepthSolver),
32 m_convexA(convexA),m_convexB1(convexB),m_planeShape(0)
39 m_penetrationDepthSolver(0),
40 m_convexA(convexA),m_convexB1(0),m_planeShape(plane)
47 #define MAX_ITERATIONS 64
57 input.m_transformB = transB;
58 gjk.getClosestPoints(input,pointCollector,0);
70 convexInPlaneTrans= transB.
inverse() * convexWorldTransform;
72 planeInConvex= convexWorldTransform.
inverse() * transB;
76 btVector3 vtxInPlane = convexInPlaneTrans(vtx);
77 btScalar distance = (planeNormal.
dot(vtxInPlane) - planeConstant);
79 btVector3 vtxInPlaneProjected = vtxInPlane - distance*planeNormal;
80 btVector3 vtxInPlaneWorld = transB * vtxInPlaneProjected;
100 btVector3 linVelA,angVelA,linVelB,angVelB;
108 btScalar maxAngularProjectedVelocity = angVelA.
length() * boundingRadiusA + angVelB.
length() * boundingRadiusB;
113 if ((relLinVelocLength+maxAngularProjectedVelocity) == 0.f)
125 bool hasResult =
false;
153 btScalar projectedLinearVelocity = relLinVel.
dot(n);
154 if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=
SIMD_EPSILON)
158 while (dist > radius)
166 projectedLinearVelocity = relLinVel.
dot(n);
170 if ((projectedLinearVelocity+ maxAngularProjectedVelocity)<=
SIMD_EPSILON)
173 dLambda = dist / (projectedLinearVelocity+ maxAngularProjectedVelocity);
177 lambda = lambda + dLambda;
187 if (lambda <= lastLambda)
198 btTransform interpolatedTransA,interpolatedTransB,relativeTrans;
202 relativeTrans = interpolatedTransB.
inverseTimes(interpolatedTransA);
226 if (numIter > maxIter)
void computeClosestPoints(const btTransform &transA, const btTransform &transB, struct btPointCollector &pointCollector)
btScalar length(const btQuaternion &q)
Return the length of a quaternion.
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const =0
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
float dist(const Point3 &pnt0, const Point3 &pnt1)
ConvexPenetrationDepthSolver provides an interface for penetration depth calculation.
const btVector3 & getPlaneNormal() const
btScalar dot(const btVector3 &v) const
Return the dot product.
#define MAX_ITERATIONS
This maximum should not be necessary.
The btConvexShape is an abstract shape interface, implemented by all convex shapes such as btBoxShape...
btScalar m_allowedPenetration
virtual void DebugDraw(btScalar fraction)
btIDebugDraw * m_debugDrawer
RayResult stores the closest result alternatively, add a callback method to decide about closest/all ...
#define btSimplexSolverInterface
btSimplexSolverInterface * m_simplexSolver
btScalar length() const
Return the length of the vector.
const btConvexShape * m_convexA
virtual btScalar getMargin() const =0
btConvexPenetrationDepthSolver * m_penetrationDepthSolver
virtual btScalar getAngularMotionDisc() const
getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of...
btVector3 can be used to represent 3D points and vectors.
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
virtual bool calcTimeOfImpact(const btTransform &fromA, const btTransform &toA, const btTransform &fromB, const btTransform &toB, CastResult &result)
cast a convex against another convex object
btGjkPairDetector uses GJK to implement the btDiscreteCollisionDetectorInterface
const btConvexShape * m_convexB1
btContinuousConvexCollision(const btConvexShape *shapeA, const btConvexShape *shapeB, btSimplexSolverInterface *simplexSolver, btConvexPenetrationDepthSolver *penetrationDepthSolver)
The btStaticPlaneShape simulates an infinite non-moving (static) collision plane. ...
virtual void drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color)
virtual void reportFailure(int errNo, int numIterations)
btVector3 m_normalOnBInWorld
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
const btScalar & getPlaneConstant() const
const btStaticPlaneShape * m_planeShape