Back to index

supertuxkart  0.5+dfsg1
Public Member Functions | Protected Member Functions | Protected Attributes
btTriangleMeshShape Class Reference

Concave triangle mesh interface. Don't use this class directly, use btBvhTriangleMeshShape instead. More...

#include <btTriangleMeshShape.h>

Inheritance diagram for btTriangleMeshShape:
Inheritance graph
[legend]
Collaboration diagram for btTriangleMeshShape:
Collaboration graph
[legend]

List of all members.

Public Member Functions

virtual ~btTriangleMeshShape ()
virtual btVector3 localGetSupportingVertex (const btVector3 &vec) const
virtual btVector3 localGetSupportingVertexWithoutMargin (const btVector3 &vec) const
void recalcLocalAabb ()
virtual void getAabb (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
 getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.
virtual void processAllTriangles (btTriangleCallback *callback, const btVector3 &aabbMin, const btVector3 &aabbMax) const
virtual void calculateLocalInertia (btScalar mass, btVector3 &inertia) const
virtual void setLocalScaling (const btVector3 &scaling)
virtual const btVector3getLocalScaling () const
btStridingMeshInterfacegetMeshInterface ()
const btStridingMeshInterfacegetMeshInterface () const
virtual const char * getName () const
virtual btScalar getMargin () const
virtual void setMargin (btScalar collisionMargin)
virtual void getBoundingSphere (btVector3 &center, btScalar &radius) const
virtual btScalar getAngularMotionDisc () const
 getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of-impact with rotations.
void calculateTemporalAabb (const btTransform &curTrans, const btVector3 &linvel, const btVector3 &angvel, btScalar timeStep, btVector3 &temporalAabbMin, btVector3 &temporalAabbMax) const
 calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep) result is conservative
SIMD_FORCE_INLINE bool isPolyhedral () const
SIMD_FORCE_INLINE bool isConvex () const
SIMD_FORCE_INLINE bool isConcave () const
SIMD_FORCE_INLINE bool isCompound () const
SIMD_FORCE_INLINE bool isInfinite () const
 isInfinite is used to catch simulation error (aabb check)
virtual int getShapeType () const =0
void setUserPointer (void *userPtr)
 optional user data pointer
void * getUserPointer () const

Protected Member Functions

 btTriangleMeshShape (btStridingMeshInterface *meshInterface)
 btTriangleMeshShape constructor has been disabled/protected, so that users will not mistakenly use this class. Don't use btTriangleMeshShape but use btBvhTriangleMeshShape instead!

Protected Attributes

btVector3 m_localAabbMin
btVector3 m_localAabbMax
btStridingMeshInterfacem_meshInterface
btScalar m_collisionMargin

Detailed Description

Concave triangle mesh interface. Don't use this class directly, use btBvhTriangleMeshShape instead.

Definition at line 24 of file btTriangleMeshShape.h.


Constructor & Destructor Documentation

btTriangleMeshShape constructor has been disabled/protected, so that users will not mistakenly use this class. Don't use btTriangleMeshShape but use btBvhTriangleMeshShape instead!

Definition at line 24 of file btTriangleMeshShape.cpp.

: m_meshInterface(meshInterface)
{
       recalcLocalAabb();
}

Here is the call graph for this function:

Definition at line 31 of file btTriangleMeshShape.cpp.

{
              
}

Member Function Documentation

void btTriangleMeshShape::calculateLocalInertia ( btScalar  mass,
btVector3 inertia 
) const [virtual]

Implements btCollisionShape.

Definition at line 177 of file btTriangleMeshShape.cpp.

{
       (void)mass;
       //moving concave objects not supported
       btAssert(0);
       inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
}

Here is the call graph for this function:

void btCollisionShape::calculateTemporalAabb ( const btTransform curTrans,
const btVector3 linvel,
const btVector3 angvel,
btScalar  timeStep,
btVector3 temporalAabbMin,
btVector3 temporalAabbMax 
) const [inherited]

calculateTemporalAabb calculates the enclosing aabb for the moving object over interval [0..timeStep) result is conservative

Definition at line 49 of file btCollisionShape.cpp.

{
       //start with static aabb
       getAabb(curTrans,temporalAabbMin,temporalAabbMax);

       btScalar temporalAabbMaxx = temporalAabbMax.getX();
       btScalar temporalAabbMaxy = temporalAabbMax.getY();
       btScalar temporalAabbMaxz = temporalAabbMax.getZ();
       btScalar temporalAabbMinx = temporalAabbMin.getX();
       btScalar temporalAabbMiny = temporalAabbMin.getY();
       btScalar temporalAabbMinz = temporalAabbMin.getZ();

       // add linear motion
       btVector3 linMotion = linvel*timeStep;
       //todo: simd would have a vector max/min operation, instead of per-element access
       if (linMotion.x() > btScalar(0.))
              temporalAabbMaxx += linMotion.x(); 
       else
              temporalAabbMinx += linMotion.x();
       if (linMotion.y() > btScalar(0.))
              temporalAabbMaxy += linMotion.y(); 
       else
              temporalAabbMiny += linMotion.y();
       if (linMotion.z() > btScalar(0.))
              temporalAabbMaxz += linMotion.z(); 
       else
              temporalAabbMinz += linMotion.z();

       //add conservative angular motion
       btScalar angularMotion = angvel.length() * getAngularMotionDisc() * timeStep;
       btVector3 angularMotion3d(angularMotion,angularMotion,angularMotion);
       temporalAabbMin = btVector3(temporalAabbMinx,temporalAabbMiny,temporalAabbMinz);
       temporalAabbMax = btVector3(temporalAabbMaxx,temporalAabbMaxy,temporalAabbMaxz);

       temporalAabbMin -= angularMotion3d;
       temporalAabbMax += angularMotion3d;
}

Here is the call graph for this function:

void btTriangleMeshShape::getAabb ( const btTransform t,
btVector3 aabbMin,
btVector3 aabbMax 
) const [virtual]

getAabb returns the axis aligned bounding box in the coordinate frame of the given transform t.

Implements btCollisionShape.

Definition at line 39 of file btTriangleMeshShape.cpp.

{

       btVector3 localHalfExtents = btScalar(0.5)*(m_localAabbMax-m_localAabbMin);
       btVector3 localCenter = btScalar(0.5)*(m_localAabbMax+m_localAabbMin);
       
       btMatrix3x3 abs_b = trans.getBasis().absolute();  

       btPoint3 center = trans(localCenter);

       btVector3 extent = btVector3(abs_b[0].dot(localHalfExtents),
                 abs_b[1].dot(localHalfExtents),
                abs_b[2].dot(localHalfExtents));
       extent += btVector3(getMargin(),getMargin(),getMargin());

       aabbMin = center - extent;
       aabbMax = center + extent;

       
}

Here is the call graph for this function:

btScalar btCollisionShape::getAngularMotionDisc ( ) const [virtual, inherited]

getAngularMotionDisc returns the maximus radius needed for Conservative Advancement to handle time-of-impact with rotations.

Definition at line 40 of file btCollisionShape.cpp.

{
       btVector3     center;
       btScalar disc;
       getBoundingSphere(center,disc);
       disc += (center).length();
       return disc;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void btCollisionShape::getBoundingSphere ( btVector3 center,
btScalar radius 
) const [virtual, inherited]

Definition at line 28 of file btCollisionShape.cpp.

{
       btTransform tr;
       tr.setIdentity();
       btVector3 aabbMin,aabbMax;

       getAabb(tr,aabbMin,aabbMax);

       radius = (aabbMax-aabbMin).length()*btScalar(0.5);
       center = (aabbMin+aabbMax)*btScalar(0.5);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const btVector3 & btTriangleMeshShape::getLocalScaling ( ) const [virtual]

Implements btCollisionShape.

Definition at line 127 of file btTriangleMeshShape.cpp.

{
       return m_meshInterface->getScaling();
}

Here is the call graph for this function:

virtual btScalar btConcaveShape::getMargin ( ) const [inline, virtual, inherited]

Implements btCollisionShape.

Definition at line 38 of file btConcaveShape.h.

                                          {
              return m_collisionMargin;
       }

Here is the caller graph for this function:

Definition at line 58 of file btTriangleMeshShape.h.

       {
              return m_meshInterface;
       }

Definition at line 63 of file btTriangleMeshShape.h.

       {
              return m_meshInterface;
       }
virtual const char* btTriangleMeshShape::getName ( ) const [inline, virtual]

Implements btCollisionShape.

Definition at line 70 of file btTriangleMeshShape.h.

{return "TRIANGLEMESH";}
virtual int btCollisionShape::getShapeType ( ) const [pure virtual, inherited]

Implemented in btHeightfieldTerrainShape, btEmptyShape, and btStaticPlaneShape.

Here is the caller graph for this function:

void* btCollisionShape::getUserPointer ( ) const [inline, inherited]

Definition at line 101 of file btCollisionShape.h.

       {
              return m_userPointer;
       }

Here is the caller graph for this function:

SIMD_FORCE_INLINE bool btCollisionShape::isCompound ( ) const [inline, inherited]

Definition at line 68 of file btCollisionShape.h.

Here is the call graph for this function:

Here is the caller graph for this function:

SIMD_FORCE_INLINE bool btCollisionShape::isConcave ( ) const [inline, inherited]

Definition at line 64 of file btCollisionShape.h.

Here is the call graph for this function:

Here is the caller graph for this function:

SIMD_FORCE_INLINE bool btCollisionShape::isConvex ( ) const [inline, inherited]

Definition at line 60 of file btCollisionShape.h.

Here is the call graph for this function:

Here is the caller graph for this function:

SIMD_FORCE_INLINE bool btCollisionShape::isInfinite ( ) const [inline, inherited]

isInfinite is used to catch simulation error (aabb check)

Definition at line 74 of file btCollisionShape.h.

Here is the call graph for this function:

SIMD_FORCE_INLINE bool btCollisionShape::isPolyhedral ( ) const [inline, inherited]

Definition at line 55 of file btCollisionShape.h.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 186 of file btTriangleMeshShape.cpp.

{
       btVector3 supportVertex;

       btTransform ident;
       ident.setIdentity();

       SupportVertexCallback supportCallback(vec,ident);

       btVector3 aabbMax(btScalar(1e30),btScalar(1e30),btScalar(1e30));
       
       processAllTriangles(&supportCallback,-aabbMax,aabbMax);
              
       supportVertex = supportCallback.GetSupportVertexLocal();

       return supportVertex;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual btVector3 btTriangleMeshShape::localGetSupportingVertexWithoutMargin ( const btVector3 vec) const [inline, virtual]

Definition at line 41 of file btTriangleMeshShape.h.

       {
              assert(0);
              return localGetSupportingVertex(vec);
       }

Here is the call graph for this function:

void btTriangleMeshShape::processAllTriangles ( btTriangleCallback callback,
const btVector3 aabbMin,
const btVector3 aabbMax 
) const [virtual]

Implements btConcaveShape.

Definition at line 141 of file btTriangleMeshShape.cpp.

{
              struct FilteredCallback : public btInternalTriangleIndexCallback
       {
              btTriangleCallback* m_callback;
              btVector3 m_aabbMin;
              btVector3 m_aabbMax;

              FilteredCallback(btTriangleCallback* callback,const btVector3& aabbMin,const btVector3& aabbMax)
                     :m_callback(callback),
                     m_aabbMin(aabbMin),
                     m_aabbMax(aabbMax)
              {
              }

              virtual void internalProcessTriangleIndex(btVector3* triangle,int partId,int triangleIndex)
              {
                     if (TestTriangleAgainstAabb2(&triangle[0],m_aabbMin,m_aabbMax))
                     {
                            //check aabb in triangle-space, before doing this
                            m_callback->processTriangle(triangle,partId,triangleIndex);
                     }
                     
              }

       };

       FilteredCallback filterCallback(callback,aabbMin,aabbMax);

       m_meshInterface->InternalProcessAllTriangles(&filterCallback,aabbMin,aabbMax);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 60 of file btTriangleMeshShape.cpp.

{
       for (int i=0;i<3;i++)
       {
              btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
              vec[i] = btScalar(1.);
              btVector3 tmp = localGetSupportingVertex(vec);
              m_localAabbMax[i] = tmp[i]+m_collisionMargin;
              vec[i] = btScalar(-1.);
              tmp = localGetSupportingVertex(vec);
              m_localAabbMin[i] = tmp[i]-m_collisionMargin;
       }
}

Here is the call graph for this function:

Here is the caller graph for this function:

void btTriangleMeshShape::setLocalScaling ( const btVector3 scaling) [virtual]

Implements btCollisionShape.

Definition at line 121 of file btTriangleMeshShape.cpp.

Here is the call graph for this function:

virtual void btConcaveShape::setMargin ( btScalar  collisionMargin) [inline, virtual, inherited]

Implements btCollisionShape.

Definition at line 41 of file btConcaveShape.h.

       {
              m_collisionMargin = collisionMargin;
       }
void btCollisionShape::setUserPointer ( void *  userPtr) [inline, inherited]

optional user data pointer

Definition at line 96 of file btCollisionShape.h.

       {
              m_userPointer = userPtr;
       }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 29 of file btConcaveShape.h.

Definition at line 28 of file btTriangleMeshShape.h.

Definition at line 27 of file btTriangleMeshShape.h.

Definition at line 29 of file btTriangleMeshShape.h.


The documentation for this class was generated from the following files: