|
Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
106 for (
int i=0;i<numVectors;i++)
115 for (
int j=0;j<numVectors;j++)
221 CenterCallback() : first(
true), ref(0, 0, 0),
sum(0, 0, 0), volume(0)
225 virtual void internalProcessTriangleIndex(
btVector3* triangle,
int partId,
int triangleIndex)
227 (void) triangleIndex;
236 btScalar vol =
btFabs((triangle[0] - ref).triple(triangle[1] - ref, triangle[2] - ref));
237 sum += (
btScalar(0.25) * vol) * ((triangle[0] + triangle[1] + triangle[2] + ref));
244 return (volume > 0) ?
sum / volume : ref;
261 InertiaCallback(
btVector3& center) :
sum(0, 0, 0, 0, 0, 0, 0, 0, 0), center(center)
265 virtual void internalProcessTriangleIndex(
btVector3* triangle,
int partId,
int triangleIndex)
267 (void) triangleIndex;
274 for (
int j = 0; j < 3; j++)
276 for (
int k = 0; k <= j; k++)
278 i[j][k] = i[k][j] = volNeg * (
btScalar(0.1) * (a[j] * a[k] + b[j] * b[k] + c[j] * c[k])
279 +
btScalar(0.05) * (a[j] * b[k] + a[k] * b[j] + a[j] * c[k] + a[k] * c[j] + b[j] * c[k] + b[k] * c[j]));
300 CenterCallback centerCallback;
303 btVector3 center = centerCallback.getCenter();
305 volume = centerCallback.getVolume();
307 InertiaCallback inertiaCallback(center);
312 inertia.
setValue(i[0][0], i[1][1], i[2][2]);
btScalar dot(const btQuaternion &q1, const btQuaternion &q2)
Calculate the dot product between two quaternions.
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...
btVector3 m_supportVecLocal
virtual bool isInside(const btVector3 &pt, btScalar tolerance) const
virtual btVector3 localGetSupportingVertexWithoutMargin(const btVector3 &vec) const
btVector3 GetSupportVertexLocal()
void setScaling(const btVector3 &scaling)
virtual void getEdge(int i, btVector3 &pa, btVector3 &pb) const
btScalar dot(const btVector3 &v) const
Return the dot product.
virtual void InternalProcessAllTriangles(btInternalTriangleIndexCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
virtual int getNumEdges() const
The btStridingMeshInterface is the interface class for high performance generic access to triangle me...
class btStridingMeshInterface * m_stridingMesh
The btPolyhedralConvexAabbCachingShape adds aabb caching to the btPolyhedralConvexShape.
btScalar btFabs(btScalar x)
@ CONVEX_TRIANGLEMESH_SHAPE_PROXYTYPE
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
void diagonalize(btMatrix3x3 &rot, btScalar tolerance=1.0e-9, int maxIter=100)
diagonalizes this matrix
btVector3 can be used to represent 3D points and vectors.
virtual const btVector3 & getLocalScaling() const
virtual btScalar getMargin() const
const btVector3 & getScaling() const
btScalar triple(const btVector3 &v1, const btVector3 &v2) const
virtual int getNumPlanes() const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
void calculatePrincipalAxisTransform(btTransform &principal, btVector3 &inertia, btScalar &volume) const
computes the exact moment of inertia and the transform from the coordinate system defined by the prin...
virtual int getNumVertices() const
virtual void internalProcessTriangleIndex(btVector3 *triangle, int partId, int triangleIndex)
It's not nice to have all this virtual function overhead, so perhaps we can also gather the points on...
virtual btVector3 localGetSupportingVertex(const btVector3 &vec) const
btConvexTriangleMeshShape(btStridingMeshInterface *meshInterface, bool calcAabb=true)
virtual void setLocalScaling(const btVector3 &scaling)
btScalar btSqrt(btScalar y)
btVector3 m_supportVertexLocal
LocalSupportVertexCallback(const btVector3 &supportVecLocal)
btVector3 & normalize()
Normalize this vector x^2 + y^2 + z^2 = 1.
virtual void getVertex(int i, btVector3 &vtx) const
static T sum(const btAlignedObjectArray< T > &items)
virtual void getPlane(btVector3 &planeNormal, btVector3 &planeSupport, int i) const
btScalar length2() const
Return the length of the vector squared.