Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/physics/src/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.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: 2.3 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 MULTI_SPHERE_MINKOWSKI_H
17#define MULTI_SPHERE_MINKOWSKI_H
18
19#include "btConvexInternalShape.h"
20#include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
21
22#define MAX_NUM_SPHERES 5
23
24///The btMultiSphereShape represents the convex hull of a collection of spheres. You can create special capsules or other smooth volumes.
25///It is possible to animate the spheres for deformation.
26class btMultiSphereShape : public btConvexInternalShape
27
28{
29       
30        btVector3 m_localPositions[MAX_NUM_SPHERES];
31        btScalar  m_radi[MAX_NUM_SPHERES];
32        btVector3       m_inertiaHalfExtents;
33
34        int m_numSpheres;
35       
36
37
38
39public:
40        btMultiSphereShape (const btVector3& inertiaHalfExtents,const btVector3* positions,const btScalar* radi,int numSpheres);
41
42        ///CollisionShape Interface
43        virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
44
45        /// btConvexShape Interface
46        virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
47
48        virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
49       
50        int     getSphereCount() const
51        {
52                return m_numSpheres;
53        }
54
55        const btVector3&        getSpherePosition(int index) const
56        {
57                return m_localPositions[index];
58        }
59
60        btScalar        getSphereRadius(int index) const
61        {
62                return m_radi[index];
63        }
64
65
66        virtual const char*     getName()const 
67        {
68                return "MultiSphere";
69        }
70
71};
72
73
74#endif //MULTI_SPHERE_MINKOWSKI_H
Note: See TracBrowser for help on using the repository browser.