summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorerwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd>2009-07-15 16:47:48 +0000
committererwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd>2009-07-15 16:47:48 +0000
commit40c73f327cf44951e3c983129fa508654693c0c4 (patch)
tree9bf2798d9430917c4488fdefb5c73152170a9af7 /src
parenta27b349dd0cbe069615108144e45f24c4aa23b8a (diff)
downloadbullet3-40c73f327cf44951e3c983129fa508654693c0c4.tar.gz
+ CMake build system fix under Windows: don't define _WINDOWS to allow Glut console demo to build properly
+ Allow user to enable useConvexConservativeDistanceUtil . Use dynamicsWorld->getDispatchInfo().m_useConvexConservativeDistanceUtil = true; (see Demos/Benchmarks/Benchmark4 (convex objects falling down) + Fix for plane drawing (just wire-frame) + Gimpact: use collision margin of 0.07 for demo (because BULLET_TRIANGLE_COLLISION is used) + replace dot,cross,distance,angle,triple in btVector3 by btDot, btCross,btDistance,btAngle,btDistance to avoid naming conflicts + Some fixes in GJK penetration depth normal direction (broken in a previous commit) + fix in calculateDiffAxisAngleQuaternion to make ConvexConservativeDistanceUtil work properly + allow debug drawing to debug btContinuousConvexCollision + add comment/warning that btTriangleMesh::findOrAddVertex is an internal method, users should use addTriangle instead
Diffstat (limited to 'src')
-rw-r--r--src/BulletCollision/BroadphaseCollision/btDbvt.cpp4
-rw-r--r--src/BulletCollision/BroadphaseCollision/btDbvt.h6
-rw-r--r--src/BulletCollision/BroadphaseCollision/btDispatcher.h2
-rw-r--r--src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp2
-rw-r--r--src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h3
-rw-r--r--src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp3
-rw-r--r--src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h2
-rw-r--r--src/BulletCollision/CollisionShapes/btTriangleMesh.h7
-rw-r--r--src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp11
-rw-r--r--src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp42
-rw-r--r--src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp71
-rw-r--r--src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h2
-rw-r--r--src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp33
-rw-r--r--src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGjkEpa2.cpp44
-rw-r--r--src/BulletSoftBody/btSoftBody.cpp58
-rw-r--r--src/BulletSoftBody/btSoftBody.h4
-rw-r--r--src/BulletSoftBody/btSoftBodyHelpers.cpp10
-rw-r--r--src/BulletSoftBody/btSoftBodyInternals.h40
-rw-r--r--src/LinearMath/btConvexHull.cpp48
-rw-r--r--src/LinearMath/btMatrix3x3.h2
-rw-r--r--src/LinearMath/btQuaternion.h12
-rw-r--r--src/LinearMath/btTransformUtil.h26
-rw-r--r--src/LinearMath/btVector3.h19
23 files changed, 262 insertions, 189 deletions
diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.cpp b/src/BulletCollision/BroadphaseCollision/btDbvt.cpp
index a6e36b470..ff32ec1d4 100644
--- a/src/BulletCollision/BroadphaseCollision/btDbvt.cpp
+++ b/src/BulletCollision/BroadphaseCollision/btDbvt.cpp
@@ -238,7 +238,7 @@ static void split( const tNodeArray& leaves,
right.resize(0);
for(int i=0,ni=leaves.size();i<ni;++i)
{
- if(dot(axis,leaves[i]->volume.Center()-org)<0)
+ if(btDot(axis,leaves[i]->volume.Center()-org)<0)
left.push_back(leaves[i]);
else
right.push_back(leaves[i]);
@@ -319,7 +319,7 @@ static btDbvtNode* topdown(btDbvt* pdbvt,
const btVector3 x=leaves[i]->volume.Center()-org;
for(int j=0;j<3;++j)
{
- ++splitcount[j][dot(x,axis[j])>0?1:0];
+ ++splitcount[j][btDot(x,axis[j])>0?1:0];
}
}
for( i=0;i<3;++i)
diff --git a/src/BulletCollision/BroadphaseCollision/btDbvt.h b/src/BulletCollision/BroadphaseCollision/btDbvt.h
index 141f9db68..412241a46 100644
--- a/src/BulletCollision/BroadphaseCollision/btDbvt.h
+++ b/src/BulletCollision/BroadphaseCollision/btDbvt.h
@@ -484,8 +484,8 @@ DBVT_INLINE int btDbvtAabbMm::Classify(const btVector3& n,btScalar o,int s) con
case (1+2+4): px=btVector3(mx.x(),mx.y(),mx.z());
pi=btVector3(mi.x(),mi.y(),mi.z());break;
}
- if((dot(n,px)+o)<0) return(-1);
- if((dot(n,pi)+o)>=0) return(+1);
+ if((btDot(n,px)+o)<0) return(-1);
+ if((btDot(n,pi)+o)>=0) return(+1);
return(0);
}
@@ -496,7 +496,7 @@ DBVT_INLINE btScalar btDbvtAabbMm::ProjectMinimum(const btVector3& v,unsigned si
const btVector3 p( b[(signs>>0)&1]->x(),
b[(signs>>1)&1]->y(),
b[(signs>>2)&1]->z());
- return(dot(p,v));
+ return(btDot(p,v));
}
//
diff --git a/src/BulletCollision/BroadphaseCollision/btDispatcher.h b/src/BulletCollision/BroadphaseCollision/btDispatcher.h
index ee57aa961..699c66b82 100644
--- a/src/BulletCollision/BroadphaseCollision/btDispatcher.h
+++ b/src/BulletCollision/BroadphaseCollision/btDispatcher.h
@@ -46,7 +46,7 @@ struct btDispatcherInfo
m_enableSPU(true),
m_useEpa(true),
m_allowedCcdPenetration(btScalar(0.04)),
- m_useConvexConservativeDistanceUtil(true),
+ m_useConvexConservativeDistanceUtil(false),
m_convexConservativeDistanceThreshold(0.0f),
m_stackAllocator(0)
{
diff --git a/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp b/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
index 6a37040ef..87b382b5b 100644
--- a/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
+++ b/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp
@@ -69,7 +69,7 @@ m_ownManifold (false),
m_manifoldPtr(mf),
m_lowLevelOfDetail(false),
#ifdef USE_SEPDISTANCE_UTIL2
-,m_sepDistance((static_cast<btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
+m_sepDistance((static_cast<btConvexShape*>(body0->getCollisionShape()))->getAngularMotionDisc(),
(static_cast<btConvexShape*>(body1->getCollisionShape()))->getAngularMotionDisc()),
#endif
m_numPerturbationIterations(numPerturbationIterations),
diff --git a/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h b/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
index 62dd33eb9..4d10ffca7 100644
--- a/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
+++ b/src/BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h
@@ -31,7 +31,8 @@ class btConvexPenetrationDepthSolver;
///so the distance is not conservative. In that case, enabling this USE_SEPDISTANCE_UTIL2 would result in failing/missing collisions.
///Either improve GJK for large size ratios (testing a 100 units versus a 0.1 unit object) or only enable the util
///for certain pairs that have a small size ratio
-///#define USE_SEPDISTANCE_UTIL2 1
+
+#define USE_SEPDISTANCE_UTIL2 1
///The convexConvexAlgorithm collision algorithm implements time of impact, convex closest points and penetration depth calculations between two convex objects.
///Multiple contact points are calculated by perturbing the orientation of the smallest object orthogonal to the separating normal.
diff --git a/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp b/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp
index 752e45a5a..c27d8ce07 100644
--- a/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp
+++ b/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp
@@ -102,7 +102,8 @@ btDefaultCollisionConfiguration::btDefaultCollisionConfiguration(const btDefault
int maxSize3 = sizeof(btCompoundCollisionAlgorithm);
int sl = sizeof(btConvexSeparatingDistanceUtil);
sl = sizeof(btGjkPairDetector);
- int collisionAlgorithmMaxElementSize = btMax(maxSize,maxSize2);
+ int collisionAlgorithmMaxElementSize = btMax(maxSize,constructionInfo.m_customCollisionAlgorithmMaxElementSize);
+ collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize2);
collisionAlgorithmMaxElementSize = btMax(collisionAlgorithmMaxElementSize,maxSize3);
if (constructionInfo.m_stackAlloc)
diff --git a/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h b/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h
index 2379566da..37748663a 100644
--- a/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h
+++ b/src/BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h
@@ -27,6 +27,7 @@ struct btDefaultCollisionConstructionInfo
btPoolAllocator* m_collisionAlgorithmPool;
int m_defaultMaxPersistentManifoldPoolSize;
int m_defaultMaxCollisionAlgorithmPoolSize;
+ int m_customCollisionAlgorithmMaxElementSize;
int m_defaultStackAllocatorSize;
int m_useEpaPenetrationAlgorithm;
@@ -36,6 +37,7 @@ struct btDefaultCollisionConstructionInfo
m_collisionAlgorithmPool(0),
m_defaultMaxPersistentManifoldPoolSize(4096),
m_defaultMaxCollisionAlgorithmPoolSize(4096),
+ m_customCollisionAlgorithmMaxElementSize(0),
m_defaultStackAllocatorSize(0),
m_useEpaPenetrationAlgorithm(true)
{
diff --git a/src/BulletCollision/CollisionShapes/btTriangleMesh.h b/src/BulletCollision/CollisionShapes/btTriangleMesh.h
index e82531c30..d2624fe18 100644
--- a/src/BulletCollision/CollisionShapes/btTriangleMesh.h
+++ b/src/BulletCollision/CollisionShapes/btTriangleMesh.h
@@ -40,9 +40,6 @@ class btTriangleMesh : public btTriangleIndexVertexArray
btTriangleMesh (bool use32bitIndices=true,bool use4componentVertices=true);
- int findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices);
- void addIndex(int index);
-
bool getUse32bitIndices() const
{
return m_use32bitIndices;
@@ -61,6 +58,10 @@ class btTriangleMesh : public btTriangleIndexVertexArray
virtual void preallocateVertices(int numverts){(void) numverts;}
virtual void preallocateIndices(int numindices){(void) numindices;}
+ ///findOrAddVertex is an internal method, use addTriangle instead
+ int findOrAddVertex(const btVector3& vertex, bool removeDuplicateVertices);
+ ///addIndex is an internal method, use addTriangle instead
+ void addIndex(int index);
};
diff --git a/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp b/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp
index 2f41b3c27..19f771296 100644
--- a/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp
+++ b/src/BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp
@@ -121,6 +121,10 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
//not close enough
while (dist > radius)
{
+ if (result.m_debugDrawer)
+ {
+ result.m_debugDrawer->drawSphere(c,0.2f,btVector3(1,1,1));
+ }
numIter++;
if (numIter > maxIter)
{
@@ -170,6 +174,11 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
btTransformUtil::integrateTransform(fromB,linVelB,angVelB,lambda,interpolatedTransB);
relativeTrans = interpolatedTransB.inverseTimes(interpolatedTransA);
+ if (result.m_debugDrawer)
+ {
+ result.m_debugDrawer->drawSphere(interpolatedTransA.getOrigin(),0.2f,btVector3(1,0,0));
+ }
+
result.DebugDraw( lambda );
btPointCollector pointCollector;
@@ -197,6 +206,7 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
//??
return false;
}
+
}
@@ -224,4 +234,3 @@ bool btContinuousConvexCollision::calcTimeOfImpact(
*/
}
-
diff --git a/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp b/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp
index ada20d3ef..76a91c36d 100644
--- a/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp
+++ b/src/BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp
@@ -202,7 +202,7 @@ namespace gjkepa2_impl
lastw[clastw=(clastw+1)&3]=w;
}
/* Check for termination */
- const btScalar omega=dot(m_ray,w)/rl;
+ const btScalar omega=btDot(m_ray,w)/rl;
alpha=btMax(omega,alpha);
if(((rl-alpha)-(GJK_ACCURARY*rl))<=0)
{/* Return old simplex */
@@ -288,7 +288,7 @@ namespace gjkepa2_impl
{
btVector3 axis=btVector3(0,0,0);
axis[i]=1;
- const btVector3 p=cross(d,axis);
+ const btVector3 p=btCross(d,axis);
if(p.length2()>0)
{
appendvertice(*m_simplex, p);
@@ -303,7 +303,7 @@ namespace gjkepa2_impl
break;
case 3:
{
- const btVector3 n=cross(m_simplex->c[1]->w-m_simplex->c[0]->w,
+ const btVector3 n=btCross(m_simplex->c[1]->w-m_simplex->c[0]->w,
m_simplex->c[2]->w-m_simplex->c[0]->w);
if(n.length2()>0)
{
@@ -357,7 +357,7 @@ namespace gjkepa2_impl
const btScalar l=d.length2();
if(l>GJK_SIMPLEX2_EPS)
{
- const btScalar t(l>0?-dot(a,d)/l:0);
+ const btScalar t(l>0?-btDot(a,d)/l:0);
if(t>=1) { w[0]=0;w[1]=1;m=2;return(b.length2()); }
else if(t<=0) { w[0]=1;w[1]=0;m=1;return(a.length2()); }
else { w[0]=1-(w[1]=t);m=3;return((a+d*t).length2()); }
@@ -372,7 +372,7 @@ namespace gjkepa2_impl
static const U imd3[]={1,2,0};
const btVector3* vt[]={&a,&b,&c};
const btVector3 dl[]={a-b,b-c,c-a};
- const btVector3 n=cross(dl[0],dl[1]);
+ const btVector3 n=btCross(dl[0],dl[1]);
const btScalar l=n.length2();
if(l>GJK_SIMPLEX3_EPS)
{
@@ -381,7 +381,7 @@ namespace gjkepa2_impl
U subm;
for(U i=0;i<3;++i)
{
- if(dot(*vt[i],cross(dl[i],n))>0)
+ if(btDot(*vt[i],btCross(dl[i],n))>0)
{
const U j=imd3[i];
const btScalar subd(projectorigin(*vt[i],*vt[j],subw,subm));
@@ -397,13 +397,13 @@ namespace gjkepa2_impl
}
if(mindist<0)
{
- const btScalar d=dot(a,n);
+ const btScalar d=btDot(a,n);
const btScalar s=btSqrt(l);
const btVector3 p=n*(d/l);
mindist = p.length2();
m = 7;
- w[0] = (cross(dl[1],b-p)).length()/s;
- w[1] = (cross(dl[2],c-p)).length()/s;
+ w[0] = (btCross(dl[1],b-p)).length()/s;
+ w[1] = (btCross(dl[2],c-p)).length()/s;
w[2] = 1-(w[0]+w[1]);
}
return(mindist);
@@ -420,7 +420,7 @@ namespace gjkepa2_impl
const btVector3* vt[]={&a,&b,&c,&d};
const btVector3 dl[]={a-d,b-d,c-d};
const btScalar vl=det(dl[0],dl[1],dl[2]);
- const bool ng=(vl*dot(a,cross(b-c,a-b)))<=0;
+ const bool ng=(vl*btDot(a,btCross(b-c,a-b)))<=0;
if(ng&&(btFabs(vl)>GJK_SIMPLEX4_EPS))
{
btScalar mindist=-1;
@@ -429,7 +429,7 @@ namespace gjkepa2_impl
for(U i=0;i<3;++i)
{
const U j=imd3[i];
- const btScalar s=vl*dot(d,cross(dl[i],dl[j]));
+ const btScalar s=vl*btDot(d,btCross(dl[i],dl[j]));
if(s>0)
{
const btScalar subd=projectorigin(*vt[i],*vt[j],d,subw,subm);
@@ -601,7 +601,7 @@ namespace gjkepa2_impl
bool valid=true;
best->pass = (U1)(++pass);
gjk.getsupport(best->n,*w);
- const btScalar wdist=dot(best->n,w->w)-best->d;
+ const btScalar wdist=btDot(best->n,w->w)-best->d;
if(wdist>EPA_ACCURACY)
{
for(U j=0;(j<3)&&valid;++j)
@@ -628,11 +628,11 @@ namespace gjkepa2_impl
m_result.c[0] = outer.c[0];
m_result.c[1] = outer.c[1];
m_result.c[2] = outer.c[2];
- m_result.p[0] = cross( outer.c[1]->w-projection,
+ m_result.p[0] = btCross( outer.c[1]->w-projection,
outer.c[2]->w-projection).length();
- m_result.p[1] = cross( outer.c[2]->w-projection,
+ m_result.p[1] = btCross( outer.c[2]->w-projection,
outer.c[0]->w-projection).length();
- m_result.p[2] = cross( outer.c[0]->w-projection,
+ m_result.p[2] = btCross( outer.c[0]->w-projection,
outer.c[1]->w-projection).length();
const btScalar sum=m_result.p[0]+m_result.p[1]+m_result.p[2];
m_result.p[0] /= sum;
@@ -666,18 +666,18 @@ namespace gjkepa2_impl
face->c[0] = a;
face->c[1] = b;
face->c[2] = c;
- face->n = cross(b->w-a->w,c->w-a->w);
+ face->n = btCross(b->w-a->w,c->w-a->w);
const btScalar l=face->n.length();
const bool v=l>EPA_ACCURACY;
face->p = btMin(btMin(
- dot(a->w,cross(face->n,a->w-b->w)),
- dot(b->w,cross(face->n,b->w-c->w))),
- dot(c->w,cross(face->n,c->w-a->w))) /
+ btDot(a->w,btCross(face->n,a->w-b->w)),
+ btDot(b->w,btCross(face->n,b->w-c->w))),
+ btDot(c->w,btCross(face->n,c->w-a->w))) /
(v?l:1);
face->p = face->p>=-EPA_INSIDE_EPS?0:face->p;
if(v)
{
- face->d = dot(a->w,face->n)/l;
+ face->d = btDot(a->w,face->n)/l;
face->n /= l;
if(forced||(face->d>=-EPA_PLANE_EPS))
{
@@ -715,7 +715,7 @@ namespace gjkepa2_impl
if(f->pass!=pass)
{
const U e1=i1m3[e];
- if((dot(f->n,w->w)-f->d)<-EPA_PLANE_EPS)
+ if((btDot(f->n,w->w)-f->d)<-EPA_PLANE_EPS)
{
sFace* nf=newface(f->c[e1],f->c[e],w,false);
if(nf)
diff --git a/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp b/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
index c7baf80eb..a7bdd524d 100644
--- a/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
+++ b/src/BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp
@@ -299,6 +299,7 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
btVector3 tmpPointOnA,tmpPointOnB;
gNumDeepPenetrationChecks++;
+ m_cachedSeparatingAxis.setZero();
bool isValid2 = m_penetrationDepthSolver->calcPenDepth(
*m_simplexSolver,
@@ -308,23 +309,40 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
debugDraw,input.m_stackAlloc
);
+
if (isValid2)
{
- btScalar distance2 = -(tmpPointOnA-tmpPointOnB).length();
- //only replace valid penetrations when the result is deeper (check)
- if (!isValid || (distance2 < distance))
+ btVector3 tmpNormalInB = tmpPointOnB-tmpPointOnA;
+ btScalar lenSqr = tmpNormalInB.length2();
+ if (lenSqr <= (SIMD_EPSILON*SIMD_EPSILON))
+ {
+ tmpNormalInB = m_cachedSeparatingAxis;
+ lenSqr = m_cachedSeparatingAxis.length2();
+ }
+
+ if (lenSqr > (SIMD_EPSILON*SIMD_EPSILON))
{
- distance = distance2;
- pointOnA = tmpPointOnA;
- pointOnB = tmpPointOnB;
- normalInB = m_cachedSeparatingAxis;
- isValid = true;
- m_lastUsedMethod = 3;
- } else
+ tmpNormalInB /= btSqrt(lenSqr);
+ btScalar distance2 = -(tmpPointOnA-tmpPointOnB).length();
+ //only replace valid penetrations when the result is deeper (check)
+ if (!isValid || (distance2 < distance))
+ {
+ distance = distance2;
+ pointOnA = tmpPointOnA;
+ pointOnB = tmpPointOnB;
+ normalInB = tmpNormalInB;
+ isValid = true;
+ m_lastUsedMethod = 3;
+ } else
+ {
+ m_lastUsedMethod = 8;
+ }
+ } else
{
- m_lastUsedMethod = 4;
+ m_lastUsedMethod = 9;
}
} else
+
{
///this is another degenerate case, where the initial GJK calculation reports a degenerate case
///EPA reports no penetration, and the second GJK (using the supporting vector without margin)
@@ -333,21 +351,24 @@ void btGjkPairDetector::getClosestPoints(const ClosestPointInput& input,Result&
///http://code.google.com/p/bullet/issues/detail?id=250
- btScalar distance2 = (tmpPointOnA-tmpPointOnB).length()-margin;
- //only replace valid distances when the distance is less
- if (!isValid || (distance2 < distance))
- {
- distance = distance2;
- pointOnA = tmpPointOnA;
- pointOnB = tmpPointOnB;
- pointOnA -= m_cachedSeparatingAxis * marginA ;
- pointOnB += m_cachedSeparatingAxis * marginB ;
- normalInB = m_cachedSeparatingAxis;
- isValid = true;
- m_lastUsedMethod = 6;
- } else
+ if (m_cachedSeparatingAxis.length2() > btScalar(0.))
{
- m_lastUsedMethod = 5;
+ btScalar distance2 = (tmpPointOnA-tmpPointOnB).length()-margin;
+ //only replace valid distances when the distance is less
+ if (!isValid || (distance2 < distance))
+ {
+ distance = distance2;
+ pointOnA = tmpPointOnA;
+ pointOnB = tmpPointOnB;
+ pointOnA -= m_cachedSeparatingAxis * marginA ;
+ pointOnB += m_cachedSeparatingAxis * marginB ;
+ normalInB = m_cachedSeparatingAxis;
+ isValid = true;
+ m_lastUsedMethod = 6;
+ } else
+ {
+ m_lastUsedMethod = 5;
+ }
}
}
diff --git a/src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h b/src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h
index 151cb2c79..5ce285c8f 100644
--- a/src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h
+++ b/src/BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h
@@ -24,7 +24,7 @@ subject to the following restrictions:
class btPersistentManifold;
-//#define USE_SEPDISTANCE_UTIL 1
+#define USE_SEPDISTANCE_UTIL 1
/// SpuContactManifoldCollisionAlgorithm provides contact manifold and should be processed on SPU.
ATTRIBUTE_ALIGNED16(class) SpuContactManifoldCollisionAlgorithm : public btCollisionAlgorithm
diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp
index ef54b1184..09ef3350f 100644
--- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp
+++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp
@@ -52,6 +52,9 @@ subject to the following restrictions:
#endif
#endif //__SPU__
+int gSkippedCol = 0;
+int gProcessedCol = 0;
+
////////////////////////////////////////////////
/// software caching
#if USE_SOFTWARE_CACHE
@@ -624,8 +627,11 @@ SIMD_FORCE_INLINE void dmaAndSetupCollisionObjects(SpuCollisionPairInput& collis
cellDmaWaitTagStatusAll(DMA_MASK(1) | DMA_MASK(2));
- collisionPairInput.m_worldTransform0 = lsMem.getColObj0()->getWorldTransform();
- collisionPairInput.m_worldTransform1 = lsMem.getColObj1()->getWorldTransform();
+ btCollisionObject* ob0 = lsMem.getColObj0();
+ btCollisionObject* ob1 = lsMem.getColObj1();
+
+ collisionPairInput.m_worldTransform0 = ob0->getWorldTransform();
+ collisionPairInput.m_worldTransform1 = ob1->getWorldTransform();
}
@@ -998,6 +1004,11 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
lsMem.getColObj0()->getFriction(),lsMem.getColObj1()->getFriction(),
collisionPairInput.m_isSwapped);
+
+ float distance=0.f;
+ btVector3 normalInB;
+
+
if (//!gUseEpa &&
#ifdef USE_SEPDISTANCE_UTIL
@@ -1007,7 +1018,7 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
#endif
)
{
-//#define USE_PE_BOX_BOX 1
+#define USE_PE_BOX_BOX 1
#ifdef USE_PE_BOX_BOX
{
@@ -1032,9 +1043,9 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
float distanceThreshold = FLT_MAX;//0.0f;//FLT_MAX;//use epsilon?
- float distance = boxBoxDistance(resultNormal,resultClosestBoxPointA,resultClosestBoxPointB, boxA, transformA, boxB,transformB,distanceThreshold);
+ distance = boxBoxDistance(resultNormal,resultClosestBoxPointA,resultClosestBoxPointB, boxA, transformA, boxB,transformB,distanceThreshold);
- btVector3 normalInB = -getBtVector3(resultNormal);
+ normalInB = -getBtVector3(resultNormal);
if(distance < spuManifold->getContactBreakingThreshold())
{
@@ -1094,9 +1105,13 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
lsMem.needsDmaPutContactManifoldAlgo = true;
#ifdef USE_SEPDISTANCE_UTIL
- btScalar sepDist = distance+spuManifold->getContactBreakingThreshold();
- lsMem.getlocalCollisionAlgorithm()->m_sepDistance.initSeparatingDistance(normalInB,sepDist,collisionPairInput.m_worldTransform0,collisionPairInput.m_worldTransform1);
+ btScalar sepDist2 = distance+spuManifold->getContactBreakingThreshold();
+ lsMem.getlocalCollisionAlgorithm()->m_sepDistance.initSeparatingDistance(normalInB,sepDist2,collisionPairInput.m_worldTransform0,collisionPairInput.m_worldTransform1);
#endif //USE_SEPDISTANCE_UTIL
+ gProcessedCol++;
+ } else
+ {
+ gSkippedCol++;
}
spuContacts.flush();
@@ -1138,13 +1153,15 @@ void processCollisionTask(void* userPtr, void* lsMemPtr)
}
#ifdef USE_SEPDISTANCE_UTIL
+#if defined (__SPU__) || defined (USE_LIBSPE2)
if (lsMem.needsDmaPutContactManifoldAlgo)
{
dmaSize = sizeof(SpuContactManifoldCollisionAlgorithm);
dmaPpuAddress2 = (ppu_address_t)pair.m_algorithm;
- cellDmaLargePut(&lsMem.gSpuContactManifoldAlgo, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
+ cellDmaLargePut(&lsMem.gSpuContactManifoldAlgoBuffer, dmaPpuAddress2 , dmaSize, DMA_TAG(1), 0, 0);
cellDmaWaitTagStatusAll(DMA_MASK(1));
}
+#endif
#endif //#ifdef USE_SEPDISTANCE_UTIL
}
diff --git a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGjkEpa2.cpp b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGjkEpa2.cpp
index be4bf5a54..5bf0d9379 100644
--- a/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGjkEpa2.cpp
+++ b/src/BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGjkEpa2.cpp
@@ -201,7 +201,7 @@ eStatus::_ Evaluate(const tShape& shapearg,const btVector3& guess)
lastw[clastw=(clastw+1)&3]=w;
}
/* Check for termination */
- const btScalar omega=dot(m_ray,w)/rl;
+ const btScalar omega=btDot(m_ray,w)/rl;
alpha=btMax(omega,alpha);
if(((rl-alpha)-(GJK_ACCURARY*rl))<=0)
{/* Return old simplex */
@@ -287,9 +287,9 @@ bool EncloseOrigin()
{
btVector3 axis=btVector3(0,0,0);
axis[i]=1;
- if(btFabs(dot(axis,d))>0)
+ if(btFabs(btDot(axis,d))>0)
{
- const btVector3 p=cross(d,axis);
+ const btVector3 p=btCross(d,axis);
appendvertice(*m_simplex, p);
if(EncloseOrigin()) return(true);
removevertice(*m_simplex);
@@ -302,7 +302,7 @@ bool EncloseOrigin()
break;
case 3:
{
- const btVector3 n=cross(m_simplex->c[1]->w-m_simplex->c[0]->w,
+ const btVector3 n=btCross(m_simplex->c[1]->w-m_simplex->c[0]->w,
m_simplex->c[2]->w-m_simplex->c[0]->w);
const btScalar l=n.length();
if(l>0)
@@ -357,7 +357,7 @@ static btScalar projectorigin( const btVector3& a,
const btScalar l=d.length2();
if(l>GJK_SIMPLEX2_EPS)
{
- const btScalar t(l>0?-dot(a,d)/l:0);
+ const btScalar t(l>0?-btDot(a,d)/l:0);
if(t>=1) { w[0]=0;w[1]=1;m=2;return(b.length2()); }
else if(t<=0) { w[0]=1;w[1]=0;m=1;return(a.length2()); }
else { w[0]=1-(w[1]=t);m=3;return((a+d*t).length2()); }
@@ -372,7 +372,7 @@ static btScalar projectorigin( const btVector3& a,
static const U imd3[]={1,2,0};
const btVector3* vt[]={&a,&b,&c};
const btVector3 dl[]={a-b,b-c,c-a};
- const btVector3 n=cross(dl[0],dl[1]);
+ const btVector3 n=btCross(dl[0],dl[1]);
const btScalar l=n.length2();
if(l>GJK_SIMPLEX3_EPS)
{
@@ -381,7 +381,7 @@ static btScalar projectorigin( const btVector3& a,
U subm;
for(U i=0;i<3;++i)
{
- if(dot(*vt[i],cross(dl[i],n))>0)
+ if(btDot(*vt[i],btCross(dl[i],n))>0)
{
const U j=imd3[i];
const btScalar subd(projectorigin(*vt[i],*vt[j],subw,subm));
@@ -397,13 +397,13 @@ static btScalar projectorigin( const btVector3& a,
}
if(mindist<0)
{
- const btScalar d=dot(a,n);
+ const btScalar d=btDot(a,n);
const btScalar s=btSqrt(l);
const btVector3 p=n*(d/l);
mindist = p.length2();
m = 7;
- w[0] = (cross(dl[1],b-p)).length()/s;
- w[1] = (cross(dl[2],c-p)).length()/s;
+ w[0] = (btCross(dl[1],b-p)).length()/s;
+ w[1] = (btCross(dl[2],c-p)).length()/s;
w[2] = 1-(w[0]+w[1]);
}
return(mindist);
@@ -420,7 +420,7 @@ static btScalar projectorigin( const btVector3& a,
const btVector3* vt[]={&a,&b,&c,&d};
const btVector3 dl[]={a-d,b-d,c-d};
const btScalar vl=det(dl[0],dl[1],dl[2]);
- const bool ng=(vl*dot(a,cross(b-c,a-b)))<=0;
+ const bool ng=(vl*btDot(a,btCross(b-c,a-b)))<=0;
if(ng&&(btFabs(vl)>GJK_SIMPLEX4_EPS))
{
btScalar mindist=-1;
@@ -429,7 +429,7 @@ static btScalar projectorigin( const btVector3& a,
for(U i=0;i<3;++i)
{
const U j=imd3[i];
- const btScalar s=vl*dot(d,cross(dl[i],dl[j]));
+ const btScalar s=vl*btDot(d,btCross(dl[i],dl[j]));
if(s>0)
{
const btScalar subd=projectorigin(*vt[i],*vt[j],d,subw,subm);
@@ -577,7 +577,7 @@ eStatus::_ Evaluate(GJK& gjk,const btVector3& guess)
bool valid=true;
best->pass = (U1)(++pass);
gjk.getsupport(best->n,*w);
- const btScalar wdist=dot(best->n,w->w)-best->d;
+ const btScalar wdist=btDot(best->n,w->w)-best->d;
if(wdist>EPA_ACCURACY)
{
for(U j=0;(j<3)&&valid;++j)
@@ -604,11 +604,11 @@ eStatus::_ Evaluate(GJK& gjk,const btVector3& guess)
m_result.c[0] = outer.c[0];
m_result.c[1] = outer.c[1];
m_result.c[2] = outer.c[2];
- m_result.p[0] = cross( outer.c[1]->w-projection,
+ m_result.p[0] = btCross( outer.c[1]->w-projection,
outer.c[2]->w-projection).length();
- m_result.p[1] = cross( outer.c[2]->w-projection,
+ m_result.p[1] = btCross( outer.c[2]->w-projection,
outer.c[0]->w-projection).length();
- m_result.p[2] = cross( outer.c[0]->w-projection,
+ m_result.p[2] = btCross( outer.c[0]->w-projection,
outer.c[1]->w-projection).length();
const btScalar sum=m_result.p[0]+m_result.p[1]+m_result.p[2];
m_result.p[0] /= sum;
@@ -642,18 +642,18 @@ sFace* newface(sSV* a,sSV* b,sSV* c,bool forced)
face->c[0] = a;
face->c[1] = b;
face->c[2] = c;
- face->n = cross(b->w-a->w,c->w-a->w);
+ face->n = btCross(b->w-a->w,c->w-a->w);
const btScalar l=face->n.length();
const bool v=l>EPA_ACCURACY;
face->p = btMin(btMin(
- dot(a->w,cross(face->n,a->w-b->w)),
- dot(b->w,cross(face->n,b->w-c->w))),
- dot(c->w,cross(face->n,c->w-a->w))) /
+ btDot(a->w,btCross(face->n,a->w-b->w)),
+ btDot(b->w,btCross(face->n,b->w-c->w))),
+ btDot(c->w,btCross(face->n,c->w-a->w))) /
(v?l:1);
face->p = face->p>=-EPA_INSIDE_EPS?0:face->p;
if(v)
{
- face->d = dot(a->w,face->n)/l;
+ face->d = btDot(a->w,face->n)/l;
face->n /= l;
if(forced||(face->d>=-EPA_PLANE_EPS))
{
@@ -691,7 +691,7 @@ bool expand(U pass,sSV* w,sFace* f,U e,sHorizon& horizon)
if(f->pass!=pass)
{
const U e1=i1m3[e];
- if((dot(f->n,w->w)-f->d)<-EPA_PLANE_EPS)
+ if((btDot(f->n,w->w)-f->d)<-EPA_PLANE_EPS)
{
sFace* nf=newface(f->c[e1],f->c[e],w,false);
if(nf)
diff --git a/src/BulletSoftBody/btSoftBody.cpp b/src/BulletSoftBody/btSoftBody.cpp
index ee810c540..f6dcb0589 100644
--- a/src/BulletSoftBody/btSoftBody.cpp
+++ b/src/BulletSoftBody/btSoftBody.cpp
@@ -611,7 +611,7 @@ btScalar btSoftBody::getVolume() const
for(i=0,ni=m_faces.size();i<ni;++i)
{
const Face& f=m_faces[i];
- vol+=dot(f.m_n[0]->m_x-org,cross(f.m_n[1]->m_x-org,f.m_n[2]->m_x-org));
+ vol+=btDot(f.m_n[0]->m_x-org,btCross(f.m_n[1]->m_x-org,f.m_n[2]->m_x-org));
}
vol/=(btScalar)6;
}
@@ -644,14 +644,14 @@ btVector3 btSoftBody::clusterCom(int cluster) const
//
btVector3 btSoftBody::clusterVelocity(const Cluster* cluster,const btVector3& rpos)
{
- return(cluster->m_lv+cross(cluster->m_av,rpos));
+ return(cluster->m_lv+btCross(cluster->m_av,rpos));
}
//
void btSoftBody::clusterVImpulse(Cluster* cluster,const btVector3& rpos,const btVector3& impulse)
{
const btVector3 li=cluster->m_imass*impulse;
- const btVector3 ai=cluster->m_invwi*cross(rpos,impulse);
+ const btVector3 ai=cluster->m_invwi*btCross(rpos,impulse);
cluster->m_vimpulses[0]+=li;cluster->m_lv+=li;
cluster->m_vimpulses[1]+=ai;cluster->m_av+=ai;
cluster->m_nvimpulses++;
@@ -661,7 +661,7 @@ void btSoftBody::clusterVImpulse(Cluster* cluster,const btVector3& rpos,const
void btSoftBody::clusterDImpulse(Cluster* cluster,const btVector3& rpos,const btVector3& impulse)
{
const btVector3 li=cluster->m_imass*impulse;
- const btVector3 ai=cluster->m_invwi*cross(rpos,impulse);
+ const btVector3 ai=cluster->m_invwi*btCross(rpos,impulse);
cluster->m_dimpulses[0]+=li;
cluster->m_dimpulses[1]+=ai;
cluster->m_ndimpulses++;
@@ -1585,19 +1585,19 @@ btScalar btSoftBody::RayFromToCaster::rayFromToTriangle( const btVector3& rayF
static const btScalar ceps=-SIMD_EPSILON*10;
static const btScalar teps=SIMD_EPSILON*10;
- const btVector3 n=cross(b-a,c-a);
- const btScalar d=dot(a,n);
- const btScalar den=dot(rayNormalizedDirection,n);
+ const btVector3 n=btCross(b-a,c-a);
+ const btScalar d=btDot(a,n);
+ const btScalar den=btDot(rayNormalizedDirection,n);
if(!btFuzzyZero(den))
{
- const btScalar num=dot(rayFrom,n)-d;
+ const btScalar num=btDot(rayFrom,n)-d;
const btScalar t=-num/den;
if((t>teps)&&(t<maxt))
{
const btVector3 hit=rayFrom+rayNormalizedDirection*t;
- if( (dot(n,cross(a-hit,b-hit))>ceps) &&
- (dot(n,cross(b-hit,c-hit))>ceps) &&
- (dot(n,cross(c-hit,a-hit))>ceps))
+ if( (btDot(n,btCross(a-hit,b-hit))>ceps) &&
+ (btDot(n,btCross(b-hit,c-hit))>ceps) &&
+ (btDot(n,btCross(c-hit,a-hit))>ceps))
{
return(t);
}
@@ -1783,7 +1783,7 @@ bool btSoftBody::checkContact( btCollisionObject* colObj,
{
cti.m_colObj = colObj;
cti.m_normal = wtr.getBasis()*nrm;
- cti.m_offset = -dot( cti.m_normal,
+ cti.m_offset = -btDot( cti.m_normal,
x-cti.m_normal*dst);
return(true);
}
@@ -1803,7 +1803,7 @@ void btSoftBody::updateNormals()
for(i=0,ni=m_faces.size();i<ni;++i)
{
btSoftBody::Face& f=m_faces[i];
- const btVector3 n=cross(f.m_n[1]->m_x-f.m_n[0]->m_x,
+ const btVector3 n=btCross(f.m_n[1]->m_x-f.m_n[0]->m_x,
f.m_n[2]->m_x-f.m_n[0]->m_x);
f.m_normal=n.normalized();
f.m_n[0]->m_n+=n;
@@ -2058,7 +2058,7 @@ void btSoftBody::updateClusters()
{
const btVector3 v=c.m_nodes[i]->m_v*c.m_masses[i];
c.m_lv += v;
- c.m_av += cross(c.m_nodes[i]->m_x-c.m_com,v);
+ c.m_av += btCross(c.m_nodes[i]->m_x-c.m_com,v);
}
}
c.m_lv=c.m_imass*c.m_lv*(1-c.m_ldamping);
@@ -2174,7 +2174,7 @@ void btSoftBody::applyClusters(bool drift)
const int idx=int(c.m_nodes[j]-&m_nodes[0]);
const btVector3& x=c.m_nodes[j]->m_x;
const btScalar q=c.m_masses[j];
- deltas[idx] += (v+cross(w,x-c.m_com))*q;
+ deltas[idx] += (v+btCross(w,x-c.m_com))*q;
weights[idx] += q;
}
}
@@ -2200,7 +2200,7 @@ void btSoftBody::dampClusters()
Node& n=*c.m_nodes[j];
if(n.m_im>0)
{
- const btVector3 vx=c.m_lv+cross(c.m_av,c.m_nodes[j]->m_q-c.m_com);
+ const btVector3 vx=c.m_lv+btCross(c.m_av,c.m_nodes[j]->m_q-c.m_com);
if(vx.length2()<=n.m_v.length2())
{
n.m_v += c.m_ndamping*(vx-n.m_v);
@@ -2269,8 +2269,8 @@ void btSoftBody::AJoint::Prepare(btScalar dt,int iterations)
Joint::Prepare(dt,iterations);
m_axis[0] = m_bodies[0].xform().getBasis()*m_refs[0];
m_axis[1] = m_bodies[1].xform().getBasis()*m_refs[1];
- m_drift = NormalizeAny(cross(m_axis[1],m_axis[0]));
- m_drift *= btMin(maxdrift,btAcos(Clamp<btScalar>(dot(m_axis[0],m_axis[1]),-1,+1)));
+ m_drift = NormalizeAny(btCross(m_axis[1],m_axis[0]));
+ m_drift *= btMin(maxdrift,btAcos(Clamp<btScalar>(btDot(m_axis[0],m_axis[1]),-1,+1)));
m_drift *= m_erp/dt;
m_massmatrix= AngularImpulseMatrix(m_bodies[0].invWorldInertia(),m_bodies[1].invWorldInertia());
if(m_split>0)
@@ -2287,7 +2287,7 @@ void btSoftBody::AJoint::Solve(btScalar dt,btScalar sor)
const btVector3 va=m_bodies[0].angularVelocity();
const btVector3 vb=m_bodies[1].angularVelocity();
const btVector3 vr=va-vb;
- const btScalar sp=dot(vr,m_axis[0]);
+ const btScalar sp=btDot(vr,m_axis[0]);
const btVector3 vc=vr-m_axis[0]*m_icontrol->Speed(this,sp);
btSoftBody::Impulse impulse;
impulse.m_asVelocity = 1;
@@ -2334,7 +2334,7 @@ void btSoftBody::CJoint::Solve(btScalar dt,btScalar sor)
const btVector3 va=m_bodies[0].velocity(m_rpos[0]);
const btVector3 vb=m_bodies[1].velocity(m_rpos[1]);
const btVector3 vrel=va-vb;
- const btScalar rvac=dot(vrel,m_normal);
+ const btScalar rvac=btDot(vrel,m_normal);
btSoftBody::Impulse impulse;
impulse.m_asVelocity = 1;
impulse.m_velocity = m_drift;
@@ -2417,9 +2417,9 @@ void btSoftBody::applyForces()
case btSoftBody::eAeroModel::V_Point:
nrm=NormalizeAny(rel_v);break;
case btSoftBody::eAeroModel::V_TwoSided:
- nrm*=(btScalar)(dot(nrm,rel_v)<0?-1:+1);break;
+ nrm*=(btScalar)(btDot(nrm,rel_v)<0?-1:+1);break;
}
- const btScalar dvn=dot(rel_v,nrm);
+ const btScalar dvn=btDot(rel_v,nrm);
/* Compute forces */
if(dvn>0)
{
@@ -2463,9 +2463,9 @@ void btSoftBody::applyForces()
switch(m_cfg.aeromodel)
{
case btSoftBody::eAeroModel::F_TwoSided:
- nrm*=(btScalar)(dot(nrm,rel_v)<0?-1:+1);break;
+ nrm*=(btScalar)(btDot(nrm,rel_v)<0?-1:+1);break;
}
- const btScalar dvn=dot(rel_v,nrm);
+ const btScalar dvn=btDot(rel_v,nrm);
/* Compute forces */
if(dvn>0)
{
@@ -2516,10 +2516,10 @@ void btSoftBody::PSolve_RContacts(btSoftBody* psb,btScalar kst,btScalar ti)
const btVector3 va=tmpRigid ? tmpRigid->getVelocityInLocalPoint(c.m_c1)*dt : btVector3(0,0,0);
const btVector3 vb=c.m_node->m_x-c.m_node->m_q;
const btVector3 vr=vb-va;
- const btScalar dn=dot(vr,cti.m_normal);
+ const btScalar dn=btDot(vr,cti.m_normal);
if(dn<=SIMD_EPSILON)
{
- const btScalar dp=btMin(dot(c.m_node->m_x,cti.m_normal)+cti.m_offset,mrg);
+ const btScalar dp=btMin(btDot(c.m_node->m_x,cti.m_normal)+cti.m_offset,mrg);
const btVector3 fv=vr-cti.m_normal*dn;
const btVector3 impulse=c.m_c0*((vr-fv*c.m_c3+cti.m_normal*(dp*c.m_c4))*kst);
c.m_node->m_x-=impulse*c.m_c2;
@@ -2548,9 +2548,9 @@ void btSoftBody::PSolve_SContacts(btSoftBody* psb,btScalar,btScalar ti)
c.m_weights);
const btVector3 vr=(n.m_x-n.m_q)-(p-q);
btVector3 corr(0,0,0);
- if(dot(vr,nr)<0)
+ if(btDot(vr,nr)<0)
{
- const btScalar j=c.m_margin-(dot(nr,n.m_x)-dot(nr,p));
+ const btScalar j=c.m_margin-(btDot(nr,n.m_x)-btDot(nr,p));
corr+=c.m_normal*j;
}
corr -= ProjectOnPlane(vr,nr)*c.m_friction;
@@ -2588,7 +2588,7 @@ void btSoftBody::VSolve_Links(btSoftBody* psb,btScalar kst)
{
Link& l=psb->m_links[i];
Node** n=l.m_n;
- const btScalar j=-dot(l.m_c3,n[0]->m_v-n[1]->m_v)*l.m_c2*kst;
+ const btScalar j=-btDot(l.m_c3,n[0]->m_v-n[1]->m_v)*l.m_c2*kst;
n[0]->m_v+= l.m_c3*(j*n[0]->m_im);
n[1]->m_v-= l.m_c3*(j*n[1]->m_im);
}
diff --git a/src/BulletSoftBody/btSoftBody.h b/src/BulletSoftBody/btSoftBody.h
index a62c21883..ddf667268 100644
--- a/src/BulletSoftBody/btSoftBody.h
+++ b/src/BulletSoftBody/btSoftBody.h
@@ -370,8 +370,8 @@ public:
}
btVector3 angularVelocity(const btVector3& rpos) const
{
- if(m_rigid) return(cross(m_rigid->getAngularVelocity(),rpos));
- if(m_soft) return(cross(m_soft->m_av,rpos));
+ if(m_rigid) return(btCross(m_rigid->getAngularVelocity(),rpos));
+ if(m_soft) return(btCross(m_soft->m_av,rpos));
return(btVector3(0,0,0));
}
btVector3 angularVelocity() const
diff --git a/src/BulletSoftBody/btSoftBodyHelpers.cpp b/src/BulletSoftBody/btSoftBodyHelpers.cpp
index 6ab93c164..b9901660a 100644
--- a/src/BulletSoftBody/btSoftBodyHelpers.cpp
+++ b/src/BulletSoftBody/btSoftBodyHelpers.cpp
@@ -130,7 +130,7 @@ static inline btScalar tetravolume(const btVector3& x0,
const btVector3 a=x1-x0;
const btVector3 b=x2-x0;
const btVector3 c=x3-x0;
- return(dot(a,cross(b,c)));
+ return(btDot(a,btCross(b,c)));
}
//
@@ -209,9 +209,9 @@ void btSoftBodyHelpers::Draw( btSoftBody* psb,
{
const btSoftBody::RContact& c=psb->m_rcontacts[i];
const btVector3 o= c.m_node->m_x-c.m_cti.m_normal*
- (dot(c.m_node->m_x,c.m_cti.m_normal)+c.m_cti.m_offset);
- const btVector3 x=cross(c.m_cti.m_normal,axis[c.m_cti.m_normal.minAxis()]).normalized();
- const btVector3 y=cross(x,c.m_cti.m_normal).normalized();
+ (btDot(c.m_node->m_x,c.m_cti.m_normal)+c.m_cti.m_offset);
+ const btVector3 x=btCross(c.m_cti.m_normal,axis[c.m_cti.m_normal.minAxis()]).normalized();
+ const btVector3 y=btCross(x,c.m_cti.m_normal).normalized();
idraw->drawLine(o-x*nscl,o+x*nscl,ccolor);
idraw->drawLine(o-y*nscl,o+y*nscl,ccolor);
idraw->drawLine(o,o+c.m_cti.m_normal*nscl*3,btVector3(1,1,0));
@@ -299,7 +299,7 @@ void btSoftBodyHelpers::Draw( btSoftBody* psb,
{
const btSoftBody::Cluster& c=psb->m_clusters[i];
const btVector3 r=c.m_nodes[j]->m_x-c.m_com;
- const btVector3 v=c.m_lv+cross(c.m_av,r);
+ const btVector3 v=c.m_lv+btCross(c.m_av,r);
idraw->drawLine(c.m_nodes[j]->m_x,c.m_nodes[j]->m_x+v,btVector3(1,0,0));
}
#endif
diff --git a/src/BulletSoftBody/btSoftBodyInternals.h b/src/BulletSoftBody/btSoftBodyInternals.h
index 5f0f7d543..f790d3725 100644
--- a/src/BulletSoftBody/btSoftBodyInternals.h
+++ b/src/BulletSoftBody/btSoftBodyInternals.h
@@ -124,11 +124,11 @@ public:
virtual btVector3 localGetSupportingVertex(const btVector3& vec) const
{
btSoftBody::Node* const * n=&m_cluster->m_nodes[0];
- btScalar d=dot(vec,n[0]->m_x);
+ btScalar d=btDot(vec,n[0]->m_x);
int j=0;
for(int i=1,ni=m_cluster->m_nodes.size();i<ni;++i)
{
- const btScalar k=dot(vec,n[i]->m_x);
+ const btScalar k=btDot(vec,n[i]->m_x);
if(k>d) { d=k;j=i; }
}
return(n[j]->m_x);
@@ -296,9 +296,9 @@ static inline btMatrix3x3 Mul(const btMatrix3x3& a,
//
static inline void Orthogonalize(btMatrix3x3& m)
{
- m[2]=cross(m[0],m[1]).normalized();
- m[1]=cross(m[2],m[0]).normalized();
- m[0]=cross(m[1],m[2]).normalized();
+ m[2]=btCross(m[0],m[1]).normalized();
+ m[1]=btCross(m[2],m[0]).normalized();
+ m[0]=btCross(m[1],m[2]).normalized();
}
//
static inline btMatrix3x3 MassMatrix(btScalar im,const btMatrix3x3& iwi,const btVector3& r)
@@ -335,7 +335,7 @@ static inline btMatrix3x3 AngularImpulseMatrix( const btMatrix3x3& iia,
static inline btVector3 ProjectOnAxis( const btVector3& v,
const btVector3& a)
{
- return(a*dot(v,a));
+ return(a*btDot(v,a));
}
//
static inline btVector3 ProjectOnPlane( const btVector3& v,
@@ -354,7 +354,7 @@ static inline void ProjectOrigin( const btVector3& a,
const btScalar m2=d.length2();
if(m2>SIMD_EPSILON)
{
- const btScalar t=Clamp<btScalar>(-dot(a,d)/m2,0,1);
+ const btScalar t=Clamp<btScalar>(-btDot(a,d)/m2,0,1);
const btVector3 p=a+d*t;
const btScalar l2=p.length2();
if(l2<sqd)
@@ -371,19 +371,19 @@ static inline void ProjectOrigin( const btVector3& a,
btVector3& prj,
btScalar& sqd)
{
- const btVector3& q=cross(b-a,c-a);
+ const btVector3& q=btCross(b-a,c-a);
const btScalar m2=q.length2();
if(m2>SIMD_EPSILON)
{
const btVector3 n=q/btSqrt(m2);
- const btScalar k=dot(a,n);
+ const btScalar k=btDot(a,n);
const btScalar k2=k*k;
if(k2<sqd)
{
const btVector3 p=n*k;
- if( (dot(cross(a-p,b-p),q)>0)&&
- (dot(cross(b-p,c-p),q)>0)&&
- (dot(cross(c-p,a-p),q)>0))
+ if( (btDot(btCross(a-p,b-p),q)>0)&&
+ (btDot(btCross(b-p,c-p),q)>0)&&
+ (btDot(btCross(c-p,a-p),q)>0))
{
prj=p;
sqd=k2;
@@ -413,9 +413,9 @@ static inline btVector3 BaryCoord( const btVector3& a,
const btVector3& c,
const btVector3& p)
{
- const btScalar w[]={ cross(a-p,b-p).length(),
- cross(b-p,c-p).length(),
- cross(c-p,a-p).length()};
+ const btScalar w[]={ btCross(a-p,b-p).length(),
+ btCross(b-p,c-p).length(),
+ btCross(c-p,a-p).length()};
const btScalar isum=1/(w[0]+w[1]+w[2]);
return(btVector3(w[1]*isum,w[2]*isum,w[0]*isum));
}
@@ -485,7 +485,7 @@ static inline btScalar AreaOf( const btVector3& x0,
{
const btVector3 a=x1-x0;
const btVector3 b=x2-x0;
- const btVector3 cr=cross(a,b);
+ const btVector3 cr=btCross(a,b);
const btScalar area=cr.length();
return(area);
}
@@ -499,7 +499,7 @@ static inline btScalar VolumeOf( const btVector3& x0,
const btVector3 a=x1-x0;
const btVector3 b=x2-x0;
const btVector3 c=x3-x0;
- return(dot(a,cross(b,c)));
+ return(btDot(a,btCross(b,c)));
}
//
@@ -512,7 +512,7 @@ static void EvaluateMedium( const btSoftBodyWorldInfo* wfi,
medium.m_density = wfi->air_density;
if(wfi->water_density>0)
{
- const btScalar depth=-(dot(x,wfi->water_normal)+wfi->water_offset);
+ const btScalar depth=-(btDot(x,wfi->water_normal)+wfi->water_offset);
if(depth>0)
{
medium.m_density = wfi->water_density;
@@ -676,7 +676,7 @@ struct btSoftColliders
const btVector3 va=ba.velocity(ra);
const btVector3 vb=bb.velocity(rb);
const btVector3 vrel=va-vb;
- const btScalar rvac=dot(vrel,res.normal);
+ const btScalar rvac=btDot(vrel,res.normal);
const btScalar depth=res.distance-margin;
const btVector3 iv=res.normal*rvac;
const btVector3 fv=vrel-iv;
@@ -839,7 +839,7 @@ struct btSoftColliders
const btVector3 va=m_rigidBody ? m_rigidBody->getVelocityInLocalPoint(ra)*psb->m_sst.sdt : btVector3(0,0,0);
const btVector3 vb=n.m_x-n.m_q;
const btVector3 vr=vb-va;
- const btScalar dn=dot(vr,c.m_cti.m_normal);
+ const btScalar dn=btDot(vr,c.m_cti.m_normal);
const btVector3 fv=vr-c.m_cti.m_normal*dn;
const btScalar fc=psb->m_cfg.kDF*m_colObj1->getFriction();
c.m_node = &n;
diff --git a/src/LinearMath/btConvexHull.cpp b/src/LinearMath/btConvexHull.cpp
index 419c752a1..a5b73c594 100644
--- a/src/LinearMath/btConvexHull.cpp
+++ b/src/LinearMath/btConvexHull.cpp
@@ -96,21 +96,21 @@ btVector3 PlaneLineIntersection(const btPlane &plane, const btVector3 &p0, const
// returns the point where the line p0-p1 intersects the plane n&d
static btVector3 dif;
dif = p1-p0;
- btScalar dn= dot(plane.normal,dif);
- btScalar t = -(plane.dist+dot(plane.normal,p0) )/dn;
+ btScalar dn= btDot(plane.normal,dif);
+ btScalar t = -(plane.dist+btDot(plane.normal,p0) )/dn;
return p0 + (dif*t);
}
btVector3 PlaneProject(const btPlane &plane, const btVector3 &point)
{
- return point - plane.normal * (dot(point,plane.normal)+plane.dist);
+ return point - plane.normal * (btDot(point,plane.normal)+plane.dist);
}
btVector3 TriNormal(const btVector3 &v0, const btVector3 &v1, const btVector3 &v2)
{
// return the normal of the triangle
// inscribed by v0, v1, and v2
- btVector3 cp=cross(v1-v0,v2-v1);
+ btVector3 cp=btCross(v1-v0,v2-v1);
btScalar m=cp.length();
if(m==0) return btVector3(1,0,0);
return cp*(btScalar(1.0)/m);
@@ -120,23 +120,23 @@ btVector3 TriNormal(const btVector3 &v0, const btVector3 &v1, const btVector3 &v
btScalar DistanceBetweenLines(const btVector3 &ustart, const btVector3 &udir, const btVector3 &vstart, const btVector3 &vdir, btVector3 *upoint, btVector3 *vpoint)
{
static btVector3 cp;
- cp = cross(udir,vdir).normalized();
+ cp = btCross(udir,vdir).normalized();
- btScalar distu = -dot(cp,ustart);
- btScalar distv = -dot(cp,vstart);
+ btScalar distu = -btDot(cp,ustart);
+ btScalar distv = -btDot(cp,vstart);
btScalar dist = (btScalar)fabs(distu-distv);
if(upoint)
{
btPlane plane;
- plane.normal = cross(vdir,cp).normalized();
- plane.dist = -dot(plane.normal,vstart);
+ plane.normal = btCross(vdir,cp).normalized();
+ plane.dist = -btDot(plane.normal,vstart);
*upoint = PlaneLineIntersection(plane,ustart,ustart+udir);
}
if(vpoint)
{
btPlane plane;
- plane.normal = cross(udir,cp).normalized();
- plane.dist = -dot(plane.normal,ustart);
+ plane.normal = btCross(udir,cp).normalized();
+ plane.dist = -btDot(plane.normal,ustart);
*vpoint = PlaneLineIntersection(plane,vstart,vstart+vdir);
}
return dist;
@@ -170,7 +170,7 @@ ConvexH::ConvexH(int vertices_size,int edges_size,int facets_size)
int PlaneTest(const btPlane &p, const btVector3 &v);
int PlaneTest(const btPlane &p, const btVector3 &v) {
- btScalar a = dot(v,p.normal)+p.dist;
+ btScalar a = btDot(v,p.normal)+p.dist;
int flag = (a>planetestepsilon)?OVER:((a<-planetestepsilon)?UNDER:COPLANAR);
return flag;
}
@@ -228,7 +228,7 @@ int maxdirfiltered(const T *p,int count,const T &dir,btAlignedObjectArray<int> &
for(int i=0;i<count;i++)
if(allow[i])
{
- if(m==-1 || dot(p[i],dir)>dot(p[m],dir))
+ if(m==-1 || btDot(p[i],dir)>btDot(p[m],dir))
m=i;
}
btAssert(m!=-1);
@@ -238,8 +238,8 @@ int maxdirfiltered(const T *p,int count,const T &dir,btAlignedObjectArray<int> &
btVector3 orth(const btVector3 &v);
btVector3 orth(const btVector3 &v)
{
- btVector3 a=cross(v,btVector3(0,0,1));
- btVector3 b=cross(v,btVector3(0,1,0));
+ btVector3 a=btCross(v,btVector3(0,0,1));
+ btVector3 b=btCross(v,btVector3(0,1,0));
if (a.length() > b.length())
{
return a.normalized();
@@ -258,7 +258,7 @@ int maxdirsterid(const T *p,int count,const T &dir,btAlignedObjectArray<int> &al
m = maxdirfiltered(p,count,dir,allow);
if(allow[m]==3) return m;
T u = orth(dir);
- T v = cross(u,dir);
+ T v = btCross(u,dir);
int ma=-1;
for(btScalar x = btScalar(0.0) ; x<= btScalar(360.0) ; x+= btScalar(45.0))
{
@@ -313,7 +313,7 @@ int above(btVector3* vertices,const int3& t, const btVector3 &p, btScalar epsilo
int above(btVector3* vertices,const int3& t, const btVector3 &p, btScalar epsilon)
{
btVector3 n=TriNormal(vertices[t[0]],vertices[t[1]],vertices[t[2]]);
- return (dot(n,p-vertices[t[0]]) > epsilon); // EPSILON???
+ return (btDot(n,p-vertices[t[0]]) > epsilon); // EPSILON???
}
int hasedge(const int3 &t, int a,int b);
int hasedge(const int3 &t, int a,int b)
@@ -495,8 +495,8 @@ int4 HullLibrary::FindSimplex(btVector3 *verts,int verts_count,btAlignedObjectAr
basis[0] = verts[p0]-verts[p1];
if(p0==p1 || basis[0]==btVector3(0,0,0))
return int4(-1,-1,-1,-1);
- basis[1] = cross(btVector3( btScalar(1),btScalar(0.02), btScalar(0)),basis[0]);
- basis[2] = cross(btVector3(btScalar(-0.02), btScalar(1), btScalar(0)),basis[0]);
+ basis[1] = btCross(btVector3( btScalar(1),btScalar(0.02), btScalar(0)),basis[0]);
+ basis[2] = btCross(btVector3(btScalar(-0.02), btScalar(1), btScalar(0)),basis[0]);
if (basis[1].length() > basis[2].length())
{
basis[1].normalize();
@@ -512,13 +512,13 @@ int4 HullLibrary::FindSimplex(btVector3 *verts,int verts_count,btAlignedObjectAr
if(p2 == p0 || p2 == p1)
return int4(-1,-1,-1,-1);
basis[1] = verts[p2] - verts[p0];
- basis[2] = cross(basis[1],basis[0]).normalized();
+ basis[2] = btCross(basis[1],basis[0]).normalized();
int p3 = maxdirsterid(verts,verts_count,basis[2],allow);
if(p3==p0||p3==p1||p3==p2) p3 = maxdirsterid(verts,verts_count,-basis[2],allow);
if(p3==p0||p3==p1||p3==p2)
return int4(-1,-1,-1,-1);
btAssert(!(p0==p1||p0==p2||p0==p3||p1==p2||p1==p3||p2==p3));
- if(dot(verts[p3]-verts[p0],cross(verts[p1]-verts[p0],verts[p2]-verts[p0])) <0) {Swap(p2,p3);}
+ if(btDot(verts[p3]-verts[p0],btCross(verts[p1]-verts[p0],verts[p2]-verts[p0])) <0) {Swap(p2,p3);}
return int4(p0,p1,p2,p3);
}
@@ -564,7 +564,7 @@ int HullLibrary::calchullgen(btVector3 *verts,int verts_count, int vlimit)
btAssert(t->vmax<0);
btVector3 n=TriNormal(verts[(*t)[0]],verts[(*t)[1]],verts[(*t)[2]]);
t->vmax = maxdirsterid(verts,verts_count,n,allow);
- t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);
+ t->rise = btDot(n,verts[t->vmax]-verts[(*t)[0]]);
}
btHullTriangle *te;
vlimit-=4;
@@ -592,7 +592,7 @@ int HullLibrary::calchullgen(btVector3 *verts,int verts_count, int vlimit)
if(!m_tris[j]) continue;
if(!hasvert(*m_tris[j],v)) break;
int3 nt=*m_tris[j];
- if(above(verts,nt,center,btScalar(0.01)*epsilon) || cross(verts[nt[1]]-verts[nt[0]],verts[nt[2]]-verts[nt[1]]).length()< epsilon*epsilon*btScalar(0.1) )
+ if(above(verts,nt,center,btScalar(0.01)*epsilon) || btCross(verts[nt[1]]-verts[nt[0]],verts[nt[2]]-verts[nt[1]]).length()< epsilon*epsilon*btScalar(0.1) )
{
btHullTriangle *nb = m_tris[m_tris[j]->n[0]];
btAssert(nb);btAssert(!hasvert(*nb,v));btAssert(nb->id<j);
@@ -614,7 +614,7 @@ int HullLibrary::calchullgen(btVector3 *verts,int verts_count, int vlimit)
}
else
{
- t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);
+ t->rise = btDot(n,verts[t->vmax]-verts[(*t)[0]]);
}
}
vlimit --;
diff --git a/src/LinearMath/btMatrix3x3.h b/src/LinearMath/btMatrix3x3.h
index e45afc3c0..ea26bbbba 100644
--- a/src/LinearMath/btMatrix3x3.h
+++ b/src/LinearMath/btMatrix3x3.h
@@ -503,7 +503,7 @@ class btMatrix3x3 {
SIMD_FORCE_INLINE btScalar
btMatrix3x3::determinant() const
{
- return triple((*this)[0], (*this)[1], (*this)[2]);
+ return btTriple((*this)[0], (*this)[1], (*this)[2]);
}
diff --git a/src/LinearMath/btQuaternion.h b/src/LinearMath/btQuaternion.h
index efcac3a5f..f530c71df 100644
--- a/src/LinearMath/btQuaternion.h
+++ b/src/LinearMath/btQuaternion.h
@@ -261,6 +261,18 @@ public:
return (-qd);
}
+ /**@todo document this and it's use */
+ SIMD_FORCE_INLINE btQuaternion nearest( const btQuaternion& qd) const
+ {
+ btQuaternion diff,sum;
+ diff = *this - qd;
+ sum = *this + qd;
+ if( diff.dot(diff) < sum.dot(sum) )
+ return qd;
+ return (-qd);
+ }
+
+
/**@brief Return the quaternion which is the result of Spherical Linear Interpolation between this and the other quaternion
* @param q The other quaternion to interpolate with
* @param t The ratio between this and q to interpolate. If t = 0 the result is this, if t=1 the result is q.
diff --git a/src/LinearMath/btTransformUtil.h b/src/LinearMath/btTransformUtil.h
index 7a090df62..1603d3e05 100644
--- a/src/LinearMath/btTransformUtil.h
+++ b/src/LinearMath/btTransformUtil.h
@@ -96,7 +96,7 @@ public:
static void calculateDiffAxisAngleQuaternion(const btQuaternion& orn0,const btQuaternion& orn1a,btVector3& axis,btScalar& angle)
{
- btQuaternion orn1 = orn0.farthest(orn1a);
+ btQuaternion orn1 = orn0.nearest(orn1a);
btQuaternion dorn = orn1 * orn0.inverse();
///floating point inaccuracy can lead to w component > 1..., which breaks
dorn.normalize();
@@ -206,17 +206,21 @@ public:
void initSeparatingDistance(const btVector3& separatingVector,btScalar separatingDistance,const btTransform& transA,const btTransform& transB)
{
- m_separatingNormal = separatingVector;
m_separatingDistance = separatingDistance;
-
- const btVector3& toPosA = transA.getOrigin();
- const btVector3& toPosB = transB.getOrigin();
- btQuaternion toOrnA = transA.getRotation();
- btQuaternion toOrnB = transB.getRotation();
- m_posA = toPosA;
- m_posB = toPosB;
- m_ornA = toOrnA;
- m_ornB = toOrnB;
+
+ if (m_separatingDistance>0.f)
+ {
+ m_separatingNormal = separatingVector;
+
+ const btVector3& toPosA = transA.getOrigin();
+ const btVector3& toPosB = transB.getOrigin();
+ btQuaternion toOrnA = transA.getRotation();
+ btQuaternion toOrnB = transB.getRotation();
+ m_posA = toPosA;
+ m_posB = toPosB;
+ m_ornA = toOrnA;
+ m_ornB = toOrnB;
+ }
}
};
diff --git a/src/LinearMath/btVector3.h b/src/LinearMath/btVector3.h
index ada94d88b..c49028dd6 100644
--- a/src/LinearMath/btVector3.h
+++ b/src/LinearMath/btVector3.h
@@ -306,7 +306,7 @@ public:
m_floats[0]=x;
m_floats[1]=y;
m_floats[2]=z;
- m_floats[3] = 0.f;
+ m_floats[3] = btScalar(0.);
}
void getSkewSymmetricMatrix(btVector3* v0,btVector3* v1,btVector3* v2) const
@@ -316,6 +316,11 @@ public:
v2->setValue(-y() ,x() ,0.);
}
+ void setZero()
+ {
+ setValue(btScalar(0.),btScalar(0.),btScalar(0.));
+ }
+
};
/**@brief Return the sum of two vectors (Point symantics)*/
@@ -376,7 +381,7 @@ operator/(const btVector3& v1, const btVector3& v2)
/**@brief Return the dot product between two vectors */
SIMD_FORCE_INLINE btScalar
-dot(const btVector3& v1, const btVector3& v2)
+btDot(const btVector3& v1, const btVector3& v2)
{
return v1.dot(v2);
}
@@ -384,7 +389,7 @@ dot(const btVector3& v1, const btVector3& v2)
/**@brief Return the distance squared between two vectors */
SIMD_FORCE_INLINE btScalar
-distance2(const btVector3& v1, const btVector3& v2)
+btDistance2(const btVector3& v1, const btVector3& v2)
{
return v1.distance2(v2);
}
@@ -392,27 +397,27 @@ distance2(const btVector3& v1, const btVector3& v2)
/**@brief Return the distance between two vectors */
SIMD_FORCE_INLINE btScalar
-distance(const btVector3& v1, const btVector3& v2)
+btDistance(const btVector3& v1, const btVector3& v2)
{
return v1.distance(v2);
}
/**@brief Return the angle between two vectors */
SIMD_FORCE_INLINE btScalar
-angle(const btVector3& v1, const btVector3& v2)
+btAngle(const btVector3& v1, const btVector3& v2)
{
return v1.angle(v2);
}
/**@brief Return the cross product of two vectors */
SIMD_FORCE_INLINE btVector3
-cross(const btVector3& v1, const btVector3& v2)
+btCross(const btVector3& v1, const btVector3& v2)
{
return v1.cross(v2);
}
SIMD_FORCE_INLINE btScalar
-triple(const btVector3& v1, const btVector3& v2, const btVector3& v3)
+btTriple(const btVector3& v1, const btVector3& v2, const btVector3& v3)
{
return v1.triple(v2, v3);
}