Bullet Collision Detection & Physics Library
|
Go to the documentation of this file.
52 for (
int i = 0; i < 3; i++)
97 for (
int i = 0; i < numVectors; i++)
105 for (
int j = 0; j < numVectors; j++)
194 CenterCallback() : first(
true), ref(0, 0, 0),
sum(0, 0, 0), volume(0)
198 virtual void internalProcessTriangleIndex(
btVector3* triangle,
int partId,
int triangleIndex)
209 btScalar vol =
btFabs((triangle[0] - ref).triple(triangle[1] - ref, triangle[2] - ref));
210 sum += (
btScalar(0.25) * vol) * ((triangle[0] + triangle[1] + triangle[2] + ref));
217 return (volume > 0) ?
sum / volume : ref;
232 InertiaCallback(
btVector3& center) :
sum(0, 0, 0, 0, 0, 0, 0, 0, 0), center(center)
236 virtual void internalProcessTriangleIndex(
btVector3* triangle,
int partId,
int triangleIndex)
245 for (
int j = 0; j < 3; j++)
247 for (
int k = 0; k <= j; k++)
249 i[j][k] = i[k][j] = volNeg * (
btScalar(0.1) * (a[j] * a[k] + b[j] * b[k] + c[j] * c[k]) +
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]));
269 CenterCallback centerCallback;
272 btVector3 center = centerCallback.getCenter();
274 volume = centerCallback.getVolume();
276 InertiaCallback inertiaCallback(center);
281 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 diagonalize(btMatrix3x3 &rot, btScalar threshold, int maxSteps)
diagonalizes this matrix by the Jacobi method.
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)
The btMatrix3x3 class implements a 3x3 rotation matrix, to perform linear algebra in combination with...
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.