diff options
Diffstat (limited to 'extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp')
-rw-r--r-- | extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp index 1e26be531c2..f4324c1f401 100644 --- a/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp +++ b/extern/bullet2/src/BulletCollision/CollisionShapes/btConvexPolyhedron.cpp @@ -274,23 +274,29 @@ void btConvexPolyhedron::initialize() #endif } - -void btConvexPolyhedron::project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const +void btConvexPolyhedron::project(const btTransform& trans, const btVector3& dir, btScalar& minProj, btScalar& maxProj, btVector3& witnesPtMin,btVector3& witnesPtMax) const { - min = FLT_MAX; - max = -FLT_MAX; + minProj = FLT_MAX; + maxProj = -FLT_MAX; int numVerts = m_vertices.size(); for(int i=0;i<numVerts;i++) { btVector3 pt = trans * m_vertices[i]; btScalar dp = pt.dot(dir); - if(dp < min) min = dp; - if(dp > max) max = dp; + if(dp < minProj) + { + minProj = dp; + witnesPtMin = pt; + } + if(dp > maxProj) + { + maxProj = dp; + witnesPtMax = pt; + } } - if(min>max) + if(minProj>maxProj) { - btScalar tmp = min; - min = max; - max = tmp; + btSwap(minProj,maxProj); + btSwap(witnesPtMin,witnesPtMax); } -}
\ No newline at end of file +} |