btTetrahedronShape.h

Go to the documentation of this file.
00001 /*
00002 Bullet Continuous Collision Detection and Physics Library
00003 Copyright (c) 2003-2009 Erwin Coumans  http://bulletphysics.org
00004 
00005 This software is provided 'as-is', without any express or implied warranty.
00006 In no event will the authors be held liable for any damages arising from the use of this software.
00007 Permission is granted to anyone to use this software for any purpose, 
00008 including commercial applications, and to alter it and redistribute it freely, 
00009 subject to the following restrictions:
00010 
00011 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
00012 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
00013 3. This notice may not be removed or altered from any source distribution.
00014 */
00015 
00016 #ifndef BT_SIMPLEX_1TO4_SHAPE
00017 #define BT_SIMPLEX_1TO4_SHAPE
00018 
00019 
00020 #include "btPolyhedralConvexShape.h"
00021 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h"
00022 
00023 
00025 ATTRIBUTE_ALIGNED16(class) btBU_Simplex1to4 : public btPolyhedralConvexAabbCachingShape
00026 {
00027 protected:
00028 
00029         int     m_numVertices;
00030         btVector3       m_vertices[4];
00031 
00032 public:
00033         BT_DECLARE_ALIGNED_ALLOCATOR();
00034         
00035         btBU_Simplex1to4();
00036 
00037         btBU_Simplex1to4(const btVector3& pt0);
00038         btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1);
00039         btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2);
00040         btBU_Simplex1to4(const btVector3& pt0,const btVector3& pt1,const btVector3& pt2,const btVector3& pt3);
00041 
00042     
00043         void    reset()
00044         {
00045                 m_numVertices = 0;
00046         }
00047         
00048         virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
00049 
00050         void addVertex(const btVector3& pt);
00051 
00052         //PolyhedralConvexShape interface
00053 
00054         virtual int     getNumVertices() const;
00055 
00056         virtual int getNumEdges() const;
00057 
00058         virtual void getEdge(int i,btVector3& pa,btVector3& pb) const;
00059         
00060         virtual void getVertex(int i,btVector3& vtx) const;
00061 
00062         virtual int     getNumPlanes() const;
00063 
00064         virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i) const;
00065 
00066         virtual int getIndex(int i) const;
00067 
00068         virtual bool isInside(const btVector3& pt,btScalar tolerance) const;
00069 
00070 
00072         virtual const char*     getName()const { return "btBU_Simplex1to4";}
00073 
00074 };
00075 
00076 #endif //BT_SIMPLEX_1TO4_SHAPE