- Timestamp:
- Feb 27, 2011, 7:43:24 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/kicklib/src/external/bullet/LinearMath/btConvexHull.cpp
r5781 r7983 17 17 18 18 #include "btConvexHull.h" 19 #include " LinearMath/btAlignedObjectArray.h"20 #include " LinearMath/btMinMax.h"21 #include " LinearMath/btVector3.h"19 #include "btAlignedObjectArray.h" 20 #include "btMinMax.h" 21 #include "btVector3.h" 22 22 23 23 … … 97 97 static btVector3 dif; 98 98 dif = p1-p0; 99 btScalar dn= dot(plane.normal,dif);100 btScalar t = -(plane.dist+ dot(plane.normal,p0) )/dn;99 btScalar dn= btDot(plane.normal,dif); 100 btScalar t = -(plane.dist+btDot(plane.normal,p0) )/dn; 101 101 return p0 + (dif*t); 102 102 } … … 104 104 btVector3 PlaneProject(const btPlane &plane, const btVector3 &point) 105 105 { 106 return point - plane.normal * ( dot(point,plane.normal)+plane.dist);106 return point - plane.normal * (btDot(point,plane.normal)+plane.dist); 107 107 } 108 108 … … 111 111 // return the normal of the triangle 112 112 // inscribed by v0, v1, and v2 113 btVector3 cp= cross(v1-v0,v2-v1);113 btVector3 cp=btCross(v1-v0,v2-v1); 114 114 btScalar m=cp.length(); 115 115 if(m==0) return btVector3(1,0,0); … … 121 121 { 122 122 static btVector3 cp; 123 cp = cross(udir,vdir).normalized();124 125 btScalar distu = - dot(cp,ustart);126 btScalar distv = - dot(cp,vstart);123 cp = btCross(udir,vdir).normalized(); 124 125 btScalar distu = -btDot(cp,ustart); 126 btScalar distv = -btDot(cp,vstart); 127 127 btScalar dist = (btScalar)fabs(distu-distv); 128 128 if(upoint) 129 129 { 130 130 btPlane plane; 131 plane.normal = cross(vdir,cp).normalized();132 plane.dist = - dot(plane.normal,vstart);131 plane.normal = btCross(vdir,cp).normalized(); 132 plane.dist = -btDot(plane.normal,vstart); 133 133 *upoint = PlaneLineIntersection(plane,ustart,ustart+udir); 134 134 } … … 136 136 { 137 137 btPlane plane; 138 plane.normal = cross(udir,cp).normalized();139 plane.dist = - dot(plane.normal,ustart);138 plane.normal = btCross(udir,cp).normalized(); 139 plane.dist = -btDot(plane.normal,ustart); 140 140 *vpoint = PlaneLineIntersection(plane,vstart,vstart+vdir); 141 141 } … … 171 171 int PlaneTest(const btPlane &p, const btVector3 &v); 172 172 int PlaneTest(const btPlane &p, const btVector3 &v) { 173 btScalar a = dot(v,p.normal)+p.dist;173 btScalar a = btDot(v,p.normal)+p.dist; 174 174 int flag = (a>planetestepsilon)?OVER:((a<-planetestepsilon)?UNDER:COPLANAR); 175 175 return flag; … … 229 229 if(allow[i]) 230 230 { 231 if(m==-1 || dot(p[i],dir)>dot(p[m],dir))231 if(m==-1 || btDot(p[i],dir)>btDot(p[m],dir)) 232 232 m=i; 233 233 } … … 239 239 btVector3 orth(const btVector3 &v) 240 240 { 241 btVector3 a= cross(v,btVector3(0,0,1));242 btVector3 b= cross(v,btVector3(0,1,0));241 btVector3 a=btCross(v,btVector3(0,0,1)); 242 btVector3 b=btCross(v,btVector3(0,1,0)); 243 243 if (a.length() > b.length()) 244 244 { … … 259 259 if(allow[m]==3) return m; 260 260 T u = orth(dir); 261 T v = cross(u,dir);261 T v = btCross(u,dir); 262 262 int ma=-1; 263 263 for(btScalar x = btScalar(0.0) ; x<= btScalar(360.0) ; x+= btScalar(45.0)) … … 314 314 { 315 315 btVector3 n=TriNormal(vertices[t[0]],vertices[t[1]],vertices[t[2]]); 316 return ( dot(n,p-vertices[t[0]]) > epsilon); // EPSILON???316 return (btDot(n,p-vertices[t[0]]) > epsilon); // EPSILON??? 317 317 } 318 318 int hasedge(const int3 &t, int a,int b); … … 496 496 if(p0==p1 || basis[0]==btVector3(0,0,0)) 497 497 return int4(-1,-1,-1,-1); 498 basis[1] = cross(btVector3( btScalar(1),btScalar(0.02), btScalar(0)),basis[0]);499 basis[2] = cross(btVector3(btScalar(-0.02), btScalar(1), btScalar(0)),basis[0]);498 basis[1] = btCross(btVector3( btScalar(1),btScalar(0.02), btScalar(0)),basis[0]); 499 basis[2] = btCross(btVector3(btScalar(-0.02), btScalar(1), btScalar(0)),basis[0]); 500 500 if (basis[1].length() > basis[2].length()) 501 501 { … … 513 513 return int4(-1,-1,-1,-1); 514 514 basis[1] = verts[p2] - verts[p0]; 515 basis[2] = cross(basis[1],basis[0]).normalized();515 basis[2] = btCross(basis[1],basis[0]).normalized(); 516 516 int p3 = maxdirsterid(verts,verts_count,basis[2],allow); 517 517 if(p3==p0||p3==p1||p3==p2) p3 = maxdirsterid(verts,verts_count,-basis[2],allow); … … 519 519 return int4(-1,-1,-1,-1); 520 520 btAssert(!(p0==p1||p0==p2||p0==p3||p1==p2||p1==p3||p2==p3)); 521 if( dot(verts[p3]-verts[p0],cross(verts[p1]-verts[p0],verts[p2]-verts[p0])) <0) {Swap(p2,p3);}521 if(btDot(verts[p3]-verts[p0],btCross(verts[p1]-verts[p0],verts[p2]-verts[p0])) <0) {Swap(p2,p3);} 522 522 return int4(p0,p1,p2,p3); 523 523 } … … 565 565 btVector3 n=TriNormal(verts[(*t)[0]],verts[(*t)[1]],verts[(*t)[2]]); 566 566 t->vmax = maxdirsterid(verts,verts_count,n,allow); 567 t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);567 t->rise = btDot(n,verts[t->vmax]-verts[(*t)[0]]); 568 568 } 569 569 btHullTriangle *te; … … 593 593 if(!hasvert(*m_tris[j],v)) break; 594 594 int3 nt=*m_tris[j]; 595 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) )595 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) ) 596 596 { 597 597 btHullTriangle *nb = m_tris[m_tris[j]->n[0]]; … … 615 615 else 616 616 { 617 t->rise = dot(n,verts[t->vmax]-verts[(*t)[0]]);617 t->rise = btDot(n,verts[t->vmax]-verts[(*t)[0]]); 618 618 } 619 619 } … … 877 877 vcount = 0; 878 878 879 btScalar recip[3] ;879 btScalar recip[3]={0.f,0.f,0.f}; 880 880 881 881 if ( scale ) … … 1012 1012 btScalar z = v[2]; 1013 1013 1014 btScalar dx = fabsf(x - px );1015 btScalar dy = fabsf(y - py );1016 btScalar dz = fabsf(z - pz );1014 btScalar dx = btFabs(x - px ); 1015 btScalar dy = btFabs(y - py ); 1016 btScalar dz = btFabs(z - pz ); 1017 1017 1018 1018 if ( dx < normalepsilon && dy < normalepsilon && dz < normalepsilon ) … … 1136 1136 ocount = 0; 1137 1137 1138 for (i=0; i<in dexcount; i++)1138 for (i=0; i<int (indexcount); i++) 1139 1139 { 1140 1140 unsigned int v = indices[i]; // original array index … … 1157 1157 for (int k=0;k<m_vertexIndexMapping.size();k++) 1158 1158 { 1159 if (tmpIndices[k]== v)1159 if (tmpIndices[k]==int(v)) 1160 1160 m_vertexIndexMapping[k]=ocount; 1161 1161 }
Note: See TracChangeset
for help on using the changeset viewer.