| Bullet Collision Detection & Physics Library
    | 
 
 
 
Go to the documentation of this file.
   15 #if defined(_WIN32) || defined(__i386__) 
   16 #define BT_USE_SSE_IN_API 
   74         if (shiftVerticesByMargin)
 
   80                 for (
int p = 0; p < planeEquations.
size(); p++)
 
   99 #ifndef BT_RECONSTRUCT_FACES 
  103         for (
int p = 0; p < numVertices; p++)
 
  109         for (
int j = 0; j < conv.
faces.
size(); j++)
 
  126                                 edges[numEdges++] = newEdge;
 
  151                 combinedFace.
m_plane[0] = faceNormal.getX();
 
  152                 combinedFace.
m_plane[1] = faceNormal.getY();
 
  153                 combinedFace.
m_plane[2] = faceNormal.getZ();
 
  154                 combinedFace.
m_plane[3] = -planeEq;
 
  159 #else  //BT_RECONSTRUCT_FACES 
  163         faceNormals.
resize(numFaces);
 
  167         tmpFaces.
resize(numFaces);
 
  171         for (
int p = 0; p < numVertices; p++)
 
  176         for (
int i = 0; i < numFaces; i++)
 
  178                 int face = convexUtil->
faces[i];
 
  198                                 edges[numEdges++] = newEdge;
 
  201                 } 
while (edge != firstEdge);
 
  207                         faceNormals[i] = edges[0].
cross(edges[1]);
 
  208                         faceNormals[i].normalize();
 
  209                         tmpFaces[i].m_plane[0] = faceNormals[i].getX();
 
  210                         tmpFaces[i].m_plane[1] = faceNormals[i].getY();
 
  211                         tmpFaces[i].m_plane[2] = faceNormals[i].getZ();
 
  212                         tmpFaces[i].m_plane[3] = planeEq;
 
  217                         faceNormals[i].setZero();
 
  220                 for (
int v = 0; v < tmpFaces[i].m_indices.
size(); v++)
 
  228                 tmpFaces[i].m_plane[3] = -planeEq;
 
  233         btScalar faceWeldThreshold = 0.999f;
 
  235         for (
int i = 0; i < tmpFaces.
size(); i++)
 
  238         while (todoFaces.
size())
 
  241                 int refFace = todoFaces[todoFaces.
size() - 1];
 
  244                 btFace& faceA = tmpFaces[refFace];
 
  248                 for (
int j = todoFaces.
size() - 1; j >= 0; j--)
 
  250                         int i = todoFaces[j];
 
  251                         btFace& faceB = tmpFaces[i];
 
  253                         if (faceNormalA.
dot(faceNormalB) > faceWeldThreshold)
 
  260                 bool did_merge = 
false;
 
  261                 if (coplanarFaceGroup.
size() > 1)
 
  268                         for (
int i = 0; i < coplanarFaceGroup.
size(); i++)
 
  272                                 btFace& face = tmpFaces[coplanarFaceGroup[i]];
 
  274                                 averageFaceNormal += faceNormal;
 
  282                                         for (
int i = 0; i < orgpoints.
size(); i++)
 
  285                                                 if (orgpoints[i].m_orgIndex == orgIndex)
 
  297                         for (
int i = 0; i < 4; i++)
 
  298                                 combinedFace.
m_plane[i] = tmpFaces[coplanarFaceGroup[0]].m_plane[i];
 
  305                         for (
int i = 0; i < hull.size(); i++)
 
  308                                 for (
int k = 0; k < orgpoints.
size(); k++)
 
  310                                         if (orgpoints[k].m_orgIndex == hull[i].m_orgIndex)
 
  312                                                 orgpoints[k].m_orgIndex = -1;  
 
  319                         bool reject_merge = 
false;
 
  321                         for (
int i = 0; i < orgpoints.
size(); i++)
 
  323                                 if (orgpoints[i].m_orgIndex == -1)
 
  326                                 for (
int j = 0; j < tmpFaces.
size(); j++)
 
  328                                         btFace& face = tmpFaces[j];
 
  330                                         bool is_in_current_group = 
false;
 
  331                                         for (
int k = 0; k < coplanarFaceGroup.
size(); k++)
 
  333                                                 if (coplanarFaceGroup[k] == j)
 
  335                                                         is_in_current_group = 
true;
 
  339                                         if (is_in_current_group)  
 
  344                                                 if (face.
m_indices[v] == orgpoints[i].m_orgIndex)
 
  367                         for (
int i = 0; i < coplanarFaceGroup.
size(); i++)
 
  369                                 btFace face = tmpFaces[coplanarFaceGroup[i]];
 
  375 #endif  //BT_RECONSTRUCT_FACES 
  383 #define MIN(_a, _b) ((_a) < (_b) ? (_a) : (_b)) 
  412                 for (i = 0; i < inner_count; i++)
 
  414                 i = (int)vec.
maxDot(temp, inner_count, newDot);
 
  434         for (i = 0; i < numVectors; i++)
 
  439         for (
int j = 0; j < numVectors; j++)
 
  447                         for (i = 0; i < inner_count; i++)
 
  449                         i = (int)vec.
maxDot(temp, inner_count, newDot);
 
  450                         if (newDot > supportVerticesOut[j][3])
 
  452                                 supportVerticesOut[j] = temp[i];
 
  453                                 supportVerticesOut[j][3] = newDot;
 
  471         getAabb(ident, aabbMin, aabbMax);
 
  482         inertia = scaledmass * (
btVector3(y2 + z2, x2 + z2, x2 + y2));
 
  494           m_localAabbMin(1, 1, 1),
 
  495           m_localAabbMax(-1, -1, -1),
 
  496           m_isLocalAabbValid(false)
 
  530         for (
int i = 0; i < 3; ++i)
 
  538         for (
int i = 0; i < 3; i++)
 
  
The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
virtual void calculateLocalInertia(btScalar mass, btVector3 &inertia) const
const Edge * getNextEdgeOfFace() const
void GrahamScanConvexHull2D(btAlignedObjectArray< GrahamVector3 > &originalPoints, btAlignedObjectArray< GrahamVector3 > &hull, const btVector3 &normalAxis)
btScalar m_collisionMargin
#define btAlignedFree(ptr)
void getNonvirtualAabb(const btTransform &trans, btVector3 &aabbMin, btVector3 &aabbMax, btScalar margin) const
btAlignedObjectArray< btVector3 > vertices
virtual void setPolyhedralFeatures(btConvexPolyhedron &polyhedron)
The btConvexInternalShape is an internal base class, shared by most convex shape implementations.
void setValue(const btScalar &_x, const btScalar &_y, const btScalar &_z)
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
btAlignedObjectArray< btFace > m_faces
int getTargetVertex() const
int getSourceVertex() const
virtual ~btPolyhedralConvexShape()
btVector3 cross(const btVector3 &v) const
Return the cross product between this and another vector.
btScalar dot(const btVector3 &v) const
Return the dot product.
#define btAlignedAlloc(size, alignment)
btAlignedObjectArray< int > faces
void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb's default implementation is brute force, expected derived classes to implement a fast dedicat...
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const
const btScalar & y() const
Return the y value.
btAlignedObjectArray< btVector3 > m_vertices
virtual void getVertex(int i, btVector3 &vtx) const =0
virtual void setLocalScaling(const btVector3 &scaling)
void resize(int newsize, const T &fillData=T())
btPolyhedralConvexShape()
btAlignedObjectArray< Edge > edges
Convex hull implementation based on Preparata and Hong See http://code.google.com/p/bullet/issues/det...
virtual int getNumVertices() const =0
virtual ~btConvexPolyhedron()
btVector3 can be used to represent 3D points and vectors.
virtual btScalar getMargin() const
virtual bool initializePolyhedralFeatures(int shiftVerticesByMargin=0)
optional method mainly used to generate multiple contact points by clipping polyhedral features (face...
const btScalar & x() const
Return the x value.
T & expand(const T &fillValue=T())
btAlignedObjectArray< int > m_indices
btConvexPolyhedron * m_polyhedron
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
virtual void getAabb(const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
getAabb's default implementation is brute force, expected derived classes to implement a fast dedicat...
static void getPlaneEquationsFromVertices(btAlignedObjectArray< btVector3 > &vertices, btAlignedObjectArray< btVector3 > &planeEquationsOut)
static void getVerticesFromPlaneEquations(const btAlignedObjectArray< btVector3 > &planeEquations, btAlignedObjectArray< btVector3 > &verticesOut)
btScalar compute(const void *coords, bool doubleCoords, int stride, int count, btScalar shrink, btScalar shrinkClamp)
void push_back(const T &_Val)
void remove(const T &key)
btScalar btSqrt(btScalar y)
virtual void setLocalScaling(const btVector3 &scaling)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
btPolyhedralConvexAabbCachingShape()
const btScalar & z() const
Return the z value.
int size() const
return the number of elements in the array
btScalar length2() const
Return the length of the vector squared.
long maxDot(const btVector3 *array, long array_count, btScalar &dotOut) const
returns index of maximum dot product between this and vectors in array[]