btPolyhedralConvexShape.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_POLYHEDRAL_CONVEX_SHAPE_H
00017 #define BT_POLYHEDRAL_CONVEX_SHAPE_H
00018 
00019 #include "LinearMath/btMatrix3x3.h"
00020 #include "btConvexInternalShape.h"
00021 class btConvexPolyhedron;
00022 
00023 
00025 class btPolyhedralConvexShape : public btConvexInternalShape
00026 {
00027         
00028 
00029 protected:
00030         
00031         btConvexPolyhedron* m_polyhedron;
00032 
00033 public:
00034 
00035         btPolyhedralConvexShape();
00036 
00037         virtual ~btPolyhedralConvexShape();
00038 
00040         virtual bool    initializePolyhedralFeatures();
00041 
00042         const btConvexPolyhedron*       getConvexPolyhedron() const
00043         {
00044                 return m_polyhedron;
00045         }
00046 
00047         //brute force implementations
00048 
00049         virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
00050         virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
00051         
00052         virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
00053         
00054         
00055         virtual int     getNumVertices() const = 0 ;
00056         virtual int getNumEdges() const = 0;
00057         virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0;
00058         virtual void getVertex(int i,btVector3& vtx) const = 0;
00059         virtual int     getNumPlanes() const = 0;
00060         virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const = 0;
00061 //      virtual int getIndex(int i) const = 0 ; 
00062 
00063         virtual bool isInside(const btVector3& pt,btScalar tolerance) const = 0;
00064         
00065 };
00066 
00067 
00069 class btPolyhedralConvexAabbCachingShape : public btPolyhedralConvexShape
00070 {
00071 
00072         btVector3       m_localAabbMin;
00073         btVector3       m_localAabbMax;
00074         bool            m_isLocalAabbValid;
00075                 
00076 protected:
00077 
00078         void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
00079         {
00080                 m_isLocalAabbValid = true;
00081                 m_localAabbMin = aabbMin;
00082                 m_localAabbMax = aabbMax;
00083         }
00084 
00085         inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
00086         {
00087                 btAssert(m_isLocalAabbValid);
00088                 aabbMin = m_localAabbMin;
00089                 aabbMax = m_localAabbMax;
00090         }
00091 
00092 public:
00093 
00094         btPolyhedralConvexAabbCachingShape();
00095         
00096         inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
00097         {
00098 
00099                 //lazy evaluation of local aabb
00100                 btAssert(m_isLocalAabbValid);
00101                 btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
00102         }
00103 
00104         virtual void    setLocalScaling(const btVector3& scaling);
00105 
00106         virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
00107 
00108         void    recalcLocalAabb();
00109 
00110 };
00111 
00112 #endif //BT_POLYHEDRAL_CONVEX_SHAPE_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


bullet
Author(s): Erwin Coumans, ROS package maintained by Tully Foote
autogenerated on Wed Oct 31 2012 07:54:31