diff options
Diffstat (limited to 'extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp')
-rw-r--r-- | extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp index dc995ca1f72..1ab336b4d54 100644 --- a/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp +++ b/extern/bullet2/src/BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp @@ -28,8 +28,11 @@ m_convexA(convexA),m_convexB(convexB) ///Typically the conservative advancement reaches solution in a few iterations, clip it to 32 for degenerate cases. ///See discussion about this here http://continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=565 +#ifdef BT_USE_DOUBLE_PRECISION +#define MAX_ITERATIONS 64 +#else #define MAX_ITERATIONS 32 - +#endif bool btSubsimplexConvexCast::calcTimeOfImpact( const btTransform& fromA, const btTransform& toA, @@ -52,9 +55,9 @@ bool btSubsimplexConvexCast::calcTimeOfImpact( convex->setTransformB(btTransform(rayFromLocalA.getBasis())); - //float radius = 0.01f; + //btScalar radius = btScalar(0.01); - btScalar lambda = 0.f; + btScalar lambda = btScalar(0.); //todo: need to verify this: //because of minkowski difference, we need the inverse direction @@ -69,27 +72,30 @@ bool btSubsimplexConvexCast::calcTimeOfImpact( int maxIter = MAX_ITERATIONS; btVector3 n; - n.setValue(0.f,0.f,0.f); + n.setValue(btScalar(0.),btScalar(0.),btScalar(0.)); bool hasResult = false; btVector3 c; - float lastLambda = lambda; - + btScalar lastLambda = lambda; - float dist2 = v.length2(); - float epsilon = 0.0001f; + btScalar dist2 = v.length2(); +#ifdef BT_USE_DOUBLE_PRECISION + btScalar epsilon = btScalar(0.0001); +#else + btScalar epsilon = btScalar(0.0001); +#endif //BT_USE_DOUBLE_PRECISION btVector3 w,p; - float VdotR; + btScalar VdotR; while ( (dist2 > epsilon) && maxIter--) { p = convex->localGetSupportingVertex( v); w = x - p; - float VdotW = v.dot(w); + btScalar VdotW = v.dot(w); - if ( VdotW > 0.f) + if ( VdotW > btScalar(0.)) { VdotR = v.dot(r); @@ -117,7 +123,7 @@ bool btSubsimplexConvexCast::calcTimeOfImpact( //printf("numverts = %i\n",m_simplexSolver->numVertices()); } else { - dist2 = 0.f; + dist2 = btScalar(0.); } } |