Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h @ 1963

Last change on this file since 1963 was 1963, checked in by rgrieder, 16 years ago

Added Bullet physics engine.

  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans  http://continuousphysics.com/Bullet/
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. 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.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BU_SHAPE
17#define BU_SHAPE
18
19#include "LinearMath/btPoint3.h"
20#include "LinearMath/btMatrix3x3.h"
21#include "LinearMath/btAabbUtil2.h"
22#include "btConvexInternalShape.h"
23
24
25///The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
26class btPolyhedralConvexShape : public btConvexInternalShape
27{
28
29protected:
30        btVector3       m_localAabbMin;
31        btVector3       m_localAabbMax;
32        bool            m_isLocalAabbValid;
33
34public:
35
36        btPolyhedralConvexShape();
37
38        //brute force implementations
39
40        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
41        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
42
43       
44        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
45
46
47        void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
48        {
49                m_isLocalAabbValid = true;
50                m_localAabbMin = aabbMin;
51                m_localAabbMax = aabbMax;
52        }
53
54        inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
55        {
56                btAssert(m_isLocalAabbValid);
57                aabbMin = m_localAabbMin;
58                aabbMax = m_localAabbMax;
59        }
60
61        inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
62        {
63
64                //lazy evaluation of local aabb
65                btAssert(m_isLocalAabbValid);
66                btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
67        }
68
69       
70        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
71
72        virtual void    setLocalScaling(const btVector3& scaling);
73
74        void    recalcLocalAabb();
75
76        virtual int     getNumVertices() const = 0 ;
77        virtual int getNumEdges() const = 0;
78        virtual void getEdge(int i,btPoint3& pa,btPoint3& pb) const = 0;
79        virtual void getVertex(int i,btPoint3& vtx) const = 0;
80        virtual int     getNumPlanes() const = 0;
81        virtual void getPlane(btVector3& planeNormal,btPoint3& planeSupport,int i ) const = 0;
82//      virtual int getIndex(int i) const = 0 ;
83
84        virtual bool isInside(const btPoint3& pt,btScalar tolerance) const = 0;
85       
86        /// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp
87        class   Hull*   m_optionalHull;
88
89};
90
91#endif //BU_SHAPE
Note: See TracBrowser for help on using the repository browser.