btMultiSphereShape.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_MULTI_SPHERE_MINKOWSKI_H
00017 #define BT_MULTI_SPHERE_MINKOWSKI_H
00018 
00019 #include "btConvexInternalShape.h"
00020 #include "BulletCollision/BroadphaseCollision/btBroadphaseProxy.h" // for the types
00021 #include "LinearMath/btAlignedObjectArray.h"
00022 #include "LinearMath/btAabbUtil2.h"
00023 
00024 
00025 
00028 class btMultiSphereShape : public btConvexInternalAabbCachingShape
00029 {
00030         
00031         btAlignedObjectArray<btVector3> m_localPositionArray;
00032         btAlignedObjectArray<btScalar>  m_radiArray;
00033         
00034 public:
00035         btMultiSphereShape (const btVector3* positions,const btScalar* radi,int numSpheres);
00036 
00038         virtual void    calculateLocalInertia(btScalar mass,btVector3& inertia) const;
00039 
00041         virtual btVector3       localGetSupportingVertexWithoutMargin(const btVector3& vec)const;
00042 
00043         virtual void    batchedUnitVectorGetSupportingVertexWithoutMargin(const btVector3* vectors,btVector3* supportVerticesOut,int numVectors) const;
00044         
00045         int     getSphereCount() const
00046         {
00047                 return m_localPositionArray.size();
00048         }
00049 
00050         const btVector3&        getSpherePosition(int index) const
00051         {
00052                 return m_localPositionArray[index];
00053         }
00054 
00055         btScalar        getSphereRadius(int index) const
00056         {
00057                 return m_radiArray[index];
00058         }
00059 
00060 
00061         virtual const char*     getName()const 
00062         {
00063                 return "MultiSphere";
00064         }
00065 
00066         virtual int     calculateSerializeBufferSize() const;
00067 
00069         virtual const char*     serialize(void* dataBuffer, btSerializer* serializer) const;
00070 
00071 
00072 };
00073 
00074 
00075 struct  btPositionAndRadius
00076 {
00077         btVector3FloatData      m_pos;
00078         float           m_radius;
00079 };
00080 
00081 struct  btMultiSphereShapeData
00082 {
00083         btConvexInternalShapeData       m_convexInternalShapeData;
00084 
00085         btPositionAndRadius     *m_localPositionArrayPtr;
00086         int                             m_localPositionArraySize;
00087         char    m_padding[4];
00088 };
00089 
00090 
00091 
00092 SIMD_FORCE_INLINE       int     btMultiSphereShape::calculateSerializeBufferSize() const
00093 {
00094         return sizeof(btMultiSphereShapeData);
00095 }
00096 
00097 
00098 
00099 #endif //BT_MULTI_SPHERE_MINKOWSKI_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