Back to index

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

#include <btTriangleShape.h>

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

List of all members.

Public Member Functions

virtual int getNumVertices () const
const btVector3getVertexPtr (int index) const
virtual void getVertex (int index, btVector3 &vert) const
virtual int getShapeType () const
virtual int getNumEdges () const
virtual void getEdge (int i, btPoint3 &pa, btPoint3 &pb) const
virtual 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
btVector3 localGetSupportingVertexWithoutMargin (const btVector3 &dir) const
virtual void batchedUnitVectorGetSupportingVertexWithoutMargin (const btVector3 *vectors, btVector3 *supportVerticesOut, int numVectors) const
 btTriangleShape (const btVector3 &p0, const btVector3 &p1, const btVector3 &p2)
virtual void getPlane (btVector3 &planeNormal, btPoint3 &planeSupport, int i) const
virtual int getNumPlanes () const
void calcNormal (btVector3 &normal) const
virtual void getPlaneEquation (int i, btVector3 &planeNormal, btPoint3 &planeSupport) const
virtual void calculateLocalInertia (btScalar mass, btVector3 &inertia) const
virtual bool isInside (const btPoint3 &pt, btScalar tolerance) const
virtual const char * getName () 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 ()
virtual btVector3 localGetSupportingVertex (const btVector3 &vec) const
const btVector3getImplicitShapeDimensions () const
virtual void getAabbSlow (const btTransform &t, btVector3 &aabbMin, btVector3 &aabbMax) const
virtual void setLocalScaling (const btVector3 &scaling)
virtual const btVector3getLocalScaling () const
const btVector3getLocalScalingNV () const
virtual void setMargin (btScalar margin)
virtual btScalar getMargin () const
btScalar getMarginNV () const

Public Attributes

btVector3 m_vertices1 [3]
class Hull * m_optionalHull
 optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp

Protected Attributes

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 22 of file btTriangleShape.h.


Constructor & Destructor Documentation

btTriangleShape::btTriangleShape ( const btVector3 p0,
const btVector3 p1,
const btVector3 p2 
) [inline]

Definition at line 87 of file btTriangleShape.h.

       {
              m_vertices1[0] = p0;
              m_vertices1[1] = p1;
              m_vertices1[2] = p2;
       }

Member Function Documentation

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

Reimplemented from btPolyhedralConvexShape.

Definition at line 74 of file btTriangleShape.h.

       {
              for (int i=0;i<numVectors;i++)
              {
                     const btVector3& dir = vectors[i];
                     btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
                     supportVerticesOut[i] = m_vertices1[dots.maxAxis()];
              }

       }

Here is the call graph for this function:

void btTriangleShape::calcNormal ( btVector3 normal) const [inline]

Definition at line 106 of file btTriangleShape.h.

       {
              normal = (m_vertices1[1]-m_vertices1[0]).cross(m_vertices1[2]-m_vertices1[0]);
              normal.normalize();
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from btPolyhedralConvexShape.

Definition at line 119 of file btTriangleShape.h.

       {
              (void)mass;
              btAssert(0);
              inertia.setValue(btScalar(0.),btScalar(0.),btScalar(0.));
       }

Here is the call graph for this function:

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

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

Reimplemented from btPolyhedralConvexShape.

Definition at line 61 of file btTriangleShape.h.

       {
//            btAssert(0);
              getAabbSlow(t,aabbMin,aabbMax);
       }

Here is the call graph for this function:

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 btTriangleShape::getEdge ( int  i,
btPoint3 pa,
btPoint3 pb 
) const [inline, virtual]

Implements btPolyhedralConvexShape.

Definition at line 54 of file btTriangleShape.h.

       {
              getVertex(i,pa);
              getVertex((i+1)%3,pb);
       }

Here is the call graph for this function:

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* btTriangleShape::getName ( ) const [inline, virtual]

Definition at line 158 of file btTriangleShape.h.

              {
                     return "Triangle";
              }
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 btTriangleShape::getNumEdges ( ) const [inline, virtual]

Implements btPolyhedralConvexShape.

Definition at line 49 of file btTriangleShape.h.

       {
              return 3;
       }

Here is the caller graph for this function:

virtual int btTriangleShape::getNumPlanes ( ) const [inline, virtual]

Implements btPolyhedralConvexShape.

Definition at line 101 of file btTriangleShape.h.

       {
              return 1;
       }
virtual int btTriangleShape::getNumPreferredPenetrationDirections ( ) const [inline, virtual]

Reimplemented from btConvexInternalShape.

Definition at line 163 of file btTriangleShape.h.

              {
                     return 2;
              }
virtual int btTriangleShape::getNumVertices ( ) const [inline, virtual]

Implements btPolyhedralConvexShape.

Definition at line 31 of file btTriangleShape.h.

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

Implements btPolyhedralConvexShape.

Definition at line 96 of file btTriangleShape.h.

       {
              getPlaneEquation(i,planeNormal,planeSupport);
       }

Here is the call graph for this function:

virtual void btTriangleShape::getPlaneEquation ( int  i,
btVector3 planeNormal,
btPoint3 planeSupport 
) const [inline, virtual]

Definition at line 112 of file btTriangleShape.h.

       {
              (void)i;
              calcNormal(planeNormal);
              planeSupport = m_vertices1[0];
       }

Here is the call graph for this function:

Here is the caller graph for this function:

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

Reimplemented from btConvexInternalShape.

Definition at line 168 of file btTriangleShape.h.

              {
                     calcNormal(penetrationVector);
                     if (index)
                            penetrationVector *= btScalar(-1.);
              }

Here is the call graph for this function:

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

Definition at line 44 of file btTriangleShape.h.

virtual void btTriangleShape::getVertex ( int  index,
btVector3 vert 
) const [inline, virtual]

Implements btPolyhedralConvexShape.

Definition at line 40 of file btTriangleShape.h.

       {
              vert = m_vertices1[index];
       }

Here is the caller graph for this function:

const btVector3& btTriangleShape::getVertexPtr ( int  index) const [inline]

Definition at line 36 of file btTriangleShape.h.

       {
              return m_vertices1[index];
       }

Here is the caller graph for this function:

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

Implements btPolyhedralConvexShape.

Definition at line 126 of file btTriangleShape.h.

       {
              btVector3 normal;
              calcNormal(normal);
              //distance to plane
              btScalar dist = pt.dot(normal);
              btScalar planeconst = m_vertices1[0].dot(normal);
              dist -= planeconst;
              if (dist >= -tolerance && dist <= tolerance)
              {
                     //inside check on edge-planes
                     int i;
                     for (i=0;i<3;i++)
                     {
                            btPoint3 pa,pb;
                            getEdge(i,pa,pb);
                            btVector3 edge = pb-pa;
                            btVector3 edgeNormal = edge.cross(normal);
                            edgeNormal.normalize();
                            btScalar dist = pt.dot( edgeNormal);
                            btScalar edgeConst = pa.dot(edgeNormal);
                            dist -= edgeConst;
                            if (dist < -tolerance)
                                   return false;
                     }
                     
                     return true;
              }

              return false;
       }

Here is the call graph for this function:

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

Reimplemented in btBoxShape, btCylinderShape, btConeShape, and btConvexTriangleMeshShape.

Definition at line 54 of file btConvexInternalShape.cpp.

{
#ifndef __SPU__

        btVector3    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;

#else
       return btVector3(0,0,0);
#endif //__SPU__

 }

Here is the call graph for this function:

Here is the caller graph for this function:

Reimplemented from btPolyhedralConvexShape.

Definition at line 67 of file btTriangleShape.h.

       {
              btVector3 dots(dir.dot(m_vertices1[0]), dir.dot(m_vertices1[1]), dir.dot(m_vertices1[2]));
              return m_vertices1[dots.maxAxis()];

       }

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:

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

Reimplemented in btBoxShape, and btConvexTriangleMeshShape.

Definition at line 27 of file btConvexInternalShape.cpp.

{
       m_localScaling = scaling;
}
virtual void btConvexInternalShape::setMargin ( btScalar  margin) [inline, virtual, inherited]

Reimplemented in btBoxShape.

Definition at line 67 of file btConvexInternalShape.h.

       {
              m_collisionMargin = margin;
       }

Here is the caller 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.

Definition at line 28 of file btTriangleShape.h.


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