Back to index

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

#include <btCylinderShape.h>

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

List of all members.

Public Member Functions

 btCylinderShapeX (const btVector3 &halfExtents)
virtual btVector3 localGetSupportingVertexWithoutMargin (const btVector3 &vec) const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin (const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
virtual const char * getName () const
virtual btScalar getRadius () const
void getAabb (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
 getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version
virtual btVector3 localGetSupportingVertex (const btVector3 &vec) const
virtual int getShapeType () const
int getUpAxis () const
btVector3 getHalfExtentsWithMargin () const
const btVector3getHalfExtentsWithoutMargin () const
virtual void setMargin (btScalar collisionMargin)
virtual void setLocalScaling (const btVector3 &scaling)
virtual void calculateLocalInertia (btScalar mass, btVector3 &inertia) const
virtual void getPlane (btVector3 &planeNormal, btPoint3 &planeSupport, int i) const
virtual int getNumPlanes () const
virtual int getNumVertices () const
virtual int getNumEdges () const
virtual void getVertex (int i, btVector3 &vtx) const
virtual void getPlaneEquation (btVector4 &plane, int i) const
virtual void getEdge (int i, btPoint3 &pa, btPoint3 &pb) const
virtual bool isInside (const btPoint3 &pt, btScalar tolerance) const
virtual int getNumPreferredPenetrationDirections () const
virtual void getPreferredPenetrationDirection (int index, btVector3 &penetrationVector) const
void getNonvirtualAabb (const btTransform &trans, btVector3 &aabbMin, btVector3 &aabbMax, btScalar margin) const
void recalcLocalAabb ()
const btVector3getImplicitShapeDimensions () const
virtual void getAabbSlow (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
virtual const btVector3getLocalScaling () const
const btVector3getLocalScalingNV () const
virtual btScalar getMargin () const
btScalar getMarginNV () const

Public Attributes

class Hull * m_optionalHull
 optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp

Protected Attributes

int m_upAxis
btVector3 m_localAabbMin
btVector3 m_localAabbMax
bool m_isLocalAabbValid
btVector3 m_localScaling
btVector3 m_implicitShapeDimensions
btScalar m_collisionMargin
btScalar m_padding

Detailed Description

Definition at line 90 of file btCylinderShape.h.


Constructor & Destructor Documentation

Definition at line 26 of file btCylinderShape.cpp.

:btCylinderShape(halfExtents)
{
       m_upAxis = 0;
       recalcLocalAabb();
}

Here is the call graph for this function:


Member Function Documentation

void btCylinderShapeX::batchedUnitVectorGetSupportingVertexWithoutMargin ( const btVector3 vectors,
btVector3 supportVerticesOut,
int  numVectors 
) const [virtual]

Reimplemented from btCylinderShape.

Definition at line 198 of file btCylinderShape.cpp.

{
       for (int i=0;i<numVectors;i++)
       {
              supportVerticesOut[i] = CylinderLocalSupportX(getHalfExtentsWithoutMargin(),vectors[i]);
       }
}

Here is the call graph for this function:

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

Reimplemented from btPolyhedralConvexShape.

Definition at line 40 of file btBoxShape.cpp.

{
       //btScalar margin = btScalar(0.);
       btVector3 halfExtents = getHalfExtentsWithMargin();

       btScalar lx=btScalar(2.)*(halfExtents.x());
       btScalar ly=btScalar(2.)*(halfExtents.y());
       btScalar lz=btScalar(2.)*(halfExtents.z());

       inertia.setValue(mass/(btScalar(12.0)) * (ly*ly + lz*lz),
                                   mass/(btScalar(12.0)) * (lx*lx + lz*lz),
                                   mass/(btScalar(12.0)) * (lx*lx + ly*ly));

}

Here is the call graph for this function:

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

getAabb's default implementation is brute force, expected derived classes to implement a fast dedicated version

Reimplemented from btBoxShape.

Definition at line 41 of file btCylinderShape.cpp.

{
       //skip the box 'getAabb'
       btPolyhedralConvexShape::getAabb(t,aabbMin,aabbMax);
}
void btConvexInternalShape::getAabbSlow ( const btTransform t,
btVector3 aabbMin,
btVector3 aabbMax 
) const [virtual, inherited]

Definition at line 34 of file btConvexInternalShape.cpp.

{

       btScalar margin = getMargin();
       for (int i=0;i<3;i++)
       {
              btVector3 vec(btScalar(0.),btScalar(0.),btScalar(0.));
              vec[i] = btScalar(1.);

              btVector3 sv = localGetSupportingVertex(vec*trans.getBasis());

              btVector3 tmp = trans(sv);
              maxAabb[i] = tmp[i]+margin;
              vec[i] = btScalar(-1.);
              tmp = trans(localGetSupportingVertex(vec*trans.getBasis()));
              minAabb[i] = tmp[i]-margin;
       }
};

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void btBoxShape::getEdge ( int  i,
btPoint3 pa,
btPoint3 pb 
) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 193 of file btBoxShape.h.

       {
              int edgeVert0 = 0;
              int edgeVert1 = 0;

              switch (i)
              {
              case 0:
                            edgeVert0 = 0;
                            edgeVert1 = 1;
                     break;
              case 1:
                            edgeVert0 = 0;
                            edgeVert1 = 2;
                     break;
              case 2:
                     edgeVert0 = 1;
                     edgeVert1 = 3;

                     break;
              case 3:
                     edgeVert0 = 2;
                     edgeVert1 = 3;
                     break;
              case 4:
                     edgeVert0 = 0;
                     edgeVert1 = 4;
                     break;
              case 5:
                     edgeVert0 = 1;
                     edgeVert1 = 5;

                     break;
              case 6:
                     edgeVert0 = 2;
                     edgeVert1 = 6;
                     break;
              case 7:
                     edgeVert0 = 3;
                     edgeVert1 = 7;
                     break;
              case 8:
                     edgeVert0 = 4;
                     edgeVert1 = 5;
                     break;
              case 9:
                     edgeVert0 = 4;
                     edgeVert1 = 6;
                     break;
              case 10:
                     edgeVert0 = 5;
                     edgeVert1 = 7;
                     break;
              case 11:
                     edgeVert0 = 6;
                     edgeVert1 = 7;
                     break;
              default:
                     btAssert(0);

              }

              getVertex(edgeVert0,pa );
              getVertex(edgeVert1,pb );
       }

Here is the call graph for this function:

btVector3 btBoxShape::getHalfExtentsWithMargin ( ) const [inline, inherited]

Definition at line 34 of file btBoxShape.h.

       {
              btVector3 halfExtents = getHalfExtentsWithoutMargin();
              btVector3 margin(getMargin(),getMargin(),getMargin());
              halfExtents += margin;
              return halfExtents;
       }

Here is the call graph for this function:

Here is the caller graph for this function:

const btVector3& btBoxShape::getHalfExtentsWithoutMargin ( ) const [inline, inherited]

Definition at line 42 of file btBoxShape.h.

       {
              return m_implicitShapeDimensions;//changed in Bullet 2.63: assume the scaling and margin are included
       }

Here is the caller graph for this function:

const btVector3& btConvexInternalShape::getImplicitShapeDimensions ( ) const [inline, inherited]

Definition at line 40 of file btConvexInternalShape.h.

virtual const btVector3& btConvexInternalShape::getLocalScaling ( ) const [inline, virtual, inherited]

Reimplemented in btConvexTriangleMeshShape.

Definition at line 57 of file btConvexInternalShape.h.

       {
              return m_localScaling;
       }
const btVector3& btConvexInternalShape::getLocalScalingNV ( ) const [inline, inherited]

Definition at line 62 of file btConvexInternalShape.h.

       {
              return m_localScaling;
       }
virtual btScalar btConvexInternalShape::getMargin ( ) const [inline, virtual, inherited]

Reimplemented in btMinkowskiSumShape.

Definition at line 71 of file btConvexInternalShape.h.

       {
              return m_collisionMargin;
       }

Here is the caller graph for this function:

btScalar btConvexInternalShape::getMarginNV ( ) const [inline, inherited]

Definition at line 76 of file btConvexInternalShape.h.

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

Reimplemented from btCylinderShape.

Definition at line 99 of file btCylinderShape.h.

       {
              return "CylinderX";
       }
void btPolyhedralConvexShape::getNonvirtualAabb ( const btTransform trans,
btVector3 aabbMin,
btVector3 aabbMax,
btScalar  margin 
) const [inline, inherited]

Definition at line 44 of file btPolyhedralConvexShape.h.

       {

              //lazy evaluation of local aabb
              btAssert(m_isLocalAabbValid);

              btAssert(m_localAabbMin.getX() <= m_localAabbMax.getX());
              btAssert(m_localAabbMin.getY() <= m_localAabbMax.getY());
              btAssert(m_localAabbMin.getZ() <= m_localAabbMax.getZ());


              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(margin,margin,margin);

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

              
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual int btBoxShape::getNumEdges ( ) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 140 of file btBoxShape.h.

       {
              return 12;
       }
virtual int btBoxShape::getNumPlanes ( ) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 130 of file btBoxShape.h.

       {
              return 6;
       }      
virtual int btBoxShape::getNumPreferredPenetrationDirections ( ) const [inline, virtual, inherited]

Reimplemented from btConvexInternalShape.

Definition at line 287 of file btBoxShape.h.

       {
              return 6;
       }
virtual int btBoxShape::getNumVertices ( ) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 135 of file btBoxShape.h.

       {
              return 8;
       }
virtual void btBoxShape::getPlane ( btVector3 planeNormal,
btPoint3 planeSupport,
int  i 
) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 120 of file btBoxShape.h.

       {
              //this plane might not be aligned...
              btVector4 plane ;
              getPlaneEquation(plane,i);
              planeNormal = btVector3(plane.getX(),plane.getY(),plane.getZ());
              planeSupport = localGetSupportingVertex(-planeNormal);
       }

Here is the call graph for this function:

virtual void btBoxShape::getPlaneEquation ( btVector4 plane,
int  i 
) const [inline, virtual, inherited]

Definition at line 157 of file btBoxShape.h.

       {
              btVector3 halfExtents = getHalfExtentsWithoutMargin();

              switch (i)
              {
              case 0:
                     plane.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
                     plane[3] = -halfExtents.x();
                     break;
              case 1:
                     plane.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
                     plane[3] = -halfExtents.x();
                     break;
              case 2:
                     plane.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
                     plane[3] = -halfExtents.y();
                     break;
              case 3:
                     plane.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
                     plane[3] = -halfExtents.y();
                     break;
              case 4:
                     plane.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
                     plane[3] = -halfExtents.z();
                     break;
              case 5:
                     plane.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
                     plane[3] = -halfExtents.z();
                     break;
              default:
                     assert(0);
              }
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual void btBoxShape::getPreferredPenetrationDirection ( int  index,
btVector3 penetrationVector 
) const [inline, virtual, inherited]

Reimplemented from btConvexInternalShape.

Definition at line 292 of file btBoxShape.h.

       {
              switch (index)
              {
              case 0:
                     penetrationVector.setValue(btScalar(1.),btScalar(0.),btScalar(0.));
                     break;
              case 1:
                     penetrationVector.setValue(btScalar(-1.),btScalar(0.),btScalar(0.));
                     break;
              case 2:
                     penetrationVector.setValue(btScalar(0.),btScalar(1.),btScalar(0.));
                     break;
              case 3:
                     penetrationVector.setValue(btScalar(0.),btScalar(-1.),btScalar(0.));
                     break;
              case 4:
                     penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(1.));
                     break;
              case 5:
                     penetrationVector.setValue(btScalar(0.),btScalar(0.),btScalar(-1.));
                     break;
              default:
                     assert(0);
              }
       }

Here is the call graph for this function:

virtual btScalar btCylinderShapeX::getRadius ( ) const [inline, virtual]

Reimplemented from btCylinderShape.

Definition at line 104 of file btCylinderShape.h.

       {
              return getHalfExtentsWithMargin().getY();
       }

Here is the call graph for this function:

virtual int btCylinderShape::getShapeType ( ) const [inline, virtual, inherited]

Reimplemented from btBoxShape.

Definition at line 65 of file btCylinderShape.h.

int btCylinderShape::getUpAxis ( ) const [inline, inherited]

Reimplemented in btCylinderShapeZ.

Definition at line 70 of file btCylinderShape.h.

       {
              return m_upAxis;
       }

Here is the caller graph for this function:

virtual void btBoxShape::getVertex ( int  i,
btVector3 vtx 
) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 146 of file btBoxShape.h.

       {
              btVector3 halfExtents = getHalfExtentsWithoutMargin();

              vtx = btVector3(
                            halfExtents.x() * (1-(i&1)) - halfExtents.x() * (i&1),
                            halfExtents.y() * (1-((i&2)>>1)) - halfExtents.y() * ((i&2)>>1),
                            halfExtents.z() * (1-((i&4)>>2)) - halfExtents.z() * ((i&4)>>2));
       }

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool btBoxShape::isInside ( const btPoint3 pt,
btScalar  tolerance 
) const [inline, virtual, inherited]

Implements btPolyhedralConvexShape.

Definition at line 264 of file btBoxShape.h.

       {
              btVector3 halfExtents = getHalfExtentsWithoutMargin();

              //btScalar minDist = 2*tolerance;
              
              bool result = (pt.x() <= (halfExtents.x()+tolerance)) &&
                                          (pt.x() >= (-halfExtents.x()-tolerance)) &&
                                          (pt.y() <= (halfExtents.y()+tolerance)) &&
                                          (pt.y() >= (-halfExtents.y()-tolerance)) &&
                                          (pt.z() <= (halfExtents.z()+tolerance)) &&
                                          (pt.z() >= (-halfExtents.z()-tolerance));
              
              return result;
       }

Here is the call graph for this function:

virtual btVector3 btCylinderShape::localGetSupportingVertex ( const btVector3 vec) const [inline, virtual, inherited]

Reimplemented from btBoxShape.

Definition at line 42 of file btCylinderShape.h.

       {

              btVector3 supVertex;
              supVertex = localGetSupportingVertexWithoutMargin(vec);
              
              if ( getMargin()!=btScalar(0.) )
              {
                     btVector3 vecnorm = vec;
                     if (vecnorm .length2() < (SIMD_EPSILON*SIMD_EPSILON))
                     {
                            vecnorm.setValue(btScalar(-1.),btScalar(-1.),btScalar(-1.));
                     } 
                     vecnorm.normalize();
                     supVertex+= getMargin() * vecnorm;
              }
              return supVertex;
       }

Here is the call graph for this function:

Reimplemented from btCylinderShape.

Definition at line 164 of file btCylinderShape.cpp.

Here is the call graph for this function:

Definition at line 132 of file btPolyhedralConvexShape.cpp.

{
       m_isLocalAabbValid = true;

       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:

virtual void btBoxShape::setLocalScaling ( const btVector3 scaling) [inline, virtual, inherited]

Reimplemented from btConvexInternalShape.

Definition at line 102 of file btBoxShape.h.

       {
              btVector3 oldMargin(getMargin(),getMargin(),getMargin());
              btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
              btVector3 unScaledImplicitShapeDimensionsWithMargin = implicitShapeDimensionsWithMargin / m_localScaling;

              btConvexInternalShape::setLocalScaling(scaling);

              m_implicitShapeDimensions = (unScaledImplicitShapeDimensionsWithMargin * m_localScaling) - oldMargin;

       }

Here is the call graph for this function:

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

Reimplemented from btConvexInternalShape.

Definition at line 91 of file btBoxShape.h.

       {
              //correct the m_implicitShapeDimensions for the margin
              btVector3 oldMargin(getMargin(),getMargin(),getMargin());
              btVector3 implicitShapeDimensionsWithMargin = m_implicitShapeDimensions+oldMargin;
              
              btConvexInternalShape::setMargin(collisionMargin);
              btVector3 newMargin(getMargin(),getMargin(),getMargin());
              m_implicitShapeDimensions = implicitShapeDimensionsWithMargin - newMargin;

       }

Here is the call graph for this function:


Member Data Documentation

Definition at line 18 of file btConvexInternalShape.h.

Definition at line 16 of file btConvexInternalShape.h.

bool btPolyhedralConvexShape::m_isLocalAabbValid [protected, inherited]

Definition at line 31 of file btPolyhedralConvexShape.h.

Definition at line 30 of file btPolyhedralConvexShape.h.

Definition at line 29 of file btPolyhedralConvexShape.h.

Definition at line 14 of file btConvexInternalShape.h.

class Hull* btPolyhedralConvexShape::m_optionalHull [inherited]

optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp

Definition at line 89 of file btPolyhedralConvexShape.h.

Definition at line 20 of file btConvexInternalShape.h.

int btCylinderShape::m_upAxis [protected, inherited]

Definition at line 30 of file btCylinderShape.h.


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