Fixes for double precision compilation

Thanks to Dennis Cappendijk for the report and fix
See Issue 575
This commit is contained in:
erwin.coumans
2012-02-29 03:50:53 +00:00
parent 0ad2738167
commit b8d293c1fe
6 changed files with 19 additions and 19 deletions

View File

@@ -510,14 +510,14 @@ void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObject*
// Get closest edge // Get closest edge
int bestedge=-1; int bestedge=-1;
float disttobestedge=BT_LARGE_FLOAT; btScalar disttobestedge=BT_LARGE_FLOAT;
// //
// Edge 0 -> 1 // Edge 0 -> 1
if (btFabs(info->m_edgeV0V1Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold) if (btFabs(info->m_edgeV0V1Angle)< triangleInfoMapPtr->m_maxEdgeAngleThreshold)
{ {
btVector3 nearest; btVector3 nearest;
btNearestPointInLineSegment( cp.m_localPointB, v0, v1, nearest ); btNearestPointInLineSegment( cp.m_localPointB, v0, v1, nearest );
float len=(contact-nearest).length(); btScalar len=(contact-nearest).length();
// //
if( len < disttobestedge ) if( len < disttobestedge )
{ {
@@ -530,7 +530,7 @@ void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObject*
{ {
btVector3 nearest; btVector3 nearest;
btNearestPointInLineSegment( cp.m_localPointB, v1, v2, nearest ); btNearestPointInLineSegment( cp.m_localPointB, v1, v2, nearest );
float len=(contact-nearest).length(); btScalar len=(contact-nearest).length();
// //
if( len < disttobestedge ) if( len < disttobestedge )
{ {
@@ -543,7 +543,7 @@ void btAdjustInternalEdgeContacts(btManifoldPoint& cp, const btCollisionObject*
{ {
btVector3 nearest; btVector3 nearest;
btNearestPointInLineSegment( cp.m_localPointB, v2, v0, nearest ); btNearestPointInLineSegment( cp.m_localPointB, v2, v0, nearest );
float len=(contact-nearest).length(); btScalar len=(contact-nearest).length();
// //
if( len < disttobestedge ) if( len < disttobestedge )
{ {

View File

@@ -208,7 +208,7 @@ const char* btConvexHullShape::serialize(void* dataBuffer, btSerializer* seriali
return "btConvexHullShapeData"; return "btConvexHullShapeData";
} }
void btConvexHullShape::project(const btTransform& trans, const btVector3& dir, float& min, float& max) const void btConvexHullShape::project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const
{ {
#if 1 #if 1
min = FLT_MAX; min = FLT_MAX;
@@ -221,7 +221,7 @@ void btConvexHullShape::project(const btTransform& trans, const btVector3& dir,
{ {
btVector3 vtx = m_unscaledPoints[i] * m_localScaling; btVector3 vtx = m_unscaledPoints[i] * m_localScaling;
btVector3 pt = trans * vtx; btVector3 pt = trans * vtx;
float dp = pt.dot(dir); btScalar dp = pt.dot(dir);
if(dp < min) if(dp < min)
{ {
min = dp; min = dp;
@@ -244,7 +244,7 @@ void btConvexHullShape::project(const btTransform& trans, const btVector3& dir,
if(min>max) if(min>max)
{ {
float tmp = min; btScalar tmp = min;
min = max; min = max;
max = tmp; max = tmp;
} }

View File

@@ -73,7 +73,7 @@ public:
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const; virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
virtual void project(const btTransform& trans, const btVector3& dir, float& min, float& max) const; virtual void project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const;
//debugging //debugging

View File

@@ -43,7 +43,7 @@ btConvexShape::~btConvexShape()
} }
void btConvexShape::project(const btTransform& trans, const btVector3& dir, float& min, float& max) const void btConvexShape::project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const
{ {
btVector3 localAxis = dir*trans.getBasis(); btVector3 localAxis = dir*trans.getBasis();
btVector3 vtx1 = trans(localGetSupportingVertex(localAxis)); btVector3 vtx1 = trans(localGetSupportingVertex(localAxis));
@@ -54,7 +54,7 @@ void btConvexShape::project(const btTransform& trans, const btVector3& dir, floa
if(min>max) if(min>max)
{ {
float tmp = min; btScalar tmp = min;
min = max; min = max;
max = tmp; max = tmp;
} }

View File

@@ -52,7 +52,7 @@ public:
btScalar getMarginNonVirtual () const; btScalar getMarginNonVirtual () const;
void getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const; void getAabbNonVirtual (const btTransform& t, btVector3& aabbMin, btVector3& aabbMax) const;
virtual void project(const btTransform& trans, const btVector3& dir, float& min, float& max) const; virtual void project(const btTransform& trans, const btVector3& dir, btScalar& min, btScalar& max) const;
//notice that the vectors should be unit length //notice that the vectors should be unit length

View File

@@ -88,9 +88,9 @@ struct btTriangleInfoMap : public btInternalTriangleInfoMap
struct btTriangleInfoData struct btTriangleInfoData
{ {
int m_flags; int m_flags;
float m_edgeV0V1Angle; btScalar m_edgeV0V1Angle;
float m_edgeV1V2Angle; btScalar m_edgeV1V2Angle;
float m_edgeV2V0Angle; btScalar m_edgeV2V0Angle;
}; };
struct btTriangleInfoMapData struct btTriangleInfoMapData
@@ -100,11 +100,11 @@ struct btTriangleInfoMapData
btTriangleInfoData *m_valueArrayPtr; btTriangleInfoData *m_valueArrayPtr;
int *m_keyArrayPtr; int *m_keyArrayPtr;
float m_convexEpsilon; btScalar m_convexEpsilon;
float m_planarEpsilon; btScalar m_planarEpsilon;
float m_equalVertexThreshold; btScalar m_equalVertexThreshold;
float m_edgeDistanceThreshold; btScalar m_edgeDistanceThreshold;
float m_zeroAreaThreshold; btScalar m_zeroAreaThreshold;
int m_nextSize; int m_nextSize;
int m_hashTableSize; int m_hashTableSize;