Back to index

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

StaticPlaneShape simulates an 'infinite' plane by dynamically reporting triangles approximated by intersection of the plane with the AABB. Assumed is that the other objects is not also infinite, so a reasonable sized AABB. More...

#include <btStaticPlaneShape.h>

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

List of all members.

Public Member Functions

 btStaticPlaneShape (const btVector3 &planeNormal, btScalar planeConstant)
virtual ~btStaticPlaneShape ()
virtual int getShapeType () const
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
const btVector3getPlaneNormal () const
const btScalargetPlaneConstant () 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)
void setUserPointer (void *userPtr)
 optional user data pointer
void * getUserPointer () const

Protected Attributes

btVector3 m_localAabbMin
btVector3 m_localAabbMax
btVector3 m_planeNormal
btScalar m_planeConstant
btVector3 m_localScaling
btScalar m_collisionMargin

Detailed Description

StaticPlaneShape simulates an 'infinite' plane by dynamically reporting triangles approximated by intersection of the plane with the AABB. Assumed is that the other objects is not also infinite, so a reasonable sized AABB.

Definition at line 24 of file btStaticPlaneShape.h.


Constructor & Destructor Documentation

btStaticPlaneShape::btStaticPlaneShape ( const btVector3 planeNormal,
btScalar  planeConstant 
)

Definition at line 21 of file btStaticPlaneShape.cpp.

:m_planeNormal(planeNormal),
m_planeConstant(planeConstant),
m_localScaling(btScalar(0.),btScalar(0.),btScalar(0.))
{
}

Definition at line 29 of file btStaticPlaneShape.cpp.

{
}

Member Function Documentation

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

Implements btCollisionShape.

Definition at line 89 of file btStaticPlaneShape.cpp.

{
       (void)mass;

       //moving concave objects not supported
       
       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 btStaticPlaneShape::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 35 of file btStaticPlaneShape.cpp.

{
       (void)t;
       /*
       btVector3 infvec (btScalar(1e30),btScalar(1e30),btScalar(1e30));

       btVector3 center = m_planeNormal*m_planeConstant;
       aabbMin = center + infvec*m_planeNormal;
       aabbMax = aabbMin;
       aabbMin.setMin(center - infvec*m_planeNormal);
       aabbMax.setMax(center - infvec*m_planeNormal); 
       */

       aabbMin.setValue(btScalar(-1e30),btScalar(-1e30),btScalar(-1e30));
       aabbMax.setValue(btScalar(1e30),btScalar(1e30),btScalar(1e30));

}

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 & btStaticPlaneShape::getLocalScaling ( ) const [virtual]

Implements btCollisionShape.

Definition at line 102 of file btStaticPlaneShape.cpp.

{
       return m_localScaling;
}
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:

virtual const char* btStaticPlaneShape::getName ( ) const [inline, virtual]

Implements btCollisionShape.

Definition at line 65 of file btStaticPlaneShape.h.

{return "STATICPLANE";}

Definition at line 59 of file btStaticPlaneShape.h.

       {
              return m_planeConstant;
       }

Here is the caller graph for this function:

const btVector3& btStaticPlaneShape::getPlaneNormal ( ) const [inline]

Definition at line 54 of file btStaticPlaneShape.h.

       {
              return m_planeNormal;
       }

Here is the caller graph for this function:

virtual int btStaticPlaneShape::getShapeType ( ) const [inline, virtual]

Implements btCollisionShape.

Definition at line 40 of file btStaticPlaneShape.h.

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:

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

Implements btConcaveShape.

Definition at line 56 of file btStaticPlaneShape.cpp.

{

       btVector3 halfExtents = (aabbMax - aabbMin) * btScalar(0.5);
       btScalar radius = halfExtents.length();
       btVector3 center = (aabbMax + aabbMin) * btScalar(0.5);
       
       //this is where the triangles are generated, given AABB and plane equation (normal/constant)

       btVector3 tangentDir0,tangentDir1;

       //tangentDir0/tangentDir1 can be precalculated
       btPlaneSpace1(m_planeNormal,tangentDir0,tangentDir1);

       btVector3 supVertex0,supVertex1;

       btVector3 projectedCenter = center - (m_planeNormal.dot(center) - m_planeConstant)*m_planeNormal;
       
       btVector3 triangle[3];
       triangle[0] = projectedCenter + tangentDir0*radius + tangentDir1*radius;
       triangle[1] = projectedCenter + tangentDir0*radius - tangentDir1*radius;
       triangle[2] = projectedCenter - tangentDir0*radius - tangentDir1*radius;

       callback->processTriangle(triangle,0,0);

       triangle[0] = projectedCenter - tangentDir0*radius - tangentDir1*radius;
       triangle[1] = projectedCenter - tangentDir0*radius + tangentDir1*radius;
       triangle[2] = projectedCenter + tangentDir0*radius + tangentDir1*radius;

       callback->processTriangle(triangle,0,1);

}

Here is the call graph for this function:

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

Implements btCollisionShape.

Definition at line 98 of file btStaticPlaneShape.cpp.

{
       m_localScaling = scaling;
}
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 btStaticPlaneShape.h.

Definition at line 27 of file btStaticPlaneShape.h.

Definition at line 32 of file btStaticPlaneShape.h.

Definition at line 31 of file btStaticPlaneShape.h.

Definition at line 30 of file btStaticPlaneShape.h.


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