Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/external/bullet/BulletCollision/CollisionShapes/btPolyhedralConvexShape.h @ 6053

Last change on this file since 6053 was 5781, checked in by rgrieder, 15 years ago

Reverted trunk again. We might want to find a way to delete these revisions again (x3n's changes are still available as diff in the commit mails).

  • Property svn:eol-style set to native
File size: 3.0 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/btMatrix3x3.h"
20#include "LinearMath/btAabbUtil2.h"
21#include "btConvexInternalShape.h"
22
23
24///The btPolyhedralConvexShape is an internal interface class for polyhedral convex shapes.
25class btPolyhedralConvexShape : public btConvexInternalShape
26{
27
28protected:
29        btVector3       m_localAabbMin;
30        btVector3       m_localAabbMax;
31        bool            m_isLocalAabbValid;
32
33public:
34
35        btPolyhedralConvexShape();
36
37        //brute force implementations
38
39        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
40        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
41
42       
43        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
44
45
46        void setCachedLocalAabb (const btVector3& aabbMin, const btVector3& aabbMax)
47        {
48                m_isLocalAabbValid = true;
49                m_localAabbMin = aabbMin;
50                m_localAabbMax = aabbMax;
51        }
52
53        inline void getCachedLocalAabb (btVector3& aabbMin, btVector3& aabbMax) const
54        {
55                btAssert(m_isLocalAabbValid);
56                aabbMin = m_localAabbMin;
57                aabbMax = m_localAabbMax;
58        }
59
60        inline void getNonvirtualAabb(const btTransform& trans,btVector3& aabbMin,btVector3& aabbMax, btScalar margin) const
61        {
62
63                //lazy evaluation of local aabb
64                btAssert(m_isLocalAabbValid);
65                btTransformAabb(m_localAabbMin,m_localAabbMax,margin,trans,aabbMin,aabbMax);
66        }
67
68       
69        virtual void getAabb(const btTransform& t,btVector3& aabbMin,btVector3& aabbMax) const;
70
71        virtual void    setLocalScaling(const btVector3& scaling);
72
73        void    recalcLocalAabb();
74
75        virtual int     getNumVertices() const = 0 ;
76        virtual int getNumEdges() const = 0;
77        virtual void getEdge(int i,btVector3& pa,btVector3& pb) const = 0;
78        virtual void getVertex(int i,btVector3& vtx) const = 0;
79        virtual int     getNumPlanes() const = 0;
80        virtual void getPlane(btVector3& planeNormal,btVector3& planeSupport,int i ) const = 0;
81//      virtual int getIndex(int i) const = 0 ;
82
83        virtual bool isInside(const btVector3& pt,btScalar tolerance) const = 0;
84       
85        /// optional Hull is for optional Separating Axis Test Hull collision detection, see Hull.cpp
86        class   Hull*   m_optionalHull;
87
88};
89
90#endif //BU_SHAPE
Note: See TracBrowser for help on using the repository browser.